Merge pull request #164 from xiangli-cmu/bug_fix

bug fix
pull/820/head
Ben Johnson 2014-01-23 11:53:27 -08:00
commit 3a5d9096fc
2 changed files with 2 additions and 2 deletions

View File

@ -192,7 +192,7 @@ func (p *Peer) sendAppendEntriesRequest(req *AppendEntriesRequest) {
// If it was unsuccessful then decrement the previous log index and
// we'll try again next time.
} else {
if resp.Term() > p.server.Term() {
if resp.Term() > p.server.Term() || resp.CommitIndex() > p.server.CommitIndex() {
// this happens when there is a new leader comes up that this *leader* has not
// known yet.
// this server can know until the new leader send a ae with higher term

View File

@ -33,7 +33,7 @@ const (
)
const (
DefaultHeartbeatTimeout = 1 * time.Millisecond
DefaultHeartbeatTimeout = 50 * time.Millisecond
DefaultElectionTimeout = 150 * time.Millisecond
)