influxdata / influxdata/influxdb
[2.x] meta.Client for a kv.Store needs to write lock when reloading data into the client's data cache
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
The `meta.Client` keeps a tsdb cache of all the underlying `kv.Store` data (updates perform a full flush to disk with a Bolt implementation of a `kv.Store`).
The `Client` has a public `Load` method to refresh the cache from the `kv.Store` - as this updates the `Data` cache, it needs a write lock. The current `Load` method does not lock opening a window for corruption or a bad read from the cached data. It may be a possible bug instead of a latent bug. There are two call sites of `Load': one is under a write lock (Open) and the other other is likely problematic as it is used by the `RestoreKVStore` endpoint and cli `influx restore`.
https://github.com/influxdata/influxdb/blob/0dc48b12609d840b86cca439476e106fc2692d44/v1/services/meta/client.go#L991-L992
Contributor guide
Assessment
This issue has not been assessed yet.