|
|
@@ -668,10 +668,10 @@ func TestHandleMsgApp(t *testing.T) {
|
|
|
{pb.Message{Type: pb.MsgApp, Term: 2, LogTerm: 1, Index: 1, Commit: 4, Entries: []pb.Entry{{Index: 2, Term: 2}}}, 2, 2, false},
|
|
|
|
|
|
// Ensure 3
|
|
|
- {pb.Message{Type: pb.MsgApp, Term: 1, LogTerm: 1, Index: 1, Commit: 3}, 2, 1, false}, // match entry 1, commit upto last new entry 1
|
|
|
- {pb.Message{Type: pb.MsgApp, Term: 1, LogTerm: 1, Index: 1, Commit: 3, Entries: []pb.Entry{{Index: 2, Term: 2}}}, 2, 2, false}, // match entry 1, commit upto last new entry 2
|
|
|
- {pb.Message{Type: pb.MsgApp, Term: 2, LogTerm: 2, Index: 2, Commit: 3}, 2, 2, false}, // match entry 2, commit upto last new entry 2
|
|
|
- {pb.Message{Type: pb.MsgApp, Term: 2, LogTerm: 2, Index: 2, Commit: 4}, 2, 2, false}, // commit upto log.last()
|
|
|
+ {pb.Message{Type: pb.MsgApp, Term: 1, LogTerm: 1, Index: 1, Commit: 3}, 2, 1, false}, // match entry 1, commit up to last new entry 1
|
|
|
+ {pb.Message{Type: pb.MsgApp, Term: 1, LogTerm: 1, Index: 1, Commit: 3, Entries: []pb.Entry{{Index: 2, Term: 2}}}, 2, 2, false}, // match entry 1, commit up to last new entry 2
|
|
|
+ {pb.Message{Type: pb.MsgApp, Term: 2, LogTerm: 2, Index: 2, Commit: 3}, 2, 2, false}, // match entry 2, commit up to last new entry 2
|
|
|
+ {pb.Message{Type: pb.MsgApp, Term: 2, LogTerm: 2, Index: 2, Commit: 4}, 2, 2, false}, // commit up to log.last()
|
|
|
}
|
|
|
|
|
|
for i, tt := range tests {
|
|
|
@@ -918,7 +918,7 @@ func TestLeaderAppResp(t *testing.T) {
|
|
|
wcommitted uint64
|
|
|
}{
|
|
|
{3, true, 0, 3, 0, 0, 0}, // stale resp; no replies
|
|
|
- {2, true, 0, 2, 1, 1, 0}, // denied resp; leader does not commit; decrese next and send probing msg
|
|
|
+ {2, true, 0, 2, 1, 1, 0}, // denied resp; leader does not commit; decrease next and send probing msg
|
|
|
{2, false, 2, 4, 2, 2, 2}, // accept resp; leader commits; broadcast with commit index
|
|
|
{0, false, 0, 3, 0, 0, 0}, // ignore heartbeat replies
|
|
|
}
|
|
|
@@ -1223,7 +1223,7 @@ func TestSlowNodeRestore(t *testing.T) {
|
|
|
// trigger a commit
|
|
|
nt.send(pb.Message{From: 1, To: 1, Type: pb.MsgProp, Entries: []pb.Entry{{}}})
|
|
|
if follower.raftLog.committed != lead.raftLog.committed {
|
|
|
- t.Errorf("follower.comitted = %d, want %d", follower.raftLog.committed, lead.raftLog.committed)
|
|
|
+ t.Errorf("follower.committed = %d, want %d", follower.raftLog.committed, lead.raftLog.committed)
|
|
|
}
|
|
|
}
|
|
|
|