From 609fb074f87cc47971f0ae85a6e4eb571b67c129 Mon Sep 17 00:00:00 2001 From: Robert Guo Date: Fri, 20 Nov 2015 17:07:33 -0500 Subject: SERVER-21596 Check if output collection is sharded when doing mapReduce --- src/mongo/s/commands/cluster_map_reduce_cmd.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp index 42272057bb9..ec4d6a4fef6 100644 --- a/src/mongo/s/commands/cluster_map_reduce_cmd.cpp +++ b/src/mongo/s/commands/cluster_map_reduce_cmd.cpp @@ -514,6 +514,12 @@ public: // Do the splitting round ChunkManagerPtr cm = confOut->getChunkManagerIfExists(txn, finalColLong); + + uassert(34359, + str::stream() << "Failed to write mapreduce output to " << finalColLong + << "; expected that collection to be sharded, but it was not", + cm); + for (const auto& chunkSize : chunkSizes) { BSONObj key = chunkSize.first; const int size = chunkSize.second; -- cgit v1.2.1