diff options
author | Allison Easton <allison.easton@mongodb.com> | 2022-08-23 11:19:00 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-08-23 11:52:18 +0000 |
commit | 7b72555ab5c89dd4554ae1f4c7be06217e9b9de7 (patch) | |
tree | 779743d56e1ffe06f7e7c0aa660e9348f97deafd /src/mongo/db/service_entry_point_common.cpp | |
parent | f44c2325605147a5f096fec22626c5fa6ababe51 (diff) | |
download | mongo-7b72555ab5c89dd4554ae1f4c7be06217e9b9de7.tar.gz |
SERVER-68851 Remove wait for collection critical section from service entry point
Diffstat (limited to 'src/mongo/db/service_entry_point_common.cpp')
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index d5e5b4d8528..70d6abb1d31 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -1827,17 +1827,10 @@ Future<void> ExecCommandDatabase::_commandExec() { serverGlobalParams.clusterRole != ClusterRole::ConfigServer && !_refreshedCollection) { if (auto sce = s.extraInfo<StaleConfigInfo>()) { - if (sce->getCriticalSectionSignal()) { - _execContext->behaviors->handleReshardingCriticalSectionMetrics(opCtx, - *sce); - // The shard is in a critical section, so we cannot retry locally - OperationShardingState::waitForCriticalSectionToComplete( - opCtx, *sce->getCriticalSectionSignal()) - .ignore(); - return s; - } + bool stableLocalVersion = + !sce->getCriticalSectionSignal() && sce->getVersionWanted(); - if (sce->getVersionWanted() && + if (stableLocalVersion && ChunkVersion::isIgnoredVersion(sce->getVersionReceived())) { // Shard is recovered, but the router didn't sent a shard version, therefore // we just need to tell the router how much it needs to advance to @@ -1845,16 +1838,22 @@ Future<void> ExecCommandDatabase::_commandExec() { return s; } - if (sce->getVersionWanted() && + if (stableLocalVersion && sce->getVersionReceived().isOlderThan(*sce->getVersionWanted())) { // Shard is recovered and the router is staler than the shard return s; } + if (sce->getCriticalSectionSignal()) { + _execContext->behaviors->handleReshardingCriticalSectionMetrics(opCtx, + *sce); + } + const auto refreshed = _execContext->behaviors->refreshCollection(opCtx, *sce); if (refreshed) { _refreshedCollection = true; - if (!opCtx->isContinuingMultiDocumentTransaction()) { + if (!opCtx->isContinuingMultiDocumentTransaction() && + !sce->getCriticalSectionSignal()) { _resetLockerStateAfterShardingUpdate(opCtx); return _commandExec(); } |