public class GridClusterStateProcessor extends GridProcessorAdapter implements IGridClusterStateProcessor, MetastorageLifecycleListener
GridComponent.DiscoveryDataExchangeType| Modifier and Type | Field and Description |
|---|---|
static String |
DATA_LOST_ON_DEACTIVATION_WARNING
Warning of unsafe cluster deactivation.
|
ctx, diagnosticLog, log| Constructor and Description |
|---|
GridClusterStateProcessor(GridKernalContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterStateChangeFinished(IgniteUuid msgId,
boolean success) |
ExchangeActions |
autoAdjustExchangeActions(ExchangeActions exchActs)
Add fake state change request into exchange actions if cluster is not persistent and baseline autoadjustment
is enabled with zero timeout.
|
boolean |
autoAdjustInMemoryClusterState(UUID nodeId,
Collection<ClusterNode> topSnapshot,
DiscoCache discoCache,
long topVer,
int minorTopVer)
Update baseline locally if cluster is not persistent and baseline autoadjustment is enabled with zero timeout.
|
void |
baselineAutoAdjustEnabled(boolean baselineAutoAdjustEnabled) |
IgniteFuture<?> |
baselineAutoAdjustEnabledAsync(boolean baselineAutoAdjustEnabled) |
BaselineAutoAdjustStatus |
baselineAutoAdjustStatus() |
long |
baselineAutoAdjustTimeout() |
void |
baselineAutoAdjustTimeout(long baselineAutoAdjustTimeout) |
IgniteFuture<?> |
baselineAutoAdjustTimeoutAsync(long baselineAutoAdjustTimeout) |
DistributedBaselineConfiguration |
baselineConfiguration() |
void |
cacheProcessorStarted() |
IgniteInternalFuture<?> |
changeGlobalState(ClusterState state,
boolean forceDeactivation,
Collection<? extends BaselineNode> baselineNodes,
boolean forceChangeBaselineTopology) |
IgniteInternalFuture<?> |
changeGlobalState(ClusterState state,
boolean forceDeactivation,
Collection<? extends BaselineNode> baselineNodes,
boolean forceChangeBaselineTopology,
boolean isAutoAdjust) |
DiscoveryDataClusterState |
clusterState() |
void |
collectGridNodeData(DiscoveryDataBag dataBag)
Collects discovery data on nodes already in grid on receiving
TcpDiscoveryNodeAddedMessage. |
void |
collectJoiningNodeData(DiscoveryDataBag dataBag)
Collects discovery data on joining node before sending
TcpDiscoveryJoinRequestMessage request. |
boolean |
compatibilityMode() |
protected IgniteCheckedException |
concurrentStateChangeError(ClusterState state,
ClusterState transitionState) |
@Nullable GridComponent.DiscoveryDataExchangeType |
discoveryDataType()
Gets unique component type to distinguish components providing discovery data.
|
boolean |
evictionsAllowed() |
protected boolean |
isApplicable(ChangeGlobalStateMessage msg,
DiscoveryDataClusterState state) |
boolean |
isBaselineAutoAdjustEnabled() |
protected static boolean |
isEquivalent(ChangeGlobalStateMessage msg,
DiscoveryDataClusterState state) |
long |
lastStateChangeTime() |
void |
onBaselineTopologyChanged(BaselineTopology blt,
BaselineTopologyHistoryItem prevBltHistItem) |
void |
onExchangeFinishedOnCoordinator(IgniteInternalFuture exchangeFuture,
boolean hasMovingPartitions) |
void |
onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
Receives discovery data object from remote nodes (called
on new node during discovery process).
|
void |
onKernalStart(boolean active)
Callback that notifies that kernal has successfully started,
including all managers and processors.
|
void |
onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.
|
@Nullable IgniteInternalFuture<Boolean> |
onLocalJoin(DiscoCache discoCache) |
@Nullable ChangeGlobalStateFinishMessage |
onNodeLeft(ClusterNode node) |
void |
onReadyForRead(ReadOnlyMetastorage metastorage)
Is called when metastorage is made ready for read-only operations very early on node startup phase.
|
void |
onReadyForReadWrite(ReadWriteMetastorage metastorage)
Fully functional metastore capable of performing reading and writing operations.
|
void |
onStateChangeError(Map<UUID,Exception> errs,
StateChangeRequest req) |
void |
onStateChangeExchangeDone(StateChangeRequest req) |
boolean |
onStateChangeMessage(AffinityTopologyVersion topVer,
ChangeGlobalStateMessage msg,
DiscoCache discoCache) |
void |
onStateFinishMessage(ChangeGlobalStateFinishMessage msg) |
DiscoveryDataClusterState |
pendingState(ChangeGlobalStateMessage stateMsg) |
boolean |
publicApiActiveState(boolean waitForTransition) |
IgniteFuture<Boolean> |
publicApiActiveStateAsync(boolean asyncWaitForTransition) |
ClusterState |
publicApiState(boolean waitForTransition) |
IgniteFuture<ClusterState> |
publicApiStateAsync(boolean asyncWaitForTransition) |
void |
resetBranchingHistory(long newBranchingHash)
Resets branching history on current BaselineTopology.
|
void |
start()
Starts grid component.
|
static ClusterState |
stateWithMinimalFeatures(ClusterState state1,
ClusterState state2)
Gets state of given two with minimal number of features.
|
void |
stop(boolean cancel)
Stops grid component.
|
String |
toString() |
@Nullable IgniteNodeValidationResult |
validateNode(ClusterNode node)
Validates that new node can join grid topology, this method is called on coordinator
node before new node joins topology.
|
@Nullable IgniteNodeValidationResult |
validateNode(ClusterNode node,
DiscoveryDataBag.JoiningNodeDiscoveryData discoData)
Validates that new node can join grid topology, this method is called on coordinator
node before new node joins topology.
|
protected IgniteInternalFuture<?> |
wrapStateChangeFuture(IgniteInternalFuture fut,
ChangeGlobalStateMessage msg) |
assertParameter, onDisconnected, onJoiningNodeDataReceived, onReconnected, printMemoryStatsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitonDisconnected, onJoiningNodeDataReceived, onReconnected, printMemoryStatspublic static final String DATA_LOST_ON_DEACTIVATION_WARNING
public GridClusterStateProcessor(GridKernalContext ctx)
ctx - Kernal context.@Nullable public @Nullable IgniteNodeValidationResult validateNode(ClusterNode node)
validateNode in interface GridComponentvalidateNode in class GridProcessorAdapternode - Joining node.null in case of success.public boolean compatibilityMode()
True if IGridClusterStateProcessor has detected that cluster is working
in compatibility mode (nodes of different versions are joined to the cluster).public ClusterState publicApiState(boolean waitForTransition)
publicApiState in interface IGridClusterStateProcessorwaitForTransition - Wait end of transition or not.public IgniteFuture<ClusterState> publicApiStateAsync(boolean asyncWaitForTransition)
publicApiStateAsync in interface IGridClusterStateProcessorasyncWaitForTransition - Wait end of transition or not.public boolean publicApiActiveState(boolean waitForTransition)
publicApiActiveState in interface IGridClusterStateProcessorpublic IgniteFuture<Boolean> publicApiActiveStateAsync(boolean asyncWaitForTransition)
publicApiActiveStateAsync in interface IGridClusterStateProcessorpublic long lastStateChangeTime()
lastStateChangeTime in interface IGridClusterStateProcessorpublic void onReadyForRead(ReadOnlyMetastorage metastorage) throws IgniteCheckedException
onReadyForRead in interface MetastorageLifecycleListenermetastorage - Read-only meta storage.IgniteCheckedExceptionpublic void onReadyForReadWrite(ReadWriteMetastorage metastorage) throws IgniteCheckedException
onReadyForReadWrite in interface MetastorageLifecycleListenermetastorage - Fully functional meta storage.IgniteCheckedExceptionpublic void resetBranchingHistory(long newBranchingHash)
throws IgniteCheckedException
IgniteCheckedException - If write to metastore has failed.public void start()
throws IgniteCheckedException
start in interface GridComponentstart in class GridProcessorAdapterIgniteCheckedException - Throws in case of any errors.public void onKernalStart(boolean active)
throws IgniteCheckedException
onKernalStart in interface GridComponentonKernalStart in class GridProcessorAdapteractive - Cluster active flag (note: should be used carefully since state can
change concurrently).IgniteCheckedException - Thrown in case of any errors.public void onKernalStop(boolean cancel)
onKernalStop in interface GridComponentonKernalStop in class GridProcessorAdaptercancel - Flag indicating whether jobs should be canceled.@Nullable public @Nullable IgniteInternalFuture<Boolean> onLocalJoin(DiscoCache discoCache)
onLocalJoin in interface IGridClusterStateProcessordiscoCache - Discovery data cache.@Nullable public @Nullable ChangeGlobalStateFinishMessage onNodeLeft(ClusterNode node)
onNodeLeft in interface IGridClusterStateProcessornode - Failed node.public void onStateFinishMessage(ChangeGlobalStateFinishMessage msg)
onStateFinishMessage in interface IGridClusterStateProcessormsg - Message.protected void afterStateChangeFinished(IgniteUuid msgId, boolean success)
public boolean onStateChangeMessage(AffinityTopologyVersion topVer, ChangeGlobalStateMessage msg, DiscoCache discoCache)
onStateChangeMessage in interface IGridClusterStateProcessortopVer - Current topology version.msg - Message.discoCache - Current nodes.True if need start state change process.protected boolean isApplicable(ChangeGlobalStateMessage msg, DiscoveryDataClusterState state)
msg - State change message.state - Current cluster state.True if state change from message can be applied to the current state.protected static boolean isEquivalent(ChangeGlobalStateMessage msg, DiscoveryDataClusterState state)
msg - State change message.state - Current cluster state.True if states are equivalent.public DiscoveryDataClusterState clusterState()
clusterState in interface IGridClusterStateProcessorpublic DiscoveryDataClusterState pendingState(ChangeGlobalStateMessage stateMsg)
pendingState in interface IGridClusterStateProcessorprotected IgniteCheckedException concurrentStateChangeError(ClusterState state, ClusterState transitionState)
state - New state.transitionState - State in transition.public void cacheProcessorStarted()
cacheProcessorStarted in interface IGridClusterStateProcessorpublic void stop(boolean cancel)
throws IgniteCheckedException
stop in interface GridComponentstop in class GridProcessorAdaptercancel - If true, then all ongoing tasks or jobs for relevant
components need to be cancelled.IgniteCheckedException - Thrown in case of any errors.@Nullable public @Nullable GridComponent.DiscoveryDataExchangeType discoveryDataType()
GridComponent.collectJoiningNodeData(DiscoveryDataBag)
or GridComponent.collectGridNodeData(DiscoveryDataBag).discoveryDataType in interface GridComponentdiscoveryDataType in class GridProcessorAdapterpublic void collectJoiningNodeData(DiscoveryDataBag dataBag)
TcpDiscoveryJoinRequestMessage request.collectJoiningNodeData in interface GridComponentcollectJoiningNodeData in class GridProcessorAdapterdataBag - container object to store discovery data in.public void collectGridNodeData(DiscoveryDataBag dataBag)
TcpDiscoveryNodeAddedMessage.collectGridNodeData in interface GridComponentcollectGridNodeData in class GridProcessorAdapterdataBag - container object to store discovery data in.public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
onGridDataReceived in interface GridComponentonGridDataReceived in class GridProcessorAdapterdata - DiscoveryDataBag.GridDiscoveryData interface to retrieve discovery data collected on remote nodes
(data common for all nodes in grid and specific for each node).public IgniteInternalFuture<?> changeGlobalState(ClusterState state, boolean forceDeactivation, Collection<? extends BaselineNode> baselineNodes, boolean forceChangeBaselineTopology)
changeGlobalState in interface IGridClusterStateProcessorstate - New cluster state.forceDeactivation - If true, cluster deactivation will be forced.baselineNodes - New baseline nodes.forceChangeBaselineTopology - Force change baseline topology.ClusterState.INACTIVEpublic IgniteInternalFuture<?> changeGlobalState(ClusterState state, boolean forceDeactivation, Collection<? extends BaselineNode> baselineNodes, boolean forceChangeBaselineTopology, boolean isAutoAdjust)
state - New cluster state.forceDeactivation - If true, cluster deactivation will be forced.baselineNodes - New baseline nodes.forceChangeBaselineTopology - Force change baseline topology.isAutoAdjust - Auto adjusting baseline flag.ClusterState.INACTIVE@Nullable public @Nullable IgniteNodeValidationResult validateNode(ClusterNode node, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)
validateNode in interface GridComponentvalidateNode in class GridProcessorAdapternode - Joining node.discoData - Joining node discovery data.null in case of success.protected IgniteInternalFuture<?> wrapStateChangeFuture(IgniteInternalFuture fut, ChangeGlobalStateMessage msg)
fut - Original state change future.msg - State change message.public void onStateChangeError(Map<UUID,Exception> errs, StateChangeRequest req)
onStateChangeError in interface IGridClusterStateProcessorerrs - Errors.req - State change request.public void onStateChangeExchangeDone(StateChangeRequest req)
onStateChangeExchangeDone in interface IGridClusterStateProcessorreq - State change request.public void onBaselineTopologyChanged(BaselineTopology blt, BaselineTopologyHistoryItem prevBltHistItem) throws IgniteCheckedException
onBaselineTopologyChanged in interface IGridClusterStateProcessorblt - New baseline topology.prevBltHistItem - Previous baseline history item.IgniteCheckedExceptionpublic boolean autoAdjustInMemoryClusterState(UUID nodeId, Collection<ClusterNode> topSnapshot, DiscoCache discoCache, long topVer, int minorTopVer)
nodeId - Id of the node that initiated the operation (joined/left/failed).topSnapshot - Topology snapshot from the discovery message.discoCache - Discovery cache from the discovery manager.topVer - Topology version.minorTopVer - Minor topology version.true if baseline was changed and discovery cache recalculation is required.public ExchangeActions autoAdjustExchangeActions(ExchangeActions exchActs)
exchActs - Current exchange actions.public void onExchangeFinishedOnCoordinator(IgniteInternalFuture exchangeFuture, boolean hasMovingPartitions)
onExchangeFinishedOnCoordinator in interface IGridClusterStateProcessorexchangeFuture - Exchange future.hasMovingPartitions - True if there are moving partitions.public boolean evictionsAllowed()
evictionsAllowed in interface IGridClusterStateProcessorTrue if partition evictions are allowed in current state.public boolean isBaselineAutoAdjustEnabled()
True If cluster in auto-adjust.
False If cluster in manuale.public void baselineAutoAdjustEnabled(boolean baselineAutoAdjustEnabled)
baselineAutoAdjustEnabled - Value of manual baseline control or auto adjusting baseline. True If
cluster in auto-adjust. False If cluster in manuale.IgniteException - If operation failed.public IgniteFuture<?> baselineAutoAdjustEnabledAsync(boolean baselineAutoAdjustEnabled)
baselineAutoAdjustEnabled - Value of manual baseline control or auto adjusting baseline. True If
cluster in auto-adjust. False If cluster in manuale.public long baselineAutoAdjustTimeout()
IgniteException - If operation failed.public void baselineAutoAdjustTimeout(long baselineAutoAdjustTimeout)
baselineAutoAdjustTimeout - Value of time which we would wait before the actual topology change since last
server topology change (node join/left/fail).IgniteException - If failed.public IgniteFuture<?> baselineAutoAdjustTimeoutAsync(long baselineAutoAdjustTimeout)
baselineAutoAdjustTimeout - Value of time which we would wait before the actual topology change since last
server topology change (node join/left/fail).public DistributedBaselineConfiguration baselineConfiguration()
public BaselineAutoAdjustStatus baselineAutoAdjustStatus()
public static ClusterState stateWithMinimalFeatures(ClusterState state1, ClusterState state2)
ClusterState.ACTIVE > ClusterState.ACTIVE_READ_ONLY > ClusterState.INACTIVE.
Explain:
ClusterState.INACTIVE has the smallast number of available features. You can't use caches in this state.
ClusterState.ACTIVE_READ_ONLY you have more available features than ClusterState.INACTIVE state,
such as reading from caches, but can't write into them.
ClusterState.ACTIVE you can update caches. It's a state with the biggest number of features.state1 - First given state.state2 - Second given state.public String toString()
toString in class GridProcessorAdapter
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021