Fix commit log index update.

pull/820/head
Ben Johnson 2013-05-10 21:54:25 -06:00
parent 2efa6b4107
commit 49f3a13fbc
2 changed files with 4 additions and 4 deletions

View File

@ -48,6 +48,6 @@ func NewAppendEntriesResponse(term uint64, success bool, commitIndex uint64) *Ap
return &AppendEntriesResponse{
Term: term,
Success: success,
CommitIndex: commitIndex,
CommitIndex: commitIndex,
}
}

View File

@ -146,9 +146,9 @@ func (p *Peer) sendFlushRequest(req *AppendEntriesRequest, handler func(*Server,
// problem.
if p.prevLogIndex > 0 {
p.prevLogIndex--
if resp.CommitIndex > p.prevLogIndex {
p.prevLogIndex = resp.CommitIndex
}
}
if resp.CommitIndex > p.prevLogIndex {
p.prevLogIndex = resp.CommitIndex
}
}