@Override public ClusterState getClusterState() { return clusterStateManager.getState(); }
@Override public ClusterState getClusterState() { return clusterStateManager.getState(); }
private void notifyAfterStateChange(ClusterState oldState, ClusterState requestedState, boolean isTransient) { if (requestedState != null) { // on failure, the actual state is not equal to requestedState, that's why we pass getState() node.getNodeExtension().afterClusterStateChange(oldState, getState(), isTransient); } }
private void checkMigrationsAndPartitionStateVersion(ClusterStateChange stateChange, int partitionStateVersion) { final InternalPartitionService partitionService = node.getPartitionService(); final int thisPartitionStateVersion = partitionService.getPartitionStateVersion(); if (partitionService.hasOnGoingMigrationLocal()) { throw new IllegalStateException("Still have pending migration tasks, " + "cannot lock cluster state! New state: " + stateChange + ", current state: " + getState()); } else if (partitionStateVersion != thisPartitionStateVersion) { throw new IllegalStateException("Can not lock cluster state! Partition tables have different versions! " + "Expected version: " + partitionStateVersion + " Current version: " + thisPartitionStateVersion); } }
private void checkMigrationsAndPartitionStateVersion(ClusterStateChange stateChange, int partitionStateVersion) { final InternalPartitionService partitionService = node.getPartitionService(); final int thisPartitionStateVersion = partitionService.getPartitionStateVersion(); if (partitionService.hasOnGoingMigrationLocal()) { throw new IllegalStateException("Still have pending migration tasks, " + "cannot lock cluster state! New state: " + stateChange + ", current state: " + getState()); } else if (partitionStateVersion != thisPartitionStateVersion) { throw new IllegalStateException("Can not lock cluster state! Partition tables have different versions! " + "Expected version: " + partitionStateVersion + " Current version: " + thisPartitionStateVersion); } }
private void notifyAfterStateChange(ClusterState oldState, ClusterState requestedState, boolean isTransient) { if (requestedState != null) { // on failure, the actual state is not equal to requestedState, that's why we pass getState() node.getNodeExtension().afterClusterStateChange(oldState, getState(), isTransient); } }
void initialClusterState(ClusterState initialState, Version version) { clusterServiceLock.lock(); try { final ClusterState currentState = getState(); if (currentState != ClusterState.ACTIVE && currentState != initialState) { logger.warning("Initial state is already set! " + "Current state: " + currentState + ", Given state: " + initialState); return; } // no need to validate again logger.fine("Setting initial cluster state: " + initialState + " and version: " + version); validateNodeCompatibleWith(version); setClusterStateAndVersion(initialState, version, true); } finally { clusterServiceLock.unlock(); } }
void initialClusterState(ClusterState initialState, Version version) { clusterServiceLock.lock(); try { node.getNodeExtension().onInitialClusterState(initialState); final ClusterState currentState = getState(); if (currentState != ClusterState.ACTIVE && currentState != initialState) { logger.warning("Initial state is already set! " + "Current state: " + currentState + ", Given state: " + initialState); return; } // no need to validate again logger.fine("Setting initial cluster state: " + initialState + " and version: " + version); validateNodeCompatibleWith(version); setClusterStateAndVersion(initialState, version, true); } finally { clusterServiceLock.unlock(); } }
private boolean isCurrentStateEqualToRequestedOne(ClusterStateChange change) { if (change.isOfType(ClusterState.class)) { return getState() == change.getNewState(); } else if (change.isOfType(Version.class)) { return clusterVersion != null && clusterVersion.equals(change.getNewState()); } return false; }
private boolean isCurrentStateEqualToRequestedOne(ClusterStateChange change) { if (change.isOfType(ClusterState.class)) { return getState() == change.getNewState(); } else if (change.isOfType(Version.class)) { return clusterVersion != null && clusterVersion.equals(change.getNewState()); } return false; }
@Override public void run() throws Exception { ClusterServiceImpl service = getService(); ClusterStateManager clusterStateManager = service.getClusterStateManager(); ClusterState state = clusterStateManager.getState(); if (state == ClusterState.IN_TRANSITION) { getLogger().info("Extending cluster state lock. Initiator: " + initiator + ", lease-time: " + leaseTime); } else { getLogger().info("Locking cluster state. Initiator: " + initiator + ", lease-time: " + leaseTime); } clusterStateManager.lockClusterState(stateChange, initiator, txnId, leaseTime, memberListVersion, partitionStateVersion); }
@Override public void run() throws Exception { ClusterServiceImpl service = getService(); ClusterStateManager clusterStateManager = service.getClusterStateManager(); ClusterState state = clusterStateManager.getState(); if (state == ClusterState.IN_TRANSITION) { getLogger().info("Extending cluster state lock. Initiator: " + initiator + ", lease-time: " + leaseTime); } else { getLogger().info("Locking cluster state. Initiator: " + initiator + ", lease-time: " + leaseTime); } clusterStateManager.lockClusterState(stateChange, initiator, txnId, leaseTime, memberListVersion, partitionStateVersion); }
long startTime = clusterClock.getClusterStartTime(); Operation op = new FinalizeJoinOp(member.getUuid(), newMembersView, preJoinOp, postJoinOp, time, clusterService.getClusterId(), startTime, clusterStateManager.getState(), clusterService.getClusterVersion(), partitionRuntimeState); op.setCallerUuid(thisUuid);
return; ClusterState oldState = getState(); ClusterState requestedState = stateChange.getClusterStateOrNull(); NodeEngineImpl nodeEngine = node.getNodeEngine();
long startTime = clusterClock.getClusterStartTime(); Operation op = new FinalizeJoinOp(member.getUuid(), newMembersView, preJoinOp, postJoinOp, time, clusterService.getClusterId(), startTime, clusterStateManager.getState(), clusterService.getClusterVersion(), partitionRuntimeState); op.setCallerUuid(thisUuid);
return; ClusterState oldState = getState(); ClusterState requestedState = stateChange.getClusterStateOrNull(); NodeEngineImpl nodeEngine = node.getNodeEngine();
clusterService.getMembershipManager().getMembersView(), preJoinOp, postJoinOp, clusterClock.getClusterTime(), clusterService.getClusterId(), clusterClock.getClusterStartTime(), clusterStateManager.getState(), clusterService.getClusterVersion(), partitionRuntimeState); op.setCallerUuid(clusterService.getThisUuid());
clusterService.getMembershipManager().getMembersView(), preJoinOp, postJoinOp, clusterClock.getClusterTime(), clusterService.getClusterId(), clusterClock.getClusterStartTime(), clusterStateManager.getState(), clusterService.getClusterVersion(), partitionRuntimeState); op.setCallerUuid(clusterService.getThisUuid());
private boolean checkClusterStateBeforeJoin(Address target, String uuid) { ClusterState state = clusterStateManager.getState(); if (state == ClusterState.IN_TRANSITION) { logger.warning("Cluster state is in transition process. Join is not allowed until "
private boolean checkClusterStateBeforeJoin(Address target, String uuid) { ClusterState state = clusterStateManager.getState(); if (state == ClusterState.IN_TRANSITION) { logger.warning("Cluster state is in transition process. Join is not allowed until "