[SERVER-33835] remove hierarchical structure between databases and collections from CatalogCache Created: 12/Mar/18  Updated: 29/Oct/23  Resolved: 29/Mar/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.7.4

Type: Task Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Esha Maharishi (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 2018-03-26, Sharding 2018-04-09
Participants:

 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.



 Comments   
Comment by Githook User [ 29/Mar/18 ]

Author:

{'email': 'esha.maharishi@mongodb.com', 'name': 'Esha Maharishi', 'username': 'EshaMaharishi'}

Message: SERVER-33835 Remove hierarchical structure between databases and collections from CatalogCache
Branch: master
https://github.com/mongodb/mongo/commit/a4d81c1fe912f51669a8fb8f3e47515d9eab20a7

Generated at Thu Feb 08 04:34:43 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.