From d293c4915c6c74c66e39e7ca1326f35b2b3abe29 Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Mon, 9 Jun 2014 16:56:04 -0700 Subject: [PATCH] raft: fix pendingConf --- raft/raft.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/raft/raft.go b/raft/raft.go index 4278eca5b..7a0cd991e 100644 --- a/raft/raft.go +++ b/raft/raft.go @@ -203,6 +203,7 @@ func (sm *stateMachine) becomeFollower(term, lead int) { sm.term = term sm.lead = lead sm.state = stateFollower + sm.pendingConf = false } func (sm *stateMachine) becomeCandidate() { @@ -224,6 +225,12 @@ func (sm *stateMachine) becomeLeader() { sm.reset() sm.lead = sm.addr sm.state = stateLeader + + for _, e := range sm.log.ents[sm.log.committed:] { + if e.Type == config { + sm.pendingConf = true + } + } } func (sm *stateMachine) Msgs() []Message {