use of com.hazelcast.cp.internal.raft.impl.testing.NopEntry in project hazelcast by hazelcast.
the class LeadershipTransferTest method testDuplicateTransferLeadershipRequestsHandled.
@Test
public void testDuplicateTransferLeadershipRequestsHandled() throws Exception {
group = newGroup(3);
group.start();
RaftNodeImpl leader = group.waitUntilLeaderElected();
RaftNodeImpl follower = group.getNodesExcept(leader.getLocalMember())[0];
group.dropMessagesToMember(leader.getLocalMember(), follower.getLocalMember(), AppendRequest.class);
leader.replicate(new NopEntry()).get();
Future f1 = leader.transferLeadership(follower.getLocalMember());
Future f2 = leader.transferLeadership(follower.getLocalMember());
group.allowAllMessagesToMember(leader.getLocalMember(), follower.getLocalMember());
f1.get();
f2.get();
}
use of com.hazelcast.cp.internal.raft.impl.testing.NopEntry in project hazelcast by hazelcast.
the class LeadershipTransferTest method testInflightOperationsCommittedByCurrentLeaderBeforeLeadershipTransfer.
@Test
public void testInflightOperationsCommittedByCurrentLeaderBeforeLeadershipTransfer() throws Exception {
group = newGroup(3);
group.start();
RaftNodeImpl leader = group.waitUntilLeaderElected();
RaftNodeImpl[] followers = group.getNodesExcept(leader.getLocalMember());
group.dropMessagesToMember(leader.getLocalMember(), followers[0].getLocalMember(), AppendRequest.class);
group.dropMessagesToMember(leader.getLocalMember(), followers[1].getLocalMember(), AppendRequest.class);
Future f1 = leader.replicate(new NopEntry());
Future f2 = leader.transferLeadership(followers[0].getLocalMember());
group.allowAllMessagesToMember(leader.getLocalMember(), followers[0].getLocalMember());
group.allowAllMessagesToMember(leader.getLocalMember(), followers[1].getLocalMember());
f2.get();
RaftNodeImpl newLeader = group.waitUntilLeaderElected();
assertNotSame(leader, newLeader);
f1.get();
}
use of com.hazelcast.cp.internal.raft.impl.testing.NopEntry in project hazelcast by hazelcast.
the class LeadershipTransferTest method testTransferLeadershipTimesOutWhenTargetCannotCatchupInTime.
@Test
public void testTransferLeadershipTimesOutWhenTargetCannotCatchupInTime() throws Exception {
group = newGroup(3);
group.start();
RaftNodeImpl leader = group.waitUntilLeaderElected();
RaftNodeImpl follower = group.getNodesExcept(leader.getLocalMember())[0];
group.dropMessagesToMember(leader.getLocalMember(), follower.getLocalMember(), AppendRequest.class);
leader.replicate(new NopEntry()).get();
InternalCompletableFuture f = leader.transferLeadership(follower.getLocalMember());
exceptionRule.expect(IllegalStateException.class);
f.joinInternal();
}
use of com.hazelcast.cp.internal.raft.impl.testing.NopEntry in project hazelcast by hazelcast.
the class LeadershipTransferTest method testAnotherTransferLeadershipRequestFailsDuringOngoingLeadershipTransfer.
@Test
public void testAnotherTransferLeadershipRequestFailsDuringOngoingLeadershipTransfer() throws Exception {
group = newGroup(3);
group.start();
RaftNodeImpl leader = group.waitUntilLeaderElected();
RaftNodeImpl[] followers = group.getNodesExcept(leader.getLocalMember());
RaftNodeImpl follower1 = followers[0];
RaftNodeImpl follower2 = followers[1];
group.dropMessagesToMember(leader.getLocalMember(), follower1.getLocalMember(), AppendRequest.class);
leader.replicate(new NopEntry()).get();
leader.transferLeadership(follower1.getLocalMember());
InternalCompletableFuture f = leader.transferLeadership(follower2.getLocalMember());
exceptionRule.expect(IllegalStateException.class);
f.joinInternal();
}
Aggregations