@@ -2597,21 +2597,29 @@ func TestLeaderAppResp(t *testing.T) {
2597
2597
// There is no storage access for term in the maybeCommit() code path
2598
2598
{2 , false , 2 , 7 , 1 , 2 , 0 , 2 },
2599
2599
2600
+ // Follower 2 responds to leader, indicating log index 3 is replicated.
2601
+ // Leader tries to commit, but commit index doesn't advance since the index
2602
+ // is from a previous term. Same as above.
2603
+ {3 , false , 3 , 7 , 1 , 3 , 0 , 1 },
2604
+
2600
2605
// NB: For the following tests, we are skipping the MsgAppResp for the first
2601
2606
// 3 entries, by directly processing MsgAppResp for later entries.
2602
2607
//
2603
2608
// Follower 2 is StateProbing at 4, it sends MsgAppResp for 4, and is moved
2604
2609
// to StateReplicate and as many entries as possible are sent to it (5, 6).
2605
2610
// Correspondingly the Next is then 7 (entry 7 does not exist, indicating
2606
2611
// the follower will be up to date should it process the emitted MsgApp).
2607
- // accept resp; leader commits; respond with commit index
2612
+ // accept resp; leader commits; respond with commit index.
2613
+ // maybeCommit() is successful.
2608
2614
{4 , false , 4 , 7 , 1 , 4 , 4 , 1 },
2609
2615
2610
2616
// Follower 2 says term2, index5 is already replicated.
2611
2617
// The leader responds with the updated commit index to follower 2.
2618
+ // maybeCommit() is successful.
2612
2619
{5 , false , 5 , 7 , 1 , 5 , 5 , 1 },
2613
2620
// Follower 2 says term2, index6 is already replicated.
2614
2621
// The leader responds with the updated commit index to follower 2.
2622
+ // maybeCommit() is successful.
2615
2623
{6 , false , 6 , 7 , 1 , 6 , 6 , 1 },
2616
2624
} {
2617
2625
t .Run ("" , func (t * testing.T ) {
0 commit comments