use of com.ctrip.xpipe.redis.keeper.store.DefaultReplicationStore in project x-pipe by ctripcorp.
the class FakeRedisExceptionTest method testRdbFileError.
@Test
public void testRdbFileError() throws Exception {
RedisKeeperServer redisKeeperServer = startRedisKeeperServerAndConnectToFakeRedis();
countDownLatch.await(10, TimeUnit.SECONDS);
RdbStore rdbStore = ((DefaultReplicationStore) redisKeeperServer.getReplicationStore()).getRdbStore();
Assert.assertFalse(rdbStore.checkOk());
}
use of com.ctrip.xpipe.redis.keeper.store.DefaultReplicationStore in project x-pipe by ctripcorp.
the class DefaultRedisKeeperServerConnectToFakeRedisTest method startKeeperServerAndTestReFullSync.
private void startKeeperServerAndTestReFullSync(int fileToKeep, int maxTransferCommnadsSize) throws Exception {
RedisKeeperServer redisKeeperServer = startRedisKeeperServerAndConnectToFakeRedis(fileToKeep, maxTransferCommnadsSize, 1000);
int keeperPort = redisKeeperServer.getListeningPort();
sleep(2000);
logger.info(remarkableMessage("send psync to redump rdb"));
int rdbDumpCount1 = ((DefaultReplicationStore) redisKeeperServer.getReplicationStore()).getRdbUpdateCount();
InMemoryPsync psync = sendInmemoryPsync("localhost", keeperPort);
sleep(3000);
int rdbDumpCount2 = ((DefaultReplicationStore) redisKeeperServer.getReplicationStore()).getRdbUpdateCount();
Assert.assertEquals(rdbDumpCount1 + 1, rdbDumpCount2);
assertPsyncResultEquals(psync);
}
use of com.ctrip.xpipe.redis.keeper.store.DefaultReplicationStore in project x-pipe by ctripcorp.
the class KeeperSingleDc method testReFullSync.
@Test
public void testReFullSync() throws ExecuteException, IOException {
RedisKeeperServer redisKeeperServer = getRedisKeeperServerActive(dc);
DefaultReplicationStore replicationStore = (DefaultReplicationStore) redisKeeperServer.getReplicationStore();
DcMeta dcMeta = getDcMeta();
RedisMeta slave1 = createSlave(activeKeeper.getIp(), activeKeeper.getPort());
int lastRdbUpdateCount = replicationStore.getRdbUpdateCount();
logger.info(remarkableMessage("[testReFullSync][sendRandomMessage]"));
sendRandomMessage(redisMaster, 1, replicationStoreCommandFileSize);
for (int i = 0; i < 3; i++) {
logger.info(remarkableMessage("[testReFullSync]{}"), i);
startRedis(slave1);
sleep(3000);
int currentRdbUpdateCount = replicationStore.getRdbUpdateCount();
logger.info("[testReFullSync]{},{}", lastRdbUpdateCount, currentRdbUpdateCount);
Assert.assertEquals(lastRdbUpdateCount + 1, currentRdbUpdateCount);
lastRdbUpdateCount = currentRdbUpdateCount;
sendMesssageToMasterAndTest(100, getRedisMaster(), Lists.newArrayList(slave1));
}
}
use of com.ctrip.xpipe.redis.keeper.store.DefaultReplicationStore in project x-pipe by ctripcorp.
the class FakeRedisExceptionTest method writeToRdb.
private void writeToRdb(ReplicationStore currentReplicationStore) throws IOException {
logger.info("[writeToRdb][write error byte]");
DefaultReplicationStore replicationStore = (DefaultReplicationStore) currentReplicationStore;
replicationStore.getRdbStore().writeRdb(Unpooled.wrappedBuffer("1".getBytes()));
}
Aggregations