use of com.ctrip.xpipe.redis.console.migration.model.ShardMigrationResult in project x-pipe by ctripcorp.
the class MigrationPartialSuccessState method doAction.
@Override
public void doAction() {
for (final MigrationShard shard : getHolder().getMigrationShards()) {
ShardMigrationResult shardMigrationResult = shard.getShardMigrationResult();
if (!shardMigrationResult.stepSuccess(ShardMigrationStep.MIGRATE_NEW_PRIMARY_DC)) {
shardMigrationResult.stepRetry(ShardMigrationStep.MIGRATE_NEW_PRIMARY_DC);
String clusterName = getHolder().clusterName();
String shardName = shard.shardName();
logger.info("[doAction][execute]{}, {}", clusterName, shardName);
executors.execute(new AbstractExceptionLogTask() {
@Override
public void doRun() {
logger.info("[doMigrate][start]{},{}", clusterName, shardName);
shard.doMigrate();
logger.info("[doMigrate][done]{},{}", clusterName, shardName);
}
});
}
}
}
use of com.ctrip.xpipe.redis.console.migration.model.ShardMigrationResult in project x-pipe by ctripcorp.
the class DefaultShardMigrationResultTest method testEncodeDecode.
@Test
public void testEncodeDecode() {
DefaultShardMigrationResult result = new DefaultShardMigrationResult();
for (ShardMigrationStep step : ShardMigrationStep.values()) {
result.updateStepResult(step, true, randomString(10));
}
result.setNewMaster(new HostPort("127.0.0.1", randomPort()));
String encode = result.encode();
ShardMigrationResult decode = DefaultShardMigrationResult.fromEncodeStr(encode);
logger.info("{}", decode);
Assert.assertEquals(result, decode);
}
Aggregations