-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MonotonicMatchIndexProp to TLA+ spec. #5324
Conversation
@heidihoward The current spec allows (Spec versions as of at least bd99109 also violate the prop) /cc @jumaffre @eddyashton |
mku-gh5057-pr5325@72004 aka 20230616.78 vs main ewma over 20 builds from 71540 to 71993 Click to see tablemain
mku-gh5057-pr5325
|
I've taken a look at the implementation's use of The place where we're decrementing
There's a more detailed description of this optimisation in a comment in the etcd Raft implementation. We currently use the same Edited to add: I'm guessing the reason this then produces a |
Have a scenario demonstrating that reuse of this |
3d826d7
to
1454326
Compare
Property NextIdxMatchIdxInv ==
\* Why would a leader ever send entries in an AppendEntriesRequests that the leader assume the follower to already have?!
\A i,j \in Servers :
nextIndex[i][j] >= matchIndex[i][j] However, the invariant diff --git a/tla/ccfraft.tla b/tla/ccfraft.tla
index 987c64ea1..a0c5ea7b4 100644
--- a/tla/ccfraft.tla
+++ b/tla/ccfraft.tla
@@ -1003,7 +1003,7 @@ HandleAppendEntriesResponse(i, j, m) ==
\/ /\ \lnot m.success \* not successful
/\ LET tm == FindHighestPossibleMatch(log[i], m.lastLogIndex, m.term)
IN nextIndex' = [nextIndex EXCEPT ![i][j] =
- (IF matchIndex[i][j] = 0 THEN tm ELSE min(tm, matchIndex[i][j])) + 1 ]
+ (IF matchIndex[i][j] = 0 THEN tm ELSE max(tm, matchIndex[i][j])) + 1 ]
\* UNCHANGED matchIndex is implied by the following statement in figure 2, page 4 in the raft paper:
\* "If AppendEntries fails because of log inconsistency: decrement nextIndex and retry"
/\ UNCHANGED matchIndex
This change has the potential of introducing a liveness bug, but we do not check liveness as of now. |
As @jumaffre pointed out, figure 2 on page 4 of the raft paper provides the following property: