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 inFROZEN
state, 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 thatClusterState
is 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 ConstantDescriptionInACTIVE
state, cluster will continue to operate without any restriction.InFROZEN
state of the cluster: New members are not allowed to join, except the members left duringFROZEN
orPASSIVE
state.Shows that ClusterState is in transition.InNO_MIGRATION
state of the cluster, migrations (partition rebalancing) and backup replications are not allowed.InPASSIVE
state of the cluster: New members are not allowed to join, except the members left duringFROZEN
orPASSIVE
state. -
Method Summary
Modifier and TypeMethodDescriptionstatic ClusterState
getById
(int id) byte
getId()
boolean
Returnstrue
, if joining of a new member is allowed in this state.boolean
Returnstrue
, if migrations and replications are allowed in this state.boolean
Returnstrue
, if partition promotions are allowed in this state.static ClusterState
Returns 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
InACTIVE
state, cluster will continue to operate without any restriction. All operations are allowed. This is the default state of a cluster. -
NO_MIGRATION
InNO_MIGRATION
state 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
InFROZEN
state of the cluster:-
New members are not allowed to join, except the members left during
FROZEN
orPASSIVE
state. For example, cluster has 3 nodes; A, B and C inFROZEN
state. 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
ClusterState
changes back toACTIVE
. If that member re-joins while still inFROZEN
, it will own all previously assigned partitions. IfClusterState
changes toACTIVE
then partition re-balancing process will kick in and all unassigned partitions will be assigned to active members. It's not allowed to changeClusterState
toFROZEN
when there are pending migration/replication tasks in the system. -
Nodes continue to stay in
NodeState.ACTIVE
state when cluster goes into theFROZEN
state. - 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
InPASSIVE
state of the cluster:-
New members are not allowed to join, except the members left during
FROZEN
orPASSIVE
state. -
Partition table/assignments will be frozen. It's not allowed to change
ClusterState
toPASSIVE
when there are pending migration/replication tasks in the system. If some nodes leave the cluster while cluster is inPASSIVE
state, 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.PASSIVE
too. 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_TRANSITION
while 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
FROZEN
state, 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:
true
if 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:
true
if migrations and replications are allowed in this state.
-
isPartitionPromotionAllowed
public boolean isPartitionPromotionAllowed()Returnstrue
, if partition promotions are allowed in this state.- Returns:
true
if partition promotions are allowed in this state.
-
getId
public byte getId() -
getById
-