use of com.ctrip.xpipe.redis.console.model.MigrationShardTbl in project x-pipe by ctripcorp.
the class MigrationShardDao method updateMigrationShard.
public void updateMigrationShard(MigrationShardTbl migrationShard) {
MigrationShardTbl proto = migrationShardDao.createLocal();
proto.setId(migrationShard.getId()).setMigrationClusterId(migrationShard.getMigrationClusterId()).setShardId(migrationShard.getShardId()).setLog(migrationShard.getLog());
final MigrationShardTbl forUpdate = proto;
queryHandler.handleUpdate(new DalQuery<Integer>() {
@Override
public Integer doQuery() throws DalException {
migrationShardDao.updateByPK(forUpdate, MigrationShardTblEntity.UPDATESET_FULL);
return null;
}
});
}
use of com.ctrip.xpipe.redis.console.model.MigrationShardTbl in project x-pipe by ctripcorp.
the class DefaultMigrationShard method update.
@Override
public void update(Object args, Observable observable) {
logger.debug("[update][begin]{}", this);
long begin = System.currentTimeMillis();
MigrationShardTbl toUpdate = getMigrationShard();
String log = getShardMigrationResult().encode();
migrationService.updateMigrationShardLogById(toUpdate.getId(), log);
logger.debug("[debug][end]{}", this);
long end = System.currentTimeMillis();
if ((end - begin) > 3) {
logger.debug("[update][time long]{}, {}", end - begin, this);
}
}
use of com.ctrip.xpipe.redis.console.model.MigrationShardTbl in project x-pipe by ctripcorp.
the class MigrationServiceTest method createTest.
@Test
@DirtiesContext
public void createTest() throws ComponentLookupException {
long eventId = migrationService.createMigrationEvent(createEventDemo(1, 2));
MigrationEventTbl result = migrationService.find(eventId);
MigrationClusterTbl result_cluster = migrationService.findMigrationCluster(eventId, 1);
ClusterTbl cluster = clusterService.find(1);
List<MigrationShardTbl> result_shards = migrationService.findMigrationShards(result_cluster.getId());
Assert.assertEquals(eventId, result.getId());
Assert.assertEquals("unit test", result.getOperator());
Assert.assertNotNull(result_cluster);
Assert.assertEquals(1, result_cluster.getClusterId());
Assert.assertEquals(2, result_cluster.getDestinationDcId());
Assert.assertEquals(MigrationStatus.Initiated.toString(), result_cluster.getStatus());
Assert.assertEquals(ClusterStatus.Lock.toString(), cluster.getStatus());
Assert.assertEquals(2, result_shards.size());
}
Aggregations