Details
Description
The current implementation of ShardServerCatalogCacheLoader::_waitForTasksToCompleteAndRenameChunks doesn't wait for the rename operation to be majority committed. This is a problem because the shard might locally think that the operation was completed: it could happen that the timestamp was majority committed on config.cache.collections but not the renameCollection, so the next time that shard does a refresh it will think that the rename was completed.
After discussing it with pierlauro.sciarelli, we agreed that this method should guarantee the following:
- If a call to ShardServerCatalogCacheLoader::_waitForTasksToCompleteAndRenameChunks successfully completes, both renameOperation and updateTimestampOnShardCollections should be majority committed.
- It should support to be called in a scenario in which the target collection already exists but the timestamp is not present on config.cache.collections.*.