diff options
Diffstat (limited to 'src/mongo/db')
-rw-r--r-- | src/mongo/db/commands/SConscript | 1 | ||||
-rw-r--r-- | src/mongo/db/commands/map_reduce_command.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/commands/map_reduce_command_base.h | 23 | ||||
-rw-r--r-- | src/mongo/db/commands/mr_test.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/query/query_knobs.idl | 7 |
5 files changed, 26 insertions, 15 deletions
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript index 3bdfb73e08d..1e1b927a553 100644 --- a/src/mongo/db/commands/SConscript +++ b/src/mongo/db/commands/SConscript @@ -520,6 +520,7 @@ env.Library( '$BUILD_DIR/mongo/db/db_raii', '$BUILD_DIR/mongo/db/index/index_access_methods', '$BUILD_DIR/mongo/db/pipeline/mongo_process_interface', + '$BUILD_DIR/mongo/db/pipeline/process_interface_factory_mongod', '$BUILD_DIR/mongo/db/query_exec', '$BUILD_DIR/mongo/db/query/map_reduce_output_format', '$BUILD_DIR/mongo/idl/idl_parser', diff --git a/src/mongo/db/commands/map_reduce_command.cpp b/src/mongo/db/commands/map_reduce_command.cpp index c605affd325..5cae9c1e228 100644 --- a/src/mongo/db/commands/map_reduce_command.cpp +++ b/src/mongo/db/commands/map_reduce_command.cpp @@ -78,11 +78,9 @@ private: // Execute the mapReduce as an aggregation pipeline only if fully upgraded to 4.4, since // a 4.2 mongos in a mixed version cluster expects a fundamentally different response that // is not supported by the aggregation equivalent. - if (internalQueryUseAggMapReduce.load() && - serverGlobalParams.featureCompatibility.getVersion() == - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) { + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) return map_reduce_agg::runAggregationMapReduce(opCtx, cmd, result, boost::none); - } return mr::runMapReduce(opCtx, dbname, cmd, errmsg, result); } } mapReduceCommand; diff --git a/src/mongo/db/commands/map_reduce_command_base.h b/src/mongo/db/commands/map_reduce_command_base.h index 5166cdec327..1595242b4b4 100644 --- a/src/mongo/db/commands/map_reduce_command_base.h +++ b/src/mongo/db/commands/map_reduce_command_base.h @@ -44,6 +44,24 @@ public: "details."; } + /** + * The mapReduce command supports only 'local' and 'available' readConcern levels. + * For aggregation-based mapReduce there are no known restrictions to broader support, but work + * would need to be done confirm support for both command and aggregation stages as is done for + * the aggregate command. + */ + virtual ReadConcernSupportResult supportsReadConcern(const BSONObj& cmdObj, + repl::ReadConcernLevel level) const { + static const Status kReadConcernNotSupported{ErrorCodes::InvalidOptions, + "read concern not supported"}; + static const Status kDefaultReadConcernNotPermitted{ErrorCodes::InvalidOptions, + "default read concern not permitted"}; + return {{level != repl::ReadConcernLevel::kLocalReadConcern && + level != repl::ReadConcernLevel::kAvailableReadConcern, + kReadConcernNotSupported}, + {kDefaultReadConcernNotPermitted}}; + } + virtual bool supportsWriteConcern(const BSONObj& cmd) const override { return map_reduce_common::mrSupportsWriteConcern(cmd); } @@ -74,9 +92,8 @@ public: const OpMsgRequest& request, ExplainOptions::Verbosity verbosity, rpc::ReplyBuilderInterface* result) const override { - if (internalQueryUseAggMapReduce.load() && - serverGlobalParams.featureCompatibility.getVersion() == - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) { + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo44) { auto builder = result->getBodyBuilder(); auto explain = boost::make_optional(verbosity); try { diff --git a/src/mongo/db/commands/mr_test.cpp b/src/mongo/db/commands/mr_test.cpp index c65f492893d..f7a05c77103 100644 --- a/src/mongo/db/commands/mr_test.cpp +++ b/src/mongo/db/commands/mr_test.cpp @@ -341,7 +341,9 @@ void MapReduceOpObserver::onStartIndexBuild(OperationContext* opCtx, const UUID& indexBuildUUID, const std::vector<BSONObj>& indexes, bool fromMigrate) { - indexesCreated = indexes; + for (auto&& obj : indexes) { + indexesCreated.push_back(obj.getOwned()); + } } void MapReduceOpObserver::onInserts(OperationContext* opCtx, diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl index 8609e832f8f..09824ee3922 100644 --- a/src/mongo/db/query/query_knobs.idl +++ b/src/mongo/db/query/query_knobs.idl @@ -298,13 +298,6 @@ server_parameters: cpp_vartype: AtomicWord<bool> default: false - internalQueryUseAggMapReduce: - description: "If true runs mapReduce in a pipeline instead of the mapReduce command." - set_at: [ startup, runtime ] - cpp_varname: "internalQueryUseAggMapReduce" - cpp_vartype: AtomicWord<bool> - default: false - internalQueryMaxJsEmitBytes: description: "Limits the vector of values emitted from a single document's call to JsEmit to the given size in bytes." |