raft: break out of nested loop when id is found (#11870)

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
Zhihong Yu
2020-05-12 16:59:22 -07:00
committed by GitHub
parent 6fb3b9e591
commit 7cc2f8a411

View File

@@ -1428,6 +1428,7 @@ func (r *raft) restore(s pb.Snapshot) bool {
// code here and there assumes that r.id is in the progress tracker.
found := false
cs := s.Metadata.ConfState
for _, set := range [][]uint64{
cs.Voters,
cs.Learners,
@@ -1438,6 +1439,9 @@ func (r *raft) restore(s pb.Snapshot) bool {
break
}
}
if found {
break
}
}
if !found {
r.logger.Warningf(