Search in sources :

Example 1 with ZKPeer

use of com.linkedin.d2.quorum.ZKPeer in project rest.li by linkedin.

the class TestD2ConfigWithZKQuorum method testD2ConfigWithZKQuorumV3DegraderDefaultPartitionFollowerPeerDown.

public void testD2ConfigWithZKQuorumV3DegraderDefaultPartitionFollowerPeerDown() throws Exception {
    setup();
    String connectionString = _quorum.getHosts();
    ZKPeer follower = _quorum.getQuorumFollower();
    follower.shutdownPeer();
    assertEquals(LoadBalancerClientCli.runDiscovery(connectionString, "/d2", D2_CONFIG_DEFAULT_PARTITION_DATA), 0);
}
Also used : ZKPeer(com.linkedin.d2.quorum.ZKPeer)

Example 2 with ZKPeer

use of com.linkedin.d2.quorum.ZKPeer in project rest.li by linkedin.

the class TestD2ConfigWithZKQuorum method testD2ConfigWithZKQuorumV3DegraderDefaultPartitionLeaderPeerDown.

public void testD2ConfigWithZKQuorumV3DegraderDefaultPartitionLeaderPeerDown() throws Exception {
    setup();
    String connectionString = _quorum.getHosts();
    ZKPeer leader = _quorum.getQuorumLeader();
    leader.shutdownPeer();
    assertEquals(LoadBalancerClientCli.runDiscovery(connectionString, "/d2", D2_CONFIG_DEFAULT_PARTITION_DATA), 0);
}
Also used : ZKPeer(com.linkedin.d2.quorum.ZKPeer)

Example 3 with ZKPeer

use of com.linkedin.d2.quorum.ZKPeer in project rest.li by linkedin.

the class TestD2ConfigWithZKQuorum method testD2ConfigWithZKQuorumV3DegraderCustomPartitionFollowerPeerDown.

public void testD2ConfigWithZKQuorumV3DegraderCustomPartitionFollowerPeerDown() throws Exception {
    setup();
    String connectionString = _quorum.getHosts();
    ZKPeer follower = _quorum.getQuorumFollower();
    follower.shutdownPeer();
    assertEquals(LoadBalancerClientCli.runDiscovery(connectionString, "/d2", D2_CONFIG_DEFAULT_PARTITION_DATA), 0);
}
Also used : ZKPeer(com.linkedin.d2.quorum.ZKPeer)

Example 4 with ZKPeer

use of com.linkedin.d2.quorum.ZKPeer in project rest.li by linkedin.

the class TestD2ZKQuorumFailover method testD2WithQuorumLeaderPeerServerDown.

// D2 With _quorum Leader Peer shutdown, restart
public void testD2WithQuorumLeaderPeerServerDown() throws Exception {
    setup();
    // Shutdown quorum leader zk server
    ZKPeer peer = _quorum.getQuorumLeader();
    if (peer != null) {
        peer.shutdownPeerZkServer();
        assertFalse(peer.getZKServer().isRunning(), "_quorum Peer #" + peer.getId() + "/port " + peer.getClientPort() + " server has not shut down.");
        assertQuorumProcessAllRequests(D2_CONFIG_DATA);
        // Restart leader zk server
        peer.startupPeerZkServer();
        // Assert requests are processed while peer is restarting
        long start = System.currentTimeMillis();
        while (peer.getZKServer() == null && System.currentTimeMillis() < start + TIMEOUT) {
            assertQuorumProcessAllRequests(D2_CONFIG_DATA);
        }
        _quorum.assertAllPeersUp();
        // After restart
        assertQuorumProcessAllRequests(D2_CONFIG_DATA);
    } else {
        fail("Quorum is unable to identify zk leader. No tests were executed.");
    }
}
Also used : ZKPeer(com.linkedin.d2.quorum.ZKPeer)

Example 5 with ZKPeer

use of com.linkedin.d2.quorum.ZKPeer in project rest.li by linkedin.

the class TestD2ZKQuorumFailover method testD2WithQuorumFollowerPeerServerDown.

//D2 With _quorum Follower Peer shutdown, restart
public void testD2WithQuorumFollowerPeerServerDown() throws Exception {
    setup();
    // Shutdown zk quorum follower server (non-leader member of zk _quorum)
    ZKPeer follower = _quorum.getQuorumFollower();
    follower.shutdownPeerZkServer();
    assertFalse(follower.getZKServer().isRunning(), "Quorum Peer #" + follower.getId() + "/port " + follower.getClientPort() + " server has not shut down.");
    assertQuorumProcessAllRequests(D2_CONFIG_DATA);
    // Restart follower zk server
    follower.startupPeerZkServer();
    // Assert requests are processed while follower is restarting
    long start = System.currentTimeMillis();
    while (follower.getZKServer() == null && System.currentTimeMillis() < start + TIMEOUT) {
        assertQuorumProcessAllRequests(D2_CONFIG_DATA);
    }
    _quorum.assertAllPeersUp();
    // Assert requests are processed after follower restarted
    assertQuorumProcessAllRequests(D2_CONFIG_DATA);
}
Also used : ZKPeer(com.linkedin.d2.quorum.ZKPeer)

Aggregations

ZKPeer (com.linkedin.d2.quorum.ZKPeer)10