Skip to content

fix(quorum): a handover that fails is passed to the next member and retried - #676

Merged
bmscomp merged 1 commit into
mainfrom
fix/quorum-hand-over-retry
Nov 16, 2026
Merged

bmscomp merged 1 commit into
mainfrom
fix/quorum-hand-over-retry

Conversation

@bmscomp

@bmscomp bmscomp commented Nov 15, 2026

Copy link
Copy Markdown
Owner

A J4d follow-up from the first nightly run of the operator e2e (run 43767783062): the new PostgreSQL-cut stage failed with "q-…-0 still leads 90 s after losing PostgreSQL". Every other quorum stage passed in that run.

What I can say about the cause

I couldn't reproduce it. On a three-node Kind lab, the same sequence as CI (partition the leader, heal, cut the new leader from PostgreSQL right away) handed over in 30 s. The CI step printed no member logs, so the cause there is unproven. This PR closes the two ways the code could stall, and makes the next failure say why:

  • Quorum.handOver targeted the next member alone. In CI's order that member had been partitioned from its peers a few seconds earlier, the one most likely not to take leadership straight away. It now tries every other member in turn, starting from the next.
  • A failed transfer used the 2-minute rest meant to stop successful handovers bouncing, so nothing was tried again within the stage's 90 s. A failure now clears the rest, and the next 5-second check tries again.
  • The e2e stage prints the cut leader's handover and leadership log lines when it fails.

Proof

  • QuorumTest.aHandoverPassesOverAMemberThatCannotTakeIt: three real Ratis members; the member after the leader is closed; the handover goes to the third, which then alone takes writes.
  • DatabaseHandoverTest.aFailedHandoverIsRetriedWithoutTheRest.
  • ./mvnw test: 1940 tests and one failure, DisruptionReportPersistenceTest.aScheduledRunStoresItsReportOnce ("execute wanted 1 time, was 2"). It's in the disruption scheduler, which this PR doesn't touch, and it passed 3 of 3 when run alone, so it's flaky.
  • Whether the nightly stage now passes shows on the next nightly or workflow_dispatch run after merge. The e2e also runs on this PR, because it changes kates/…/quorum/.

…etried

The first nightly run of the operator e2e (43767783062) found the leader cut
off from PostgreSQL still leading 90 s later, where a Kind lab handed over in
27 s. The handover targets the next member only, and a failed transfer used
the 2-minute rest meant for successful ones, so nothing was tried again
within the stage's 90 s.

- Quorum.handOver tries each other member in turn, from the next one.
- A failed handover no longer starts the rest: the next 5-second check tries
  again.
- The e2e stage prints the cut leader's handover log when it fails.
@bmscomp
bmscomp merged commit ab25a62 into main Nov 16, 2026
66 checks passed
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