cockroach
cockroach copied to clipboard
server,admission: fix close and read race on DiskStatsMonitor
The diskStatsMap owns its DiskStatsMonitors, but it is closed from a different path than the StoreGrantCoordinators which calls read methods on the diskStatsMap (via the PebbleMetricsProvider interface). This causes a rare shutdown race, which fails a unit test. This is fixed by adding a Close method on PebbleMetricsProvider, to align the usage and closing. The nodePebbleMetricsProvider implements this interface, instead of directly implementing it by Node.
There is some minor cleanup permitted by this. Node does not need a diskStatsMap member. StoreGrantCoordinators does not need a PebbleMetricsProvider member.
Fixes #128958
Epic: none
Release note: None
TFTR!
bors r=aadityasondhi