summaryrefslogtreecommitdiff
path: root/src
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-08-20 16:06:54 +0000
commitf2233a69550028c0a3dc4b15e040026cdba8bf1e (patch)
tree878eb605346079cdef6a56b2863ac9da8164c846 /src
parent853ef0de7a7adfe2b7e36d96d1ae89791ef41832 (diff)
downloadmongo-f2233a69550028c0a3dc4b15e040026cdba8bf1e.tar.gz
SERVER-58603 ensureTempReshardingCollectionExistsWithIndexes may hit an invariant if collection was previously dropped
(cherry picked from commit 6bf3ad77bb5bcc9c07ef38110e687d3a55ef40f7)
Diffstat (limited to 'src')
-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 47b06b54534..4ff5ef9a0b6 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