Search in sources :

Example 6 with DefaultRaftReplicateOp

use of com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp in project hazelcast by hazelcast.

the class RaftInvocationFailureTest method test_invocationFailsWithFirstMemberLeftException_when_thereAreIndeterminateOperationStateExceptionsAfterwards.

@Test
public void test_invocationFailsWithFirstMemberLeftException_when_thereAreIndeterminateOperationStateExceptionsAfterwards() throws ExecutionException, InterruptedException {
    CPGroupId groupId = getRaftInvocationManager(instances[0]).createRaftGroup(groupName).get();
    waitAllForLeaderElection(instances, groupId);
    HazelcastInstance leader = getLeaderInstance(instances, groupId);
    Future f = new RaftInvocation(getOperationService(leader).invocationContext, getRaftInvocationManager(leader).getRaftInvocationContext(), groupId, new DefaultRaftReplicateOp(groupId, new CustomResponseOp4()), 10, 50, 60000).invoke();
    try {
        f.get(60, TimeUnit.SECONDS);
        fail();
    } catch (Exception e) {
        assertInstanceOf(IndeterminateOperationStateException.class, e.getCause());
    }
    assertTrue(COMMIT_COUNT.get() > groupSize);
}
Also used : CPGroupId(com.hazelcast.cp.CPGroupId) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Future(java.util.concurrent.Future) IndeterminateOperationStateException(com.hazelcast.core.IndeterminateOperationStateException) DefaultRaftReplicateOp(com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp) StaleAppendRequestException(com.hazelcast.cp.exception.StaleAppendRequestException) CallerNotMemberException(com.hazelcast.spi.exception.CallerNotMemberException) IndeterminateOperationStateException(com.hazelcast.core.IndeterminateOperationStateException) MemberLeftException(com.hazelcast.core.MemberLeftException) ExecutionException(java.util.concurrent.ExecutionException) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

DefaultRaftReplicateOp (com.hazelcast.cp.internal.operation.DefaultRaftReplicateOp)6 HazelcastInstance (com.hazelcast.core.HazelcastInstance)5 IndeterminateOperationStateException (com.hazelcast.core.IndeterminateOperationStateException)5 MemberLeftException (com.hazelcast.core.MemberLeftException)5 CPGroupId (com.hazelcast.cp.CPGroupId)5 StaleAppendRequestException (com.hazelcast.cp.exception.StaleAppendRequestException)5 CallerNotMemberException (com.hazelcast.spi.exception.CallerNotMemberException)5 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)5 QuickTest (com.hazelcast.test.annotation.QuickTest)5 ExecutionException (java.util.concurrent.ExecutionException)5 Future (java.util.concurrent.Future)5 Test (org.junit.Test)5 UnsafeRaftReplicateOp (com.hazelcast.cp.internal.operation.unsafe.UnsafeRaftReplicateOp)1 Operation (com.hazelcast.spi.impl.operationservice.Operation)1 Invocation (com.hazelcast.spi.impl.operationservice.impl.Invocation)1 RaftInvocation (com.hazelcast.spi.impl.operationservice.impl.RaftInvocation)1