Examples of ZKPeer


Examples of com.linkedin.d2.quorum.ZKPeer

  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);
  }
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  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);
  }
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  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);
  }
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  public void testD2ConfigWithZKQuorumV3DegraderCustomPartitionLeaderPeerDown() throws Exception
  {
    setup();
    String connectionString = _quorum.getHosts();
    ZKPeer leader = _quorum.getQuorumLeader();
    leader.shutdownPeer();
    assertEquals(LoadBalancerClientCli.runDiscovery(connectionString, "/d2", D2_CONFIG_DEFAULT_PARTITION_DATA), 0);
  }
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  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
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  public void testD2WithQuorumFollowerPeerDown() throws Exception
  {
    setup();
    // Shutdown zk _quorum follower peer (non-leader member of a zk _quorum)
    ZKPeer follower = _quorum.getQuorumFollower();
    follower.shutdownPeer();
    // Assert requests are processed while follower goes down
    long start = System.currentTimeMillis();
    while (follower.getZKServer() != null && System.currentTimeMillis() < start + TIMEOUT)
    {
      assertQuorumProcessAllRequests(D2_CONFIG_DATA);
    }
    assertFalse(follower.isRunning(), "_quorum Peer #"+follower.getId()+"/port "+follower.getClientPort()+" server has not shut down.");
    // Restart peer
    _quorum.restart(follower.getId());
    // Assert requests processed while follower is restarting
    start = System.currentTimeMillis();
    while ((_quorum.getPeerZKServer(follower.getId()) == null || ! _quorum.getPeerZKServer(follower.getId()).isRunning()) && System.currentTimeMillis() < start + TIMEOUT)
    {
      assertQuorumProcessAllRequests(D2_CONFIG_DATA);
    }
    // Assert requests are processed after peer restart
    assertQuorumProcessAllRequests(D2_CONFIG_DATA);
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  public void testD2WithQuorumFollowerServerKilled() throws Exception
  {
    setup();
    // Kill quorum peer follower zk server
    ZKPeer follower = _quorum.getQuorumFollower();
    // Simulate zk server crash
    follower.killPeerZkServer();
    assertQuorumProcessAllRequests(D2_CONFIG_DATA);
    assertFalse(follower.getZKServer().isRunning(), "quorum Peer #"+follower.getId()+"/port "+follower.getClientPort()+" server has not shut down.");
    assertQuorumProcessAllRequests(D2_CONFIG_DATA);
  }
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  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
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  public void testD2WithQuorumLeaderPeerDown() throws Exception
  {
    setup();
    assertQuorumProcessAllRequests(D2_CONFIG_DATA);
    // Shutdown zk _quorum leader peer
    ZKPeer peer = _quorum.getQuorumLeader();
    if (peer != null)
    {
      int peerId = peer.getId();
      peer.shutdownPeer();
      // Verify requests are processed while leader goes down
      long start = System.currentTimeMillis();
      while (_quorum.getQuorumLeader() != null && _quorum.getQuorumLeader().equals(peer) && System.currentTimeMillis() < (start + TIMEOUT))
      {
        assertQuorumProcessAllRequests(D2_CONFIG_DATA);
      }
      start = System.currentTimeMillis();
      while (_quorum.getQuorumLeader() == null && System.currentTimeMillis() < (start + TIMEOUT))
      {
        assertQuorumProcessAllRequests(D2_CONFIG_DATA); // wait while zookeeper is establishing a new leader
      }
      if (_quorum.getQuorumLeader() == null)
      {
        _quorum.restartAll();
      }
      else
      {
         assertTrue(! _quorum.getQuorumLeader().equals(peer), "No new _quorum leader was established. New leader id=" + _quorum.getQuorumLeader().getId());
        // Restart leader peer
        _quorum.restart(peerId);
      }
      start = System.currentTimeMillis();
      peer = _quorum.get(peerId);
      // Verify requests are processed while peer is restarting
      while (System.currentTimeMillis() < (start + TIMEOUT) && ( peer.getZKServer() == null || ! _quorum.areAllPeersUp() || ! peer.getZKServer().isRunning()))
      {
        assertQuorumProcessAllRequests(D2_CONFIG_DATA);
      }
      // After restart
      assertQuorumProcessAllRequests(D2_CONFIG_DATA);
View Full Code Here

Examples of com.linkedin.d2.quorum.ZKPeer

  public void testD2WithQuorumLeaderServerKilled() throws Exception
  {
    setup();
    // Kill _quorum leader peer zk server
    ZKPeer peer = _quorum.getQuorumLeader();
    if (peer != null)
    {
      peer.killPeerZkServer();
      assertQuorumProcessAllRequests(D2_CONFIG_DATA);
      assertFalse(peer.getZKServer().isRunning(),"_quorum Peer #"+peer.getId()+"/port "+peer.getClientPort()+" server has not shut down.");
      // Restart peer 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
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.