Search in sources :

Example 11 with MasterInfo

use of com.ctrip.xpipe.redis.core.protocal.pojo.MasterInfo in project x-pipe by ctripcorp.

the class DefaultOffsetwaiterTest method testWaitforSlaveDifferentReplid.

@Test
public void testWaitforSlaveDifferentReplid() throws Exception {
    MasterInfo masterInfo = new MasterInfo(RunidGenerator.DEFAULT.generateRunid(), 1L);
    startServer(port, toRedisProtocalString("# Replication\r\n" + "role:slave\r\n" + "master_host:127.0.0.1\r\n" + "master_port:6379\r\n" + "master_link_status:up\r\n" + "master_last_io_seconds_ago:8\r\n" + "master_sync_in_progress:0\r\n" + "slave_repl_offset:13202\r\n" + "slave_priority:100\r\n" + "slave_read_only:1\r\n" + "connected_slaves:0\r\n" + "master_replid:ebe8dc36b4a9901af79ac117fa55d45e3dbb92a1\r\n" + "master_replid2:0000000000000000000000000000000000000000\r\n" + "master_repl_offset:13202\r\n" + "second_repl_offset:-1\r\n" + "repl_backlog_active:1\r\n" + "repl_backlog_size:1048576\r\n" + "repl_backlog_first_byte_offset:1\r\n" + "repl_backlog_histlen:13202"));
    Assert.assertFalse(offsetwaiter.tryWaitfor(new HostPort(host, port), masterInfo, executionLog));
}
Also used : MasterInfo(com.ctrip.xpipe.redis.core.protocal.pojo.MasterInfo) HostPort(com.ctrip.xpipe.endpoint.HostPort) Test(org.junit.Test) AbstractMetaServerTest(com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)

Example 12 with MasterInfo

use of com.ctrip.xpipe.redis.core.protocal.pojo.MasterInfo in project x-pipe by ctripcorp.

the class BecomeBackupActionTest method test.

@Test
public void test() throws Exception {
    BecomeBackupAction becomeBackupAction = new BecomeBackupAction(dcMetaCache, currentMetaManager, sentinelManager, new ExecutionLog(currentTestName()), getXpipeNettyClientKeyedObjectPool(), multiDcService, scheduled, executors);
    PrimaryDcChangeMessage message = becomeBackupAction.changePrimaryDc(getClusterId(), getShardId(), newPrimaryDc, new MasterInfo());
    logger.info("{}", message);
}
Also used : MasterInfo(com.ctrip.xpipe.redis.core.protocal.pojo.MasterInfo) ExecutionLog(com.ctrip.xpipe.redis.meta.server.dcchange.ExecutionLog) BecomeBackupAction(com.ctrip.xpipe.redis.meta.server.dcchange.impl.BecomeBackupAction) PrimaryDcChangeMessage(com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService.PrimaryDcChangeMessage) Test(org.junit.Test) AbstractMetaServerTest(com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)

Aggregations

MasterInfo (com.ctrip.xpipe.redis.core.protocal.pojo.MasterInfo)12 Test (org.junit.Test)9 AbstractMetaServerTest (com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)7 HostPort (com.ctrip.xpipe.endpoint.HostPort)6 PrimaryDcChangeMessage (com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService.PrimaryDcChangeMessage)4 ExecutionLog (com.ctrip.xpipe.redis.meta.server.dcchange.ExecutionLog)4 MetaServerConsoleService (com.ctrip.xpipe.redis.core.metaserver.MetaServerConsoleService)2 RedisInfo (com.ctrip.xpipe.redis.core.protocal.pojo.RedisInfo)2 BecomeBackupAction (com.ctrip.xpipe.redis.meta.server.dcchange.impl.BecomeBackupAction)2 BecomePrimaryAction (com.ctrip.xpipe.redis.meta.server.dcchange.impl.BecomePrimaryAction)2 RedisMeta (com.ctrip.xpipe.redis.core.entity.RedisMeta)1 DefaultMetaServerConsoleService (com.ctrip.xpipe.redis.core.metaserver.impl.DefaultMetaServerConsoleService)1 InfoReplicationComplementCommand (com.ctrip.xpipe.redis.core.protocal.cmd.InfoReplicationComplementCommand)1 SlaveInfo (com.ctrip.xpipe.redis.core.protocal.pojo.SlaveInfo)1 TestMetaServer (com.ctrip.xpipe.redis.meta.server.TestMetaServer)1 InetSocketAddress (java.net.InetSocketAddress)1