Details
Description
The CatalogCache currently stores databases and collections hierarchically:
DatabaseInfoEntry -> map<string, CollectionRoutingInfoEntry>
So, the CatalogCache::getDatabase() method will refresh a single DatabaseInfoEntry, which
- refreshes from config.databases for the document representing this database
- refreshes from config.collections for the documents representing collections in this database
The CatalogCache::getDatabase() method additionally marks each collection in the database as needsRefresh=true, so any subsequent calls to CatalogCache::getCollectionRoutingInfo will
- refresh from config.chunks for the documents representing chunks in this collection
This is problematic for the database versioning project, where we would like to do a lightweight refresh just from config.databases on StaleDbVersion, without causing heavyweight refreshes from config.collections and, worse, config.chunks.
This ticket is to remove the hierarchy from the CatalogCache, so that
- CatalogCache::getDatabase() refreshes from just config.databases
- CatalogCache::getCollection() refreshes from just config.collections and config.chunks
This ticket will also remove the CachedCollectionRoutingInfo, which is currently a "package" of both the CachedDatabaseInfo and ChunkManager, in favor of:
- CatalogCache::getDatabase() returning CachedDatabaseInfo
- CatalogCache::getCollection() returning CachedCollectionInfo
The CachedDatabaseInfo/CachedCollectionInfo will be thin wrappers around a shared_ptr to the corresponding DatabaseInfoEntry/CollectionInfoEntry, except they will not expose the ability to mark the entries as needsRefresh=true.
This ticket will also add the ability to mark a DatabaseInfoEntry as needsRefresh=true.