From 2514cb0721a0df59601f3ff264a9a03d5015db71 Mon Sep 17 00:00:00 2001 From: Brett Nawrocki Date: Fri, 2 Sep 2022 21:22:15 +0000 Subject: SERVER-68932 Fix resharding critical section metrics --- src/mongo/db/service_entry_point_common.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/mongo/db/service_entry_point_common.cpp') diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 1033abb70e0..ac6955774f3 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -1828,8 +1828,8 @@ Future ExecCommandDatabase::_commandExec() { serverGlobalParams.clusterRole != ClusterRole::ConfigServer && !_refreshedCollection) { if (auto sce = s.extraInfo()) { - bool stableLocalVersion = - !sce->getCriticalSectionSignal() && sce->getVersionWanted(); + bool inCriticalSection = sce->getCriticalSectionSignal().has_value(); + bool stableLocalVersion = !inCriticalSection && sce->getVersionWanted(); if (stableLocalVersion && ChunkVersion::isIgnoredVersion(sce->getVersionReceived())) { @@ -1845,7 +1845,7 @@ Future ExecCommandDatabase::_commandExec() { return s; } - if (sce->getCriticalSectionSignal()) { + if (inCriticalSection) { _execContext->behaviors->handleReshardingCriticalSectionMetrics(opCtx, *sce); } @@ -1853,8 +1853,7 @@ Future ExecCommandDatabase::_commandExec() { const auto refreshed = _execContext->behaviors->refreshCollection(opCtx, *sce); if (refreshed) { _refreshedCollection = true; - if (!opCtx->isContinuingMultiDocumentTransaction() && - !sce->getCriticalSectionSignal()) { + if (!opCtx->isContinuingMultiDocumentTransaction() && !inCriticalSection) { _resetLockerStateAfterShardingUpdate(opCtx); return _commandExec(); } -- cgit v1.2.1