summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergi Mateo Bellido <sergi.mateo-bellido@mongodb.com>2021-11-08 09:24:59 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-11-08 09:48:17 +0000
commit071c3d001d4fd11de9d8f644e15ea9bd269ceb35 (patch)
treefda97c645c761a6dbb15e3bf993e3d8a378999c1
parent36c81b01cbc0bdddd88e7649ec7302a6bfd8d354 (diff)
downloadmongo-071c3d001d4fd11de9d8f644e15ea9bd269ceb35.tar.gz
SERVER-61268 Fixing the release of a recoverable critical section
-rw-r--r--src/mongo/db/s/shard_server_op_observer.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/s/shard_server_op_observer.cpp b/src/mongo/db/s/shard_server_op_observer.cpp
index a8cf7b3ece1..9d7630c2e1d 100644
--- a/src/mongo/db/s/shard_server_op_observer.cpp
+++ b/src/mongo/db/s/shard_server_op_observer.cpp
@@ -538,6 +538,12 @@ void ShardServerOpObserver::onDelete(OperationContext* opCtx,
UninterruptibleLockGuard noInterrupt(opCtx->lockState());
auto* const csr = CollectionShardingRuntime::get(opCtx, deletedNss);
+
+ // Secondary nodes must clear the filtering metadata before releasing the
+ // in-memory critical section
+ if (!isStandaloneOrPrimary(opCtx))
+ csr->clearFilteringMetadata(opCtx);
+
auto csrLock = CollectionShardingRuntime::CSRLock::lockExclusive(opCtx, csr);
csr->exitCriticalSection(csrLock, reason);
});