Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Protect cache integrity during reads
During an invalid cache state, the client will disconnect, then attempt reconnect to each endpoint. During this process reads against the cache is are not prohibited. This means a client could be reading stale data from the cache. During reconnect we use the meta db.cacheMutex (not the cache mutex) to control resetting the db's cache. This patch leverages that to guard reads to the cache based on the same mutex. Additionally, it tries to ensure that the cache will be in a consistent state when the read takes place. The db.cacheMutex is not held for the entire reconnect process, so we need to make some attempt to wait for a signal that a reconnect is complete... a best effort attempt to give the client an accurate cache read. Signed-off-by: Tim Rozet <[email protected]>
- Loading branch information