When we received a StaleDbVersion error during a batchWrite, in the ChunkManagerTargeter we locally decide if we need to refresh based on some version comparision and if this is the case we force a full refresh of the catalog cache.
If multiple cuncurrent batchWrite operations hit the same StaleDbVersion they will all force a full refresh of the catalog without any kind of syncronization, causing several refresh of the cached database metadata when actually only one is required.
When receiving a StaleDbVersion the ChunkManagerTargeter should only call CatalogCache::onStaleDbVersion() and expect that on the next CatalogCache lookup it will receive the refreshed metadata. In this new approach if we receive several staleDbVersion concurrently with the same db version we will only perform one refresh.
- related to
-
SERVER-58271 Stop forcing collection version refreshes in chunk manager targeter
- Closed