public enum ClusterState extends Enum<ClusterState>
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 in FROZEN
state, they can join back.
PASSIVE
:
New members are not allowed to join.
All operations, except the ones marked with AllowedDuringPassiveState
,
will be rejected immediately.
IN_TRANSITION
:
Shows that ClusterState
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.
Cluster.getClusterState()
,
Cluster.changeClusterState(ClusterState)
,
NodeState
Enum Constant and Description |
---|
ACTIVE
In
ACTIVE state, cluster will continue to operate without any restriction. |
FROZEN
In
FROZEN state of the cluster:
New members are not allowed to join, except the members left during FROZEN or PASSIVE state. |
IN_TRANSITION
Shows that ClusterState is in transition.
|
NO_MIGRATION
In
NO_MIGRATION state of the cluster, migrations (partition rebalancing) and backup replications
are not allowed. |
PASSIVE
In
PASSIVE state of the cluster:
New members are not allowed to join, except the members left during FROZEN or PASSIVE state. |
Modifier and Type | Method and Description |
---|---|
static ClusterState |
getById(int id) |
byte |
getId() |
boolean |
isJoinAllowed()
Returns
true , if joining of a new member is allowed in this state. |
boolean |
isMigrationAllowed()
Returns
true , if migrations and replications are allowed in this state. |
boolean |
isPartitionPromotionAllowed()
Returns
true , if partition promotions are allowed in this state. |
static ClusterState |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ClusterState[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ClusterState ACTIVE
ACTIVE
state, cluster will continue to operate without any restriction.
All operations are allowed. This is the default state of a cluster.public static final ClusterState NO_MIGRATION
NO_MIGRATION
state of the cluster, migrations (partition rebalancing) and backup replications
are not allowed.
ACTIVE
.
ACTIVE
.
public static final ClusterState FROZEN
FROZEN
state of the cluster:
FROZEN
or PASSIVE
state.
For example, cluster has 3 nodes; A, B and C in FROZEN
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.
ClusterState
changes back to ACTIVE
.
If that member re-joins while still in FROZEN
, it will own all previously assigned partitions.
If ClusterState
changes to ACTIVE
then partition re-balancing process will
kick in and all unassigned partitions will be assigned to active members.
It's not allowed to change ClusterState
to FROZEN
when there are pending migration/replication tasks in the system.
NodeState.ACTIVE
state when cluster goes into the FROZEN
state.
public static final ClusterState PASSIVE
PASSIVE
state of the cluster:
FROZEN
or PASSIVE
state.
ClusterState
to PASSIVE
when there are pending migration/replication tasks in the system. If some
nodes leave the cluster while cluster is in PASSIVE
state, they will be removed from the
partition table when cluster state moves back to ACTIVE
.
PASSIVE
, nodes are moved to NodeState.PASSIVE
too.
Similarly when cluster state moves to another state from PASSIVE
, nodes become
NodeState.ACTIVE
.
AllowedDuringPassiveState
,
will be rejected immediately.
public static final ClusterState IN_TRANSITION
IN_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.
FROZEN
state, new members are not allowed
and migration/replication process will be paused.
public static ClusterState[] values()
for (ClusterState c : ClusterState.values()) System.out.println(c);
public static ClusterState valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic boolean isJoinAllowed()
true
, if joining of a new member is allowed in this state.true
if joining of a new member is allowed in this state.public boolean isMigrationAllowed()
true
, if migrations and replications are allowed in this state.true
if migrations and replications are allowed in this state.public boolean isPartitionPromotionAllowed()
true
, if partition promotions are allowed in this state.true
if partition promotions are allowed in this state.public byte getId()
public static ClusterState getById(int id)
Copyright © 2023 Hazelcast, Inc.. All rights reserved.