diff options
Diffstat (limited to 'src/mongo/db/s/shard_server_catalog_cache_loader.cpp')
-rw-r--r-- | src/mongo/db/s/shard_server_catalog_cache_loader.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp index ee2230b6333..37a59006a68 100644 --- a/src/mongo/db/s/shard_server_catalog_cache_loader.cpp +++ b/src/mongo/db/s/shard_server_catalog_cache_loader.cpp @@ -36,6 +36,7 @@ #include <memory> #include "mongo/db/client.h" +#include "mongo/db/db_raii.h" #include "mongo/db/operation_context.h" #include "mongo/db/operation_context_group.h" #include "mongo/db/read_concern.h" @@ -619,6 +620,12 @@ void ShardServerCatalogCacheLoader::_runSecondaryGetChunksSince( forcePrimaryCollectionRefreshAndWaitForReplication(opCtx, nss); // Read the local metadata. + + // Disallow reading on an older snapshot because this relies on being able to read the + // side effects of writes during secondary replication after being signalled from the + // CollectionVersionLogOpHandler. + BlockSecondaryReadsDuringBatchApplication_DONT_USE secondaryReadsBlockBehindReplication(opCtx); + auto swCollAndChunks = _getCompletePersistedMetadataForSecondarySinceVersion(opCtx, nss, catalogCacheSinceVersion); callbackFn(opCtx, std::move(swCollAndChunks)); |