Repository navigation
Raft: reject stale proposals against uncommitted shard epochs - #5593
quanyeyang wants to merge 9 commits into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Review stateNot ready for human review yet. Risk: Medium. Changes which raft proposals reach the log and how pending proposals get completed on cluster-v2. A mistake turns successful FORGET or FAILOVER into client errors or timeouts. Open findings (1)
Resolved (2)
Backport: Not needed. Changes the raft cluster protocol, which exists only on the cluster-v2 feature branch and not on any release line. Updated for 79d69ac at 2026-11-27 07:07 UTC. The bot rewrites this comment on every review. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## cluster-v2 #5593 +/- ##
==============================================
+ Coverage 81.61% 81.69% +0.07%
==============================================
Files 203 203
Lines 108494 108502 +8
==============================================
+ Hits 88548 88639 +91
+ Misses 19946 19863 -83
🚀 New features to boost your workflow:
|
Pre-validation compared only the applied epoch, so two FAILOVERs in the same commit window both entered the log. Scan the uncommitted suffix so the second is REJECTED before append. Signed-off-by: quanyeyang <quanyemostima@gmail.com>
Pre-validation on the leader completed the client before the proposal was pending, so a stale epoch was not retried. Track it first so CompletePendingProposal can defer until the epoch advances. Signed-off-by: quanyeyang <quanyemostima@gmail.com>
When two clients propose NODE_FORGET for the same node before the first entry commits, the append-time epoch check defers one proposal. Once the node is gone, allow that proposal to retry as an idempotent no-op. Skip deferred proposals when matching results so each client gets a reply. Add a regression test that holds the first entry uncommitted and verifies that both clients receive OK. Signed-off-by: quanyeyang <quanyemostima@gmail.com>
478936d to
79d69ac
Compare
Let an applied entry complete a deferred proposal when its resend was rejected. This lets FAILOVER return OK when the replica was promoted. Retry at the same shard epoch if the predicted bump was skipped on apply or lost on a leader change. This prevents a valid ADDSLOTS from timing out after a concurrent FORGET fails. Add regression tests for both cases. Signed-off-by: quanyeyang <quanyemostima@gmail.com>
…ime-epoch-tracking Signed-off-by: quanyeyang <quanyemostima@gmail.com>
|
While reviewing this, I found a pre-existing issue. I'll follow up on it separately in #5751 ! |
…ime-epoch-tracking Signed-off-by: quanyeyang <quanyemostima@gmail.com>
Count an epoch retry only after the proposer applies the retry-after index. Repeated reconnects could exhaust the retry budget and return an error to the client even though the original FAILOVER later succeeded. When retrying NODE_FORGET, use the epoch of the target node's current shard. A node can move to a shard with a lower epoch, leaving the original request stale on every retry. Add regression coverage for both cases. Signed-off-by: quanyeyang <quanyemostima@gmail.com>
A proposer may have already applied a conflicting entry that the new leader has yet to apply. Returning that entry's index can exhaust the proposal's retries before the leader catches up. Use the election no-op's index as the minimum retry-after index until the new leader applies it. Signed-off-by: quanyeyang <quanyemostima@gmail.com>
A CLUSTER FORGET queued behind other voter changes could exhaust its retry budget and report a stale shard epoch even when the epoch had never changed. Keep using the same retry index for both waits. Use the REJECT reason to charge the retry budget only for stale epoch conflicts. Signed-off-by: quanyeyang <quanyemostima@gmail.com>
bandalgomsu
left a comment
There was a problem hiding this comment.
lgtm! Could you update the description to cover the latest changes ?
Closes #3874.
#3899 checks proposals against the applied shard epoch. If two
FAILOVERproposals for the same shard arrive before the first one applies, both can pass that check and enter the log.The leader now accounts for unapplied
FAILOVER,SET_REPLICA_OF, andNODE_FORGETentries when checking a proposal’s shard epoch. In the example above, it rejects the secondFAILOVERbefore appending it.SLOT_CHANGEchecks the epoch without advancing it. Apply-time validation against the applied epoch remains authoritative.Shard-epoch conflicts now use the retry index introduced in #4456. A
REJECT conflicttells the proposer which log index to apply before refreshing the epoch and retrying.NODE_FORGETuses the target node’s current shard epoch, even if the node moved to a shard with a lower epoch.Protocol and cluster tests cover the two-
FAILOVERcase, retries across reconnects and elections, andCLUSTER FORGETduring voter changes and shard moves.