Package com.hazelcast.cluster
Enum Class ClusterState
- All Implemented Interfaces:
Serializable,Comparable<ClusterState>,Constable
ClusterState are several possible states of the cluster
where each state can allow and/or deny specific actions
and/or change behavior of specific actions.
There are 5 states:
-
ACTIVE: Cluster will continue to operate without any restriction. -
NO_MIGRATION: Migrations (partition rebalancing) and backup replications are not allowed. Cluster will continue to operate without any restriction. -
FROZEN: New members are not allowed to join, partition table/assignments will be frozen. All other operations are allowed and will operate without any restriction. If some members leave the cluster while it is inFROZENstate, they can join back. -
PASSIVE: New members are not allowed to join. All operations, except the ones marked withAllowedDuringPassiveState, will be rejected immediately. -
IN_TRANSITION: Shows thatClusterStateis in transition. This is a temporary & intermediate state, not allowed to be set explicitly.
By default, cluster will be in ACTIVE state. During split-brain merge process,
state of the cluster, that is going to join to the major side,
will be changed to FROZEN automatically before merge
and will be set to the state of the new cluster after merge.
- Since:
- 3.6
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionInACTIVEstate, cluster will continue to operate without any restriction.InFROZENstate of the cluster: New members are not allowed to join, except the members left duringFROZENorPASSIVEstate.Shows that ClusterState is in transition.InNO_MIGRATIONstate of the cluster, migrations (partition rebalancing) and backup replications are not allowed.InPASSIVEstate of the cluster: New members are not allowed to join, except the members left duringFROZENorPASSIVEstate. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClusterStategetById(int id) bytegetId()booleanReturnstrue, if joining of a new member is allowed in this state.booleanReturnstrue, if migrations and replications are allowed in this state.booleanReturnstrue, if partition promotions are allowed in this state.static ClusterStateReturns the enum constant of this class with the specified name.static ClusterState[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ACTIVE
InACTIVEstate, cluster will continue to operate without any restriction. All operations are allowed. This is the default state of a cluster. -
NO_MIGRATION
InNO_MIGRATIONstate of the cluster, migrations (partition rebalancing) and backup replications are not allowed.-
When a new member joins, it will not be assigned any partitions until cluster state changes to
ACTIVE. -
When a member leaves, backups of primary replicas owned by that member will be promoted to primary.
But missing backup replicas will not be created/replicated until cluster state changes to
ACTIVE.
- Since:
- 3.9
-
When a new member joins, it will not be assigned any partitions until cluster state changes to
-
FROZEN
InFROZENstate of the cluster:-
New members are not allowed to join, except the members left during
FROZENorPASSIVEstate. For example, cluster has 3 nodes; A, B and C inFROZENstate. If member B leaves the cluster (either proper shutdown or crash), it will be allowed to re-join to the cluster. But another member D, won't be able to join. -
Partition table/assignments will be frozen. When a member leaves the cluster, its partition
assignments (as primary and backup) will remain the same, until either that member re-joins
to the cluster or
ClusterStatechanges back toACTIVE. If that member re-joins while still inFROZEN, it will own all previously assigned partitions. IfClusterStatechanges toACTIVEthen partition re-balancing process will kick in and all unassigned partitions will be assigned to active members. It's not allowed to changeClusterStatetoFROZENwhen there are pending migration/replication tasks in the system. -
Nodes continue to stay in
NodeState.ACTIVEstate when cluster goes into theFROZENstate. - All other operations except migrations are allowed and will operate without any restriction.
-
New members are not allowed to join, except the members left during
-
PASSIVE
InPASSIVEstate of the cluster:-
New members are not allowed to join, except the members left during
FROZENorPASSIVEstate. -
Partition table/assignments will be frozen. It's not allowed to change
ClusterStatetoPASSIVEwhen there are pending migration/replication tasks in the system. If some nodes leave the cluster while cluster is inPASSIVEstate, they will be removed from the partition table when cluster state moves back toACTIVE. -
When cluster state is moved to
PASSIVE, nodes are moved toNodeState.PASSIVEtoo. Similarly when cluster state moves to another state fromPASSIVE, nodes becomeNodeState.ACTIVE. -
All operations, except the ones marked with
AllowedDuringPassiveState, will be rejected immediately.
-
New members are not allowed to join, except the members left during
-
IN_TRANSITION
Shows that ClusterState is in transition. When a state change transaction is started, ClusterState will be shown asIN_TRANSITIONwhile the transaction is in progress. After the transaction completes, cluster will be either in the new state or in the previous state, depending on transaction result.This is a temporary & intermediate state, not allowed to be set explicitly.
-
Similarly to the
FROZENstate, new members are not allowed and migration/replication process will be paused. - If membership change occurs in the cluster, cluster state transition will fail and will be reverted back to the previous state.
-
Similarly to the
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isJoinAllowed
public boolean isJoinAllowed()Returnstrue, if joining of a new member is allowed in this state.- Returns:
trueif joining of a new member is allowed in this state.
-
isMigrationAllowed
public boolean isMigrationAllowed()Returnstrue, if migrations and replications are allowed in this state.- Returns:
trueif migrations and replications are allowed in this state.
-
isPartitionPromotionAllowed
public boolean isPartitionPromotionAllowed()Returnstrue, if partition promotions are allowed in this state.- Returns:
trueif partition promotions are allowed in this state.
-
getId
public byte getId() -
getById
-