Skip to content

Commit 86848de

Browse files
authored
Update the leader election description with the info on resolving the split-brain (#2983)
Closes #2954
1 parent 5fe0ba8 commit 86848de

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

doc/book/replication/repl_leader_elect.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,20 @@ When the fencing is on, the leader resigns its leadership if it has less than th
108108
of alive connections to the cluster nodes. The resigning leader receives the status of a follower in the current election term and becomes read-only.
109109
Fencing applies to the instances that have the :ref:`election_mode <repl_leader_elect_config>` set to "candidate" or "manual".
110110

111+
.. _repl_leader_elect_splitbrain:
112+
113+
There can still be a situation when a replica set has two leaders working independently (so called *split-brain*).
114+
It can happen, for example, if a user mistakenly lowered the :ref:`replication_synchro_quorum <repl_leader_elect_config>` below ``N / 2 + 1``.
115+
In this situation, to preserve the data integrity, if an instance detects the split-brain anomaly in the incoming replication data,
116+
it breaks the connection with the instance sending the data and writes the ``ER_SPLIT_BRAIN`` error in the log.
117+
118+
Eventually, there will be two sets of nodes with the diverged data,
119+
and any node from one set is disconnected from any node from the other set with the ``ER_SPLIT_BRAIN`` error.
120+
121+
Once noticing the error, a user can choose any representative from each of the sets and inspect the data on them.
122+
To correlate the data, the user should remove it from the nodes of one set, and reconnect them to the nodes from the other set that have the correct data.
123+
124+
111125
Also, if election is enabled on the node, it won't replicate from any nodes except
112126
the newest leader. This is done to avoid the issue when a new leader is elected,
113127
but the old leader has somehow survived and tries to send more changes

0 commit comments

Comments
 (0)