Skip to content

Commit

Permalink
raft: break out of nested loop when id is found (#11870)
Browse files Browse the repository at this point in the history
Signed-off-by: Ted Yu <[email protected]>
  • Loading branch information
tedyu authored May 12, 2020
1 parent 6fb3b9e commit 7cc2f8a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions raft/raft.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -1438,6 +1439,9 @@ func (r *raft) restore(s pb.Snapshot) bool {
break
}
}
if found {
break
}
}
if !found {
r.logger.Warningf(
Expand Down

0 comments on commit 7cc2f8a

Please sign in to comment.