/** {@inheritDoc} */ @Override @Nullable public ChangeGlobalStateFinishMessage onNodeLeft(ClusterNode node) { if (globalState.transition()) { Set<UUID> nodes = globalState.transitionNodes(); if (nodes.remove(node.id()) && nodes.isEmpty()) { U.warn(log, "Failed to change cluster state, all participating nodes failed. " + "Switching to inactive state."); ChangeGlobalStateFinishMessage msg = new ChangeGlobalStateFinishMessage(globalState.transitionRequestId(), false, false); onStateFinishMessage(msg); return msg; } } return null; }
/** {@inheritDoc} */ @Override public void onStateFinishMessage(ChangeGlobalStateFinishMessage msg) { DiscoveryDataClusterState state = globalState; if (msg.requestId().equals(state.transitionRequestId())) { log.info("Received state change finish message: " + msg.clusterActive()); globalState = state.finish(msg.success()); afterStateChangeFinished(msg.id(), msg.success()); ctx.cache().onStateChangeFinish(msg); TransitionOnJoinWaitFuture joinFut = this.joinFut; if (joinFut != null) joinFut.onDone(false); GridFutureAdapter<Void> transitionFut = transitionFuts.remove(state.transitionRequestId()); if (transitionFut != null) { state.setTransitionResult(msg.requestId(), msg.clusterActive()); transitionFut.onDone(); } } else U.warn(log, "Received state finish message with unexpected ID: " + msg); }
/** {@inheritDoc} */ @Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) { if (data.commonData() instanceof DiscoveryDataClusterState) { if (globalState != null && globalState.baselineTopology() != null) //node with BaselineTopology is not allowed to join mixed cluster // (where some nodes don't support BaselineTopology) throw new IgniteException("Node with BaselineTopology cannot join" + " mixed cluster running in compatibility mode"); globalState = (DiscoveryDataClusterState) data.commonData(); compatibilityMode = true; return; } BaselineStateAndHistoryData stateDiscoData = (BaselineStateAndHistoryData)data.commonData(); if (stateDiscoData != null) { DiscoveryDataClusterState state = stateDiscoData.globalState; if (state.transition()) transitionFuts.put(state.transitionRequestId(), new GridFutureAdapter<Void>()); globalState = state; if (stateDiscoData.recentHistory != null) { for (BaselineTopologyHistoryItem item : stateDiscoData.recentHistory.history()) bltHist.bufferHistoryItemForStore(item); } } }
return new IgniteFinishedFutureImpl<>(transitionRes); else { GridFutureAdapter<Void> fut = transitionFuts.get(globalState.transitionRequestId()); if (fut != null) { if (asyncWaitForTransition) {
final GridChangeGlobalStateFuture stateFut = changeStateFuture(msg); GridFutureAdapter<Void> transitionFut = transitionFuts.get(state.transitionRequestId());
/** {@inheritDoc} */ @Override @Nullable public ChangeGlobalStateFinishMessage onNodeLeft(ClusterNode node) { if (globalState.transition()) { Set<UUID> nodes = globalState.transitionNodes(); if (nodes.remove(node.id()) && nodes.isEmpty()) { U.warn(log, "Failed to change cluster state, all participating nodes failed. " + "Switching to inactive state."); ChangeGlobalStateFinishMessage msg = new ChangeGlobalStateFinishMessage(globalState.transitionRequestId(), false, false); onStateFinishMessage(msg); return msg; } } return null; }
/** {@inheritDoc} */ @Override public void onStateFinishMessage(ChangeGlobalStateFinishMessage msg) { DiscoveryDataClusterState state = globalState; if (msg.requestId().equals(state.transitionRequestId())) { log.info("Received state change finish message: " + msg.clusterActive()); globalState = globalState.finish(msg.success()); afterStateChangeFinished(msg.id(), msg.success()); ctx.cache().onStateChangeFinish(msg); TransitionOnJoinWaitFuture joinFut = this.joinFut; if (joinFut != null) joinFut.onDone(false); GridFutureAdapter<Void> transitionFut = transitionFuts.remove(state.transitionRequestId()); if (transitionFut != null) { state.setTransitionResult(msg.requestId(), msg.clusterActive()); transitionFut.onDone(); } } else U.warn(log, "Received state finish message with unexpected ID: " + msg); }
/** {@inheritDoc} */ @Override public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data) { if (data.commonData() instanceof DiscoveryDataClusterState) { if (globalState != null && globalState.baselineTopology() != null) //node with BaselineTopology is not allowed to join mixed cluster // (where some nodes don't support BaselineTopology) throw new IgniteException("Node with BaselineTopology cannot join" + " mixed cluster running in compatibility mode"); globalState = (DiscoveryDataClusterState) data.commonData(); compatibilityMode = true; return; } BaselineStateAndHistoryData stateDiscoData = (BaselineStateAndHistoryData)data.commonData(); if (stateDiscoData != null) { DiscoveryDataClusterState state = stateDiscoData.globalState; if (state.transition()) transitionFuts.put(state.transitionRequestId(), new GridFutureAdapter<Void>()); globalState = state; if (stateDiscoData.recentHistory != null) { for (BaselineTopologyHistoryItem item : stateDiscoData.recentHistory.history()) bltHist.bufferHistoryItemForStore(item); } } }
else { if (waitForTransition) { GridFutureAdapter<Void> fut = transitionFuts.get(globalState.transitionRequestId());
final GridChangeGlobalStateFuture stateFut = changeStateFuture(msg); GridFutureAdapter<Void> transitionFut = transitionFuts.get(state.transitionRequestId());