summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/coll_mod.cpp
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2017-11-16 11:07:20 -0500
committerXiangyu Yao <xiangyu.yao@mongodb.com>2017-12-07 18:50:43 -0500
commit91967bd82ef848129c02c2f5641e304f141b80d3 (patch)
tree39ff6a5199f2111b78fe8a386c6789ea302bc807 /src/mongo/db/catalog/coll_mod.cpp
parent2ff0e2dd55a0360cb5223f496849fe2df2209b1a (diff)
downloadmongo-91967bd82ef848129c02c2f5641e304f141b80d3.tar.gz
SERVER-31952 Return error if collMod provides a UUID that does not match the UUID of the collection specified
(cherry picked from commit de7324dc370bc2a0c8367bbf0ce97314bce2802a)
Diffstat (limited to 'src/mongo/db/catalog/coll_mod.cpp')
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index b6c6c61d374..f839c9cc361 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -441,6 +441,14 @@ Status _collModInternal(OperationContext* opCtx,
<< coll->ns();
CollectionCatalogEntry* cce = coll->getCatalogEntry();
cce->removeUUID(opCtx);
+ } else if (uuid && coll->uuid() && uuid.get() != coll->uuid().get()) {
+ return Status(ErrorCodes::Error(50658),
+ str::stream() << "collMod " << redact(cmdObj) << " provides a UUID ("
+ << uuid.get().toString()
+ << ") that does not match the UUID ("
+ << coll->uuid().get().toString()
+ << ") of the collection "
+ << nss.ns());
}
coll->refreshUUID(opCtx);
}