raft: update unstable when calling stableTo with 0

It should update unstable in this case because it may happen that raft
only writes entry 0 into stable storage.
This commit is contained in:
Yicheng Qin
2014-11-11 16:10:03 -08:00
parent ac77971f99
commit 7dba92dd53
3 changed files with 23 additions and 7 deletions

View File

@ -298,9 +298,7 @@ func (n *node) run(r *raft) {
if prevHardSt.Commit != 0 {
r.raftLog.appliedTo(prevHardSt.Commit)
}
if prevLastUnstablei != 0 {
r.raftLog.stableTo(prevLastUnstablei)
}
r.raftLog.stableTo(prevLastUnstablei)
advancec = nil
case <-n.done:
return