summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/migration_destination_manager.cpp
diff options
context:
space:
mode:
authorRandolph Tan <randolph@10gen.com>2021-07-28 15:46:13 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-07-29 15:47:36 +0000
commit6bf3ad77bb5bcc9c07ef38110e687d3a55ef40f7 (patch)
tree5c07d7c0f3c6f1de928d99edef82d19816f96103 /src/mongo/db/s/migration_destination_manager.cpp
parentf839c963f9d1886278732b56f9dc6d5855109634 (diff)
downloadmongo-6bf3ad77bb5bcc9c07ef38110e687d3a55ef40f7.tar.gz
SERVER-58603 ensureTempReshardingCollectionExistsWithIndexes may hit an invariant if collection was previously dropped
Diffstat (limited to 'src/mongo/db/s/migration_destination_manager.cpp')
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp
index d3555e6fa29..1451fd2eced 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -848,6 +848,16 @@ void MigrationDestinationManager::cloneCollectionIndexesAndOptions(
if (collection) {
checkUUIDsMatch(collection);
} else {
+ if (auto collectionByUUID = CollectionCatalog::get(opCtx)->lookupCollectionByUUID(
+ opCtx, collectionOptionsAndIndexes.uuid)) {
+ uasserted(5860300,
+ str::stream()
+ << "Cannot create collection " << nss << " with UUID "
+ << collectionOptionsAndIndexes.uuid
+ << " because it conflicts with the UUID of an existing collection "
+ << collectionByUUID->ns());
+ }
+
// We do not have a collection by this name. Create the collection with the donor's
// options.
OperationShardingState::ScopedAllowImplicitCollectionCreate_UNSAFE