Search in sources :

Example 1 with SimplePsyncObserver

use of com.ctrip.xpipe.redis.core.utils.SimplePsyncObserver in project x-pipe by ctripcorp.

the class FakeRedisHalfRdbServerFail method redisFailKeeperRestartDumpNewRdb.

@Test
public void redisFailKeeperRestartDumpNewRdb() throws Exception {
    sleep(sleepBeforeSendFullSyncInfo + 1000);
    redisKeeperServer.stop();
    redisKeeperServer.dispose();
    redisKeeperServer.initialize();
    redisKeeperServer.start();
    connectToFakeRedis(redisKeeperServer);
    waitConditionUntilTimeOut(() -> {
        return redisKeeperServer.getRedisMaster().getMasterState() == MASTER_STATE.REDIS_REPL_CONNECTED;
    });
    SimplePsyncObserver simplePsyncObserver = new SimplePsyncObserver();
    InMemoryPsync inMemoryPsync = sendInmemoryPsync("localhost", redisKeeperServer.getListeningPort(), simplePsyncObserver);
    // wait
    simplePsyncObserver.getOnline().get(5000, TimeUnit.MILLISECONDS);
    // wait for commands
    sleep(1000);
    assertPsyncResultEquals(inMemoryPsync);
    Assert.assertEquals(1, redisKeeperServer.getKeeperMonitor().getReplicationStoreStats().getReplicationStoreCreateCount());
}
Also used : SimplePsyncObserver(com.ctrip.xpipe.redis.core.utils.SimplePsyncObserver) InMemoryPsync(com.ctrip.xpipe.redis.core.protocal.cmd.InMemoryPsync) AbstractFakeRedisTest(com.ctrip.xpipe.redis.keeper.AbstractFakeRedisTest) Test(org.junit.Test)

Aggregations

InMemoryPsync (com.ctrip.xpipe.redis.core.protocal.cmd.InMemoryPsync)1 SimplePsyncObserver (com.ctrip.xpipe.redis.core.utils.SimplePsyncObserver)1 AbstractFakeRedisTest (com.ctrip.xpipe.redis.keeper.AbstractFakeRedisTest)1 Test (org.junit.Test)1