raft: Ignore redundant addNode calls.

This avoids clobbering any state when bootstrapping entries are
applied twice.
This commit is contained in:
Ben Darnell 2014-12-05 17:15:50 -05:00
parent 3d91faf85a
commit ea4d645a83

View File

@ -472,6 +472,12 @@ func (r *raft) handleSnapshot(m pb.Message) {
func (r *raft) resetPendingConf() { r.pendingConf = false }
func (r *raft) addNode(id uint64) {
if _, ok := r.prs[id]; ok {
// Ignore any redundant addNode calls (which can happen because the
// initial bootstrapping entries are applied twice).
return
}
r.setProgress(id, 0, r.raftLog.lastIndex()+1)
r.pendingConf = false
}