CP Subsystem Process
CP Subsystem runs a discovery process on cluster startup. When CP Subsystem is
enabled by setting a positive value to
CPSubsystemConfig.setCPMemberCount(int)
, say N
, the first N
members in
the Hazelcast cluster member list initiate this discovery process. Other
Hazelcast members skip this step. The CP discovery process runs out of the box
on top of Hazelcast’s cluster member list without requiring any custom
configuration for different environments. It is completed when each one of
the first N
Hazelcast members initializes its local CP member list and
commits it to the METADATA CP group. A soon-to-be CP member terminates
itself if any of the following conditions occur before the CP discovery process
is completed:
-
Any Hazelcast member leaves the cluster
-
The local Hazelcast member commits a CP member list which is different from other members' committed CP member lists
-
The local Hazelcast member fails to commit its discovered CP member list for any reason.
When CP Subsystem is reset via CPSubsystemManagementService.reset()
,
the CP discovery process is triggered again. However, it does not terminate
Hazelcast members if the new CP discovery round fails for any of
the aforementioned reasons, because Hazelcast members are likely to contain
data for AP data structures and their termination can cause data loss. Hence,
you need to observe the cluster and check if the CP discovery process
completes successfully on the CP Subsystem reset. See the CP Subsystem Management APIs section
for more details.
You can use the CPSubsystemManagementService.awaitUntilDiscoveryCompleted(timeout, timeUnit)
API to wait until the CP discovery process is completed.