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.");
}
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());
}
}
}
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);
}
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;
}
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();
}
Aggregations