summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/drop_collection.cpp
diff options
context:
space:
mode:
authorGregory Noma <gregory.noma@gmail.com>2022-06-27 15:15:28 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-06-27 16:13:15 +0000
commit9193a05db1a1dda7d7cc67bbd673c6d88654c826 (patch)
tree200382c319b3fc425457afb17551b2b762f1eee1 /src/mongo/db/catalog/drop_collection.cpp
parent3e3aae871cf2213d5288336f95f67c9df343a814 (diff)
downloadmongo-9193a05db1a1dda7d7cc67bbd673c6d88654c826.tar.gz
SERVER-67408 Preserve `CollectionUUIDMismatch` error even if database does not exist
Diffstat (limited to 'src/mongo/db/catalog/drop_collection.cpp')
-rw-r--r--src/mongo/db/catalog/drop_collection.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/catalog/drop_collection.cpp b/src/mongo/db/catalog/drop_collection.cpp
index c8849d06825..cc164c4aa0f 100644
--- a/src/mongo/db/catalog/drop_collection.cpp
+++ b/src/mongo/db/catalog/drop_collection.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/audit.h"
#include "mongo/db/catalog/collection_catalog.h"
#include "mongo/db/catalog/collection_uuid_mismatch.h"
+#include "mongo/db/catalog/collection_uuid_mismatch_info.h"
#include "mongo/db/catalog/index_catalog.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/exception_util.h"
@@ -357,7 +358,13 @@ Status _dropCollection(OperationContext* opCtx,
AutoGetDb autoDb(opCtx, collectionName.db(), MODE_IX);
auto db = autoDb.getDb();
if (!db) {
- return Status(ErrorCodes::NamespaceNotFound, "ns not found");
+ return expectedUUID
+ ? Status{CollectionUUIDMismatchInfo(collectionName.db().toString(),
+ *expectedUUID,
+ collectionName.coll().toString(),
+ boost::none),
+ "Database does not exist"}
+ : Status(ErrorCodes::NamespaceNotFound, "ns not found");
}
if (CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, collectionName)) {