We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1c5f235 commit cdd3670Copy full SHA for cdd3670
pkg/util/admission/grant_coordinator.go
@@ -276,6 +276,14 @@ func (sgc *StoreGrantCoordinators) TryGetSnapshotQueueForStore(storeID roachpb.S
276
func (sgc *StoreGrantCoordinators) close() {
277
// closeCh can be nil in tests that never called SetPebbleMetricsProvider.
278
if sgc.closeCh != nil {
279
+ // Ensure that the goroutine has observed the close and will no longer
280
+ // call GetPebbleMetrics, since the engines will be closed soon after this
281
+ // method returns, and calling GetPebbleMetrics on closed engines is not
282
+ // permitted.
283
+ sgc.closeCh <- struct{}{}
284
+ // Close the channel, so that if close gets called twice due to a bug,
285
+ // sending on the closed channel will panic instead of the send being
286
+ // blocked forever.
287
close(sgc.closeCh)
288
}
289
0 commit comments