Speculative fix for a panic that might arise during raft teardown (#18704)
This commit is contained in:
parent
d5c35f39c3
commit
b5f19fffe9
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
storage/raft: Fix race with follower heartbeat tracker during teardown.
|
||||
```
|
|
@ -551,6 +551,13 @@ func (b *RaftBackend) startFollowerHeartbeatTracker() {
|
|||
}
|
||||
for range tickerCh {
|
||||
b.l.RLock()
|
||||
if b.raft == nil {
|
||||
// We could be racing with teardown, which will stop the ticker
|
||||
// but that doesn't guarantee that we won't reach this line with a nil
|
||||
// b.raft.
|
||||
b.l.RUnlock()
|
||||
return
|
||||
}
|
||||
b.followerStates.l.RLock()
|
||||
myAppliedIndex := b.raft.AppliedIndex()
|
||||
for peerID, state := range b.followerStates.followers {
|
||||
|
|
Loading…
Reference in New Issue