Skip to content

Commit

Permalink
Merge pull request #9282 from gyuho/raft-index
Browse files Browse the repository at this point in the history
raft: reuse "last index" in "appendEntry"
  • Loading branch information
gyuho authored Feb 6, 2018
2 parents 3903385 + 2b7c12f commit af44780
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,9 @@ func (r *raft) appendEntry(es ...pb.Entry) {
es[i].Term = r.Term
es[i].Index = li + 1 + uint64(i)
}
r.raftLog.append(es...)
r.getProgress(r.id).maybeUpdate(r.raftLog.lastIndex())
// use latest "last" index after truncate/append
li = r.raftLog.append(es...)
r.getProgress(r.id).maybeUpdate(li)
// Regardless of maybeCommit's return, our caller will call bcastAppend.
r.maybeCommit()
}
Expand Down

0 comments on commit af44780

Please sign in to comment.