mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #1495 from xiangli-cmu/fix_raft_test
raft: fix a incorrect in testMaybeAppend
This commit is contained in:
commit
b59961228b
@ -50,7 +50,7 @@ func (l *raftLog) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// maybeAppend returns (0, false) if the entries cannot be appended. Otherwise,
|
// maybeAppend returns (0, false) if the entries cannot be appended. Otherwise,
|
||||||
// it returns (last index of entries, true).
|
// it returns (last index of new entries, true).
|
||||||
func (l *raftLog) maybeAppend(index, logTerm, committed uint64, ents ...pb.Entry) (lastnewi uint64, ok bool) {
|
func (l *raftLog) maybeAppend(index, logTerm, committed uint64, ents ...pb.Entry) (lastnewi uint64, ok bool) {
|
||||||
lastnewi = index + uint64(len(ents))
|
lastnewi = index + uint64(len(ents))
|
||||||
if l.matchTerm(index, logTerm) {
|
if l.matchTerm(index, logTerm) {
|
||||||
|
@ -202,8 +202,8 @@ func TestLogMaybeAppend(t *testing.T) {
|
|||||||
lastindex, true, commit, false, // commit do not decrease
|
lastindex, true, commit, false, // commit do not decrease
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
lastterm - 3, lastindex - 3, lastindex, nil,
|
0, 0, lastindex, nil,
|
||||||
1, true, commit, false, // commit do not decrease
|
0, true, commit, false, // commit do not decrease
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
lastterm, lastindex, lastindex, []pb.Entry{{Term: 4}},
|
lastterm, lastindex, lastindex, []pb.Entry{{Term: 4}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user