From 29c8d88c97f9878f0d841adc61fcbf6758fca55f Mon Sep 17 00:00:00 2001 From: Antonio Fuschetto Date: Fri, 7 Oct 2022 10:12:00 +0000 Subject: SERVER-69898 Wait for the critical section catch-up phase before refreshing the DB version --- src/mongo/db/s/flush_database_cache_updates_command.cpp | 4 ++-- src/mongo/db/s/shard_filtering_metadata_refresh.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/mongo/db') diff --git a/src/mongo/db/s/flush_database_cache_updates_command.cpp b/src/mongo/db/s/flush_database_cache_updates_command.cpp index 8ffeb3b008e..729572272f6 100644 --- a/src/mongo/db/s/flush_database_cache_updates_command.cpp +++ b/src/mongo/db/s/flush_database_cache_updates_command.cpp @@ -173,8 +173,8 @@ public: // consistency guarantee. const auto dss = DatabaseShardingState::get(opCtx, _dbName()); auto dssLock = DatabaseShardingState::DSSLock::lockShared(opCtx, dss); - criticalSectionSignal = - dss->getCriticalSectionSignal(ShardingMigrationCriticalSection::kRead, dssLock); + criticalSectionSignal = dss->getCriticalSectionSignal( + ShardingMigrationCriticalSection::kWrite, dssLock); } if (criticalSectionSignal) diff --git a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp index fe5a2b18dc4..e2d0b1155dd 100644 --- a/src/mongo/db/s/shard_filtering_metadata_refresh.cpp +++ b/src/mongo/db/s/shard_filtering_metadata_refresh.cpp @@ -71,7 +71,7 @@ bool joinDbVersionOperation(OperationContext* opCtx, invariant(dssLock->has_value()); if (auto critSect = - dss->getCriticalSectionSignal(ShardingMigrationCriticalSection::kRead, **dssLock)) { + dss->getCriticalSectionSignal(ShardingMigrationCriticalSection::kWrite, **dssLock)) { LOGV2_DEBUG(6697201, 2, "Waiting for exit from the critical section", -- cgit v1.2.1