Skip to content

Init

INIT - clean up any old state, disconnect everything, and prepare for a new Election

On Entry

A cluster member enters the INIT state when it starts, or when something triggers a new Election. If it's running and a new Election is triggered, there will be state that needs cleaning up. If there is an error during an Election, it returns to INIT, so there may also be Election-specific activities that need cleaning up.

Description

See Election.init(). It performs all the initialisation, which may include some or all of the following:

  • moves to the FOLLOWER cluster role
  • closes the Ingress Subscription
  • removes the Catchup / Live Log destinations from the Log Subscription
  • if the LogAdapter has an Image, it closes it
  • if the LogPublisher has a Publication, it closes it
  • switches the Cluster Control Toggle to INACTIVE, so it can't be asked to perform an action like SNAPSHOT
  • stops the Archive from recording the Log
  • creates a new RecoveryPlan
  • closes any cluster sessions
  • if it was in FOLLOWER_LOG_REPLICATION, it stops replicating the Log from the leader
  • if it was the leader and its Archive was replaying to a catchup session on a follower, it tells its Archive to stop the replay
  • if a LogReplay was in progress, replaying its own Log to itself to process, it stops it

Once the cleanup is complete (or if none was necessary):

  • it sets its candidateTermId to the higher of its current leadershipTermId and the candidateTermId in its node-state.dat file (it will be incremented before being used in NOMINATE, if it gets that far)

On Exit

By the end of INIT, the member has cleaned up any previous state, connections, etc., and is ready to start the Election.

It moves to CANVASS if it's in a multi node cluster. If it's a single node cluster, it skips the unnecessary voting part and moves straight to LEADER_LOG_REPLICATION.