summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2019-01-04 15:21:00 -0500
committerMatthew Russotto <matthew.russotto@10gen.com>2019-01-07 11:04:45 -0500
commit31c0c760bd0c72be658bdf91d280b4dc3cf90ea2 (patch)
treea482bf10d5e8f6d029f01023b66c2107fe26db2a
parent07a27d6239373bdc4aa6da70965aab354c85cbc4 (diff)
downloadmongo-31c0c760bd0c72be658bdf91d280b4dc3cf90ea2.tar.gz
SERVER-38843 Mapreduce should not create collections with duplicate IDs
-rw-r--r--src/mongo/db/commands/mr.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 71a66467a38..7e4cb30ae97 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -505,6 +505,11 @@ void State::prepTempCollection() {
// preserved.
options.uuid.emplace(_config.finalOutputCollUUID ? *_config.finalOutputCollUUID
: UUID::gen());
+ } else {
+ // While downgrading, we can inherit a UUID from finalOptions and not override it
+ // above. If we didn't clear it, this would result in creating a collection with a
+ // duplicate UUID.
+ options.uuid = boost::none;
}
tempColl = tempCtx.db()->createCollection(_opCtx, _config.tempNamespace.ns(), options);