use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.
the class AbstractUnsafeRaftOp method call.
@Override
public final CallStatus call() throws Exception {
RaftService service = getService();
if (service.isCpSubsystemEnabled()) {
throw new IllegalStateException("CP subsystem is enabled on this member, " + "but received an UNSAFE operation! This could be due to a misconfiguration on the caller side. " + "CP subsystem configuration must be the same on all members.");
}
NodeEngine nodeEngine = getNodeEngine();
if (op instanceof CallerAware) {
((CallerAware) op).setCaller(getCallerAddress(), getCallId());
}
long commitIndex = service.nextUnsafeModeCommitIndex(groupId);
response = op.setNodeEngine(nodeEngine).run(groupId, commitIndex);
return handleResponse(commitIndex, response);
}
use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.
the class UnsafeStateReplicationOp method run.
@Override
public void run() throws Exception {
RaftService service = getService();
service.applyUnsafeModeState(getPartitionId(), state);
}
use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.
the class RaftServicePreJoinOp method run.
@Override
public void run() {
RaftService service = getService();
MetadataRaftGroupManager metadataGroupManager = service.getMetadataGroupManager();
metadataGroupManager.handleMetadataGroupId(metadataGroupId);
if (discoveryCompleted) {
metadataGroupManager.disableDiscovery();
}
}
use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.
the class CreateRaftNodeOp method run.
@Override
public void run() {
RaftService service = getService();
service.createRaftNode(groupId, initialMembers);
}
use of com.hazelcast.cp.internal.RaftService in project hazelcast by hazelcast.
the class AbstractFencedLockFailureTest method testRetriedTryLockWithTimeoutDoesNotCancelPendingLockRequest.
@Test(timeout = 300_000)
public void testRetriedTryLockWithTimeoutDoesNotCancelPendingLockRequest() {
lockByOtherThread();
// there is a session id now
RaftGroupId groupId = lock.getGroupId();
long sessionId = getSessionManager().getSession(groupId);
RaftInvocationManager invocationManager = getRaftInvocationManager();
UUID invUid = newUnsecureUUID();
invocationManager.invoke(groupId, new TryLockOp(objectName, sessionId, getThreadId(), invUid, MINUTES.toMillis(5)));
NodeEngineImpl nodeEngine = getNodeEngineImpl(primaryInstance);
LockService service = nodeEngine.getService(LockService.SERVICE_NAME);
assertTrueEventually(() -> {
LockRegistry registry = service.getRegistryOrNull(groupId);
assertNotNull(registry);
assertNotNull(registry.getResourceOrNull(objectName));
assertEquals(1, registry.getWaitTimeouts().size());
});
invocationManager.invoke(groupId, new TryLockOp(objectName, sessionId, getThreadId(), invUid, MINUTES.toMillis(5)));
assertTrueEventually(() -> {
RaftService raftService = getNodeEngineImpl(primaryInstance).getService(RaftService.SERVICE_NAME);
int partitionId = raftService.getCPGroupPartitionId(groupId);
LockRegistry registry = service.getRegistryOrNull(groupId);
boolean[] verified = new boolean[1];
CountDownLatch latch = new CountDownLatch(1);
OperationServiceImpl operationService = nodeEngine.getOperationService();
operationService.execute(new PartitionSpecificRunnable() {
@Override
public int getPartitionId() {
return partitionId;
}
@Override
public void run() {
Lock lock = registry.getResourceOrNull(objectName);
Map<Object, WaitKeyContainer<LockInvocationKey>> waitKeys = lock.getInternalWaitKeysMap();
verified[0] = (waitKeys.size() == 1 && waitKeys.values().iterator().next().retryCount() == 1);
latch.countDown();
}
});
latch.await(60, SECONDS);
assertTrue(verified[0]);
});
}
Aggregations