Fix commit log index update.
parent
2efa6b4107
commit
49f3a13fbc
|
@ -48,6 +48,6 @@ func NewAppendEntriesResponse(term uint64, success bool, commitIndex uint64) *Ap
|
|||
return &AppendEntriesResponse{
|
||||
Term: term,
|
||||
Success: success,
|
||||
CommitIndex: commitIndex,
|
||||
CommitIndex: commitIndex,
|
||||
}
|
||||
}
|
||||
|
|
6
peer.go
6
peer.go
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue