Repository navigation
fix: resolve conflicting slot claims by config epoch - #412
Merged
Merged
Conversation
Gossip slot claims carried no epoch, so each node took whichever claim arrived last. A primary that came back after a failover kept announcing its old slots on every ping, and peers flipped them back to it. Claims now carry the sender's config epoch: a claim takes a slot from its owner only with a newer epoch, or an equal epoch and a higher node ID. Nodes raise their current epoch to the newest they see, a node that takes a slot with SETSLOT NODE claims it at a new epoch, and a node that loses slots to a newer claim stops announcing them.
kacy
force-pushed
the
fix/slot-claim-epochs
branch
from
September 24, 2026 20:45
6cab36d to
7c329fb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every gossip ping carries the sender's slot claim, and receivers applied whichever claim they saw last. The claim's incarnation only orders updates from one node. It can't settle two nodes claiming the same slot. After a failover, the old primary coming back kept announcing its old slots, so peers moved them back and forth between it and the promoted replica.
Claims now carry the claiming node's config epoch, as in Redis Cluster.
Wire format:
SlotsChanged,SlotsAnnounceandMemberInfogain aconfig_epoch.Conflict rule, in
ClusterState::apply_slot_claim:Server:
SlotsChangedandMemberJoinedgo throughapply_slot_claiminstead of assigning slots directly.CLUSTER SETSLOT <slot> NODE <self>bumps the local epoch (bump_local_epoch), as Redis does. Without this, the previous owner's claim would win until it heard about the move.This changes the gossip wire format, like #388 did, so the nodes of a cluster need to be upgraded together.
Tests cover a newer claim taking slots and raising the epoch, a stale claim losing, slots dropped from a claim, the tie-break, and the epoch bump.