Search in sources :

Example 1 with MigrationCluster

use of com.ctrip.xpipe.redis.console.migration.model.MigrationCluster in project x-pipe by ctripcorp.

the class MigrationEventDao method loadMigrationEvent.

private MigrationEvent loadMigrationEvent(List<MigrationEventTbl> details) {
    if (!CollectionUtils.isEmpty(details)) {
        MigrationEvent event = new DefaultMigrationEvent(details.get(0));
        for (MigrationEventTbl detail : details) {
            MigrationClusterTbl cluster = detail.getRedundantClusters();
            MigrationShardTbl shard = detail.getRedundantShards();
            if (null == event.getMigrationCluster(cluster.getClusterId())) {
                event.addMigrationCluster(new DefaultMigrationCluster(executors, scheduled, event, detail.getRedundantClusters(), dcService, clusterService, shardService, redisService, migrationService));
            }
            MigrationCluster migrationCluster = event.getMigrationCluster(cluster.getClusterId());
            migrationCluster.addNewMigrationShard(new DefaultMigrationShard(migrationCluster, shard, migrationCluster.getClusterShards().get(shard.getShardId()), migrationCluster.getClusterDcs(), migrationService));
        }
        return event;
    }
    throw new BadRequestException("Cannot load migration event from null.");
}
Also used : DefaultMigrationEvent(com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationEvent) DefaultMigrationCluster(com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationCluster) MigrationCluster(com.ctrip.xpipe.redis.console.migration.model.MigrationCluster) DefaultMigrationCluster(com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationCluster) BadRequestException(com.ctrip.xpipe.redis.console.exception.BadRequestException) DefaultMigrationShard(com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationShard) MigrationEvent(com.ctrip.xpipe.redis.console.migration.model.MigrationEvent) DefaultMigrationEvent(com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationEvent)

Example 2 with MigrationCluster

use of com.ctrip.xpipe.redis.console.migration.model.MigrationCluster in project x-pipe by ctripcorp.

the class MigrationCheckingState method refresh.

@Override
public void refresh() {
    MigrationCluster holder = getHolder();
    ClusterStepResult clusterStepResult = holder.stepStatus(ShardMigrationStep.CHECK);
    if (clusterStepResult.isStepFinish()) {
        if (clusterStepResult.isStepSuccess()) {
            logger.debug("[refresh][check success]{}", this);
            updateAndProcess(nextAfterSuccess());
        } else {
            logger.debug("[refresh][check fail]{}", this);
            updateAndStop(nextAfterFail());
        }
    }
}
Also used : MigrationCluster(com.ctrip.xpipe.redis.console.migration.model.MigrationCluster) ClusterStepResult(com.ctrip.xpipe.redis.console.migration.model.ClusterStepResult)

Example 3 with MigrationCluster

use of com.ctrip.xpipe.redis.console.migration.model.MigrationCluster in project x-pipe by ctripcorp.

the class MigrationCheckingState method doAction.

@Override
public void doAction() {
    MigrationCluster migrationCluster = getHolder();
    if (!doCheckClientService(migrationCluster)) {
        return;
    }
    doShardCheck(migrationCluster);
}
Also used : MigrationCluster(com.ctrip.xpipe.redis.console.migration.model.MigrationCluster)

Example 4 with MigrationCluster

use of com.ctrip.xpipe.redis.console.migration.model.MigrationCluster in project x-pipe by ctripcorp.

the class DefaultMigrationEvent method rollbackCluster.

@Override
public MigrationCluster rollbackCluster(long clusterId) throws ClusterNotFoundException {
    MigrationCluster migrationCluster = getMigrationCluster(clusterId);
    if (migrationCluster == null) {
        throw new ClusterNotFoundException(clusterId);
    }
    migrationCluster.rollback();
    return migrationCluster;
}
Also used : ClusterNotFoundException(com.ctrip.xpipe.redis.console.service.migration.exception.ClusterNotFoundException) MigrationCluster(com.ctrip.xpipe.redis.console.migration.model.MigrationCluster)

Example 5 with MigrationCluster

use of com.ctrip.xpipe.redis.console.migration.model.MigrationCluster in project x-pipe by ctripcorp.

the class DefaultMigrationEvent method process.

@Override
public void process() {
    List<MigrationCluster> migrationClusters = getMigrationClusters();
    if (migrationClusters.size() == 0) {
        logger.info("[process][no cluster]{}", migrationClusters);
        return;
    }
    MigrationCluster migrationCluster = migrationClusters.get(0);
    migrationCluster.process();
}
Also used : MigrationCluster(com.ctrip.xpipe.redis.console.migration.model.MigrationCluster)

Aggregations

MigrationCluster (com.ctrip.xpipe.redis.console.migration.model.MigrationCluster)10 ClusterNotFoundException (com.ctrip.xpipe.redis.console.service.migration.exception.ClusterNotFoundException)3 AbstractExceptionLogTask (com.ctrip.xpipe.concurrent.AbstractExceptionLogTask)1 BadRequestException (com.ctrip.xpipe.redis.console.exception.BadRequestException)1 ClusterStepResult (com.ctrip.xpipe.redis.console.migration.model.ClusterStepResult)1 MigrationEvent (com.ctrip.xpipe.redis.console.migration.model.MigrationEvent)1 MigrationShard (com.ctrip.xpipe.redis.console.migration.model.MigrationShard)1 DefaultMigrationCluster (com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationCluster)1 DefaultMigrationEvent (com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationEvent)1 DefaultMigrationShard (com.ctrip.xpipe.redis.console.migration.model.impl.DefaultMigrationShard)1 RedisTbl (com.ctrip.xpipe.redis.console.model.RedisTbl)1 RedisService (com.ctrip.xpipe.redis.console.service.RedisService)1 InetSocketAddress (java.net.InetSocketAddress)1 LinkedList (java.util.LinkedList)1