Skip to content

wip! Transient Leader/Primary Divergence - #1707

Draft
pniedzielski wants to merge 1 commit into
bloomberg:mainfrom
pniedzielski:leader-primary-transient-divergence
Draft

wip! Transient Leader/Primary Divergence#1707
pniedzielski wants to merge 1 commit into
bloomberg:mainfrom
pniedzielski:leader-primary-transient-divergence

Conversation

@pniedzielski

Copy link
Copy Markdown
Collaborator

No description provided.

@pniedzielski
pniedzielski force-pushed the leader-primary-transient-divergence branch 2 times, most recently from f99649e to 5a72651 Compare August 12, 2026 21:08
A leader gets cut off from enough peers to lose quorum.  If one of the
peers it can no longer reach becomes the new leader, it never learns of
it.  Should that node then fall silent and the original be elected
again, its Partition FSM never left PRIMARY_HEALED, so nothing
refreshes the lease id; every request it subsequently sends carries the
stale value, which replicas reject.

This patch adds an integration test for that sequence, next to the
existing test for the case where the old primary does observe the
takeover and shuts itself down.  The two differ only in whether the old
primary keeps a link to its replacement, so they belong side by side.

The shape is taken from a chaos run that hit this on a seven-node
cluster.  There the old leader kept two live peers throughout and still
never learned who had replaced it, and the replacement was paused
rather than killed -- it was that pause, not a crash, that let the rest
of the cluster move on without it.  The test asserts that the
replacement aborts on waking, which was the sole uninjected event of
that run and is what distinguishes this scenario from the adjacent one.

Each election outcome is forced by quorum steering rather than left to
timing.  The old primary keeps a majority quorum while it is cut off:
lowering it there would let it self-elect and produce a genuine
two-leader split brain instead of the scenario under test.  The two
followers never meant to lead are given a quorum higher than the
cluster size, so neither can win regardless of which links happen to
still be up between them and the old primary -- without that, a
bystander that keeps a live connection to the old primary can end up
winning the race meant for the intended replacement, as it did the
first time this test was run.

The test is expected to fail until the Partition FSM learns to handle
being told it is primary again while it still believes it is primary.
@pniedzielski
pniedzielski force-pushed the leader-primary-transient-divergence branch from 5a72651 to 754d46e Compare August 12, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant