Skip to content

Stabilize forced partition elections - #8197

Merged
Amaury Chamayou (achamayou) merged 4 commits into
mainfrom
achamayou-stabilize-partition-election
Aug 24, 2026
Merged

Stabilize forced partition elections#8197
Amaury Chamayou (achamayou) merged 4 commits into
mainfrom
achamayou-stabilize-partition-election

Conversation

@achamayou

Copy link
Copy Markdown
Member

Summary

  • Allow forced primary elections to wait through four observed election periods.
  • Apply the same bound while waiting for the new primary's signature to replicate.
  • Always remove the temporary partition when the election wait exits.

Why

The VMSS Virtual C failure healed the certificate-renewal partition at 11:53:28.006, observed primary unanimity and matching commit levels, and then isolated the current primary from the target node roughly 0.4 seconds later.

The target needed the remaining backup's vote, but that follower-to-follower node channel had not recovered from the previous iptables partition. The target repeatedly became a pre-vote candidate without receiving a vote response, then hit the existing 8-second bound.

Commit synchronization proves that nodes agree on replicated state; it does not prove that every pairwise node transport is immediately usable. This is the same class of delayed transport recovery previously addressed in #8132.

Waiting for four observed election periods makes the desired outcome itself the readiness probe and permits multiple pre-vote and reconnection attempts. It does not add delay to successful runs because both waits return immediately when their conditions are met, remains bounded, and does not weaken any assertion. Using the partition as a context manager also prevents leaked iptables rules if either wait fails.

Testing

  • uvx black --check tests/partitions_test.py
  • uvx ruff check tests/partitions_test.py

Allow multiple observed election periods for node-to-node transport to recover, and always remove the temporary partition when the election wait exits.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 84a50e6c-025b-4e67-b701-b7d06d764b21
Copilot AI lite review requested due to automatic review settings August 21, 2026 13:01
@achamayou
Amaury Chamayou (achamayou) requested a review from a team as a code owner August 21, 2026 13:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the forced primary election path in the partitions end-to-end test to use a longer, election-derived bound and to ensure iptables isolation rules are always removed via a context manager. This improves resilience to transient node-to-node transport recovery delays following partition healing.

Changes:

  • Bound the forced-election wait by 4 * network.observed_election_duration (rather than a fixed multiple of the configured election timeout).
  • Apply the same bound while waiting for commit synchronization (signature replication) after the new primary is elected.
  • Use with network.partitioner.isolate_node(...) so the temporary partition rules are always dropped when the wait scope exits (success or failure).

Custom instructions used:

  • .github/skills/testing/SKILL.md

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@achamayou
Amaury Chamayou (achamayou) merged commit 42bfd68 into main Aug 24, 2026
19 checks passed
@achamayou
Amaury Chamayou (achamayou) deleted the achamayou-stabilize-partition-election branch August 24, 2026 13:50
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.

3 participants