mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-21 14:41:09 +02:00
physical/raft: Add nil check to shutdown (#9322)
This commit is contained in:
parent
26177d22f5
commit
08c83d341d
@ -729,14 +729,25 @@ func (b *RaftBackend) TeardownCluster(clusterListener cluster.ClusterHook) error
|
|||||||
}
|
}
|
||||||
|
|
||||||
b.l.Lock()
|
b.l.Lock()
|
||||||
future := b.raft.Shutdown()
|
|
||||||
|
// Perform shutdown only if the raft object is non-nil. The object could be nil
|
||||||
|
// if the node is unsealed but has not joined the peer set.
|
||||||
|
var future raft.Future
|
||||||
|
if b.raft != nil {
|
||||||
|
future = b.raft.Shutdown()
|
||||||
|
}
|
||||||
|
|
||||||
b.raft = nil
|
b.raft = nil
|
||||||
|
|
||||||
// If we're tearing down, then we need to recreate the raftInitCh
|
// If we're tearing down, then we need to recreate the raftInitCh
|
||||||
b.raftInitCh = make(chan struct{})
|
b.raftInitCh = make(chan struct{})
|
||||||
b.l.Unlock()
|
b.l.Unlock()
|
||||||
|
|
||||||
|
if future != nil {
|
||||||
return future.Error()
|
return future.Error()
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// CommittedIndex returns the latest index committed to stable storage
|
// CommittedIndex returns the latest index committed to stable storage
|
||||||
|
Loading…
x
Reference in New Issue
Block a user