|
There are three different refresh procedures, depending on the server type.
1) Mongos/Config refresh from the config server's config.chunks and config.collections collections and maintain in-memory caches
2) Shard primary refresh from the config server's config.chunks and config.collections collections and maintain in-memory caches, but further must persist that metadata on the shard
3) Shard secondary refreshes from the shard's config.chunks and config.collections collections and maintains in-memory caches.
The server start up code will need to initialize the interface, which CatalogCache will then use in its chunk metadata refresh procedure.
Roughly, the interface needs to define
readCollectionEntry // reads either from config or shard config.collections
|
onLocalDrop // new epoch or collection drop must drop the metadata, too, if the shard primary
|
readChunks(collectionVersion) // reads either from config or shard config.chunks
|
persistMetadata(chunkDiff, collectionsEntry) // primary persist chunk and collection entry
|
|