summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2022-04-11 11:43:58 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-12 17:18:50 +0000
commit5c3a18b06e60143e71d40d81f49bc65a03cd9361 (patch)
tree30ecfcf4c069da14c7098be5fbeedd6291d98d4e
parent86082d2e5bb02a565d13be46045c04de58e01214 (diff)
downloadmongo-5c3a18b06e60143e71d40d81f49bc65a03cd9361.tar.gz
SERVER-65408 Fix locking for warnEncryptedCollectionsIfNeeded
-rw-r--r--src/mongo/db/catalog/drop_collection.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mongo/db/catalog/drop_collection.cpp b/src/mongo/db/catalog/drop_collection.cpp
index db79477b5c4..f04a8fa2b79 100644
--- a/src/mongo/db/catalog/drop_collection.cpp
+++ b/src/mongo/db/catalog/drop_collection.cpp
@@ -200,6 +200,8 @@ Status _abortIndexBuildsAndDrop(OperationContext* opCtx,
return status;
}
+ warnEncryptedCollectionsIfNeeded(opCtx, coll);
+
try {
checkCollectionUUIDMismatch(opCtx, startingNss, coll, expectedUUID);
} catch (const DBException& ex) {
@@ -356,11 +358,7 @@ Status _dropCollection(OperationContext* opCtx,
return Status(ErrorCodes::NamespaceNotFound, "ns not found");
}
- auto collectionPtr =
- CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, collectionName);
- if (collectionPtr) {
- warnEncryptedCollectionsIfNeeded(opCtx, collectionPtr);
-
+ if (CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, collectionName)) {
return _abortIndexBuildsAndDrop(
opCtx,
std::move(autoDb),