Search in sources :

Example 6 with MigrationShard

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

the class MigrationCheckingState method doShardCheck.

private void doShardCheck(MigrationCluster migrationCluster) {
    List<MigrationShard> migrationShards = migrationCluster.getMigrationShards();
    for (final MigrationShard migrationShard : migrationShards) {
        migrationShard.retry(ShardMigrationStep.CHECK);
        executors.execute(new AbstractExceptionLogTask() {

            @Override
            public void doRun() {
                migrationShard.doCheck();
            }
        });
    }
}
Also used : MigrationShard(com.ctrip.xpipe.redis.console.migration.model.MigrationShard) AbstractExceptionLogTask(com.ctrip.xpipe.concurrent.AbstractExceptionLogTask)

Example 7 with MigrationShard

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

the class MigrationForcePublishState method doAction.

@Override
public void doAction() {
    CountDownLatch latch = new CountDownLatch(getHolder().getMigrationShards().size());
    for (MigrationShard migrationShard : getHolder().getMigrationShards()) {
        executors.execute(new AbstractExceptionLogTask() {

            @Override
            public void doRun() {
                try {
                    logger.info("[doOtherDcMigrate][start]{},{}", getHolder().clusterName(), migrationShard.getCurrentShard().getShardName());
                    migrationShard.doMigrateOtherDc();
                    logger.info("[doOtherDcMigrate][done]{},{}", getHolder().clusterName(), migrationShard.getCurrentShard().getShardName());
                } finally {
                    latch.countDown();
                }
            }
        });
    }
    try {
        latch.await();
        updateAndProcess(nextAfterSuccess());
    } catch (InterruptedException e) {
        logger.error("[MigrationForcePublishState][tryAction][Interrupted][will retry]", e);
        updateAndProcess(nextAfterFail());
    }
}
Also used : MigrationShard(com.ctrip.xpipe.redis.console.migration.model.MigrationShard) AbstractExceptionLogTask(com.ctrip.xpipe.concurrent.AbstractExceptionLogTask) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

MigrationShard (com.ctrip.xpipe.redis.console.migration.model.MigrationShard)7 AbstractExceptionLogTask (com.ctrip.xpipe.concurrent.AbstractExceptionLogTask)5 CountDownLatch (java.util.concurrent.CountDownLatch)2 HostPort (com.ctrip.xpipe.endpoint.HostPort)1 MigrationCluster (com.ctrip.xpipe.redis.console.migration.model.MigrationCluster)1 ShardMigrationResult (com.ctrip.xpipe.redis.console.migration.model.ShardMigrationResult)1 InetSocketAddress (java.net.InetSocketAddress)1 LinkedList (java.util.LinkedList)1