diff options
author | Sergi Mateo Bellido <sergi.mateo-bellido@mongodb.com> | 2021-11-08 09:24:59 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-24 08:44:16 +0000 |
commit | 86c1a3e8978ddd7053d2d1949c0aa79232c6fa14 (patch) | |
tree | 3726b54c5514b8ce9ce6763f488b4754df9665b4 /src | |
parent | 5020d2f2bf05d427943f7e78857ff0b235fc3027 (diff) | |
download | mongo-86c1a3e8978ddd7053d2d1949c0aa79232c6fa14.tar.gz |
SERVER-61268 Fixing the release of a recoverable critical section
(cherry picked from commit 071c3d001d4fd11de9d8f644e15ea9bd269ceb35)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/s/shard_server_op_observer.cpp | 6 |
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 0998328bc35..6fb7c341cba 100644 --- a/src/mongo/db/s/shard_server_op_observer.cpp +++ b/src/mongo/db/s/shard_server_op_observer.cpp @@ -521,6 +521,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); }); |