Galera Node State Machine
Different Galera layers have different state machines, depending on their semantics. The top layer that represents “node” state has the following FSM:
- Node establishes connection to a primary component.
- Node succeeds in state transfer request. It starts to cache the writesets.
- Node receives state snapshot. Now it has all cluster data and can start applying the cached writesets. Flow control is turned on to ensure eventual slave queue decrease.
- Node completes catching up with the cluster (slave queue is empty). Flow control is turned on to keep slave queue empty. In MySQL
wsrep_readystatus variable is set to
1and the node is allowed to process transactions.
- Node receives state transfer request. Flow control is relaxed as for
JOINER. The node caches the writesets it can't apply.
- Node completes state transfer to joiner.
For clarity the following transitions were omitted from the graph:
- At any time, cluster configuration change event can send the node to
OPENwhen a node loses connection to primary component due to network partition.
- If the node does not need a state transfer (e.g. node restart in an idle cluster) it goes straight