diff options
author | Geert Bosch <geert@mongodb.com> | 2017-10-23 11:54:05 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2017-10-23 14:38:28 -0400 |
commit | 9af189775db7b17b265d18a04ca0dc314792a4c5 (patch) | |
tree | e4093f56c08cf030f65a279514f9def861b3b205 /src | |
parent | 04a7b956a32f5b1d6d3b169bb4e8ad829ac6e733 (diff) | |
download | mongo-9af189775db7b17b265d18a04ca0dc314792a4c5.tar.gz |
SERVER-31539 applyOps create fails if UUID already exists in different DB
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/catalog/create_collection.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/create_collection.cpp b/src/mongo/db/catalog/create_collection.cpp index 4164ffd510a..b4f1565f01c 100644 --- a/src/mongo/db/catalog/create_collection.cpp +++ b/src/mongo/db/catalog/create_collection.cpp @@ -41,6 +41,7 @@ #include "mongo/db/operation_context.h" #include "mongo/db/ops/insert.h" #include "mongo/db/repl/replication_coordinator_global.h" +#include "mongo/logger/redaction.h" namespace mongo { namespace { @@ -188,6 +189,11 @@ Status createCollectionForApplyOps(OperationContext* opCtx, // If the collection with the requested UUID already exists, but with a different // name, just rename it to 'newCollName'. if (catalog.lookupCollectionByUUID(uuid)) { + uassert(40655, + str::stream() << "Invalid name " << redact(newCollName.ns()) + << " for UUID " + << uuid.toString(), + currentName.db() == newCollName.db()); Status status = db->renameCollection(opCtx, currentName.ns(), newCollName.ns(), stayTemp); if (!status.isOK()) |