summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorJacob Evans <jacob.evans@mongodb.com>2019-12-11 21:33:49 +0000
committerevergreen <evergreen@mongodb.com>2019-12-11 21:33:49 +0000
commit57acc8b666b8c9dfc34eaf03c226ab26ac225781 (patch)
tree1a0971f0cce77fc5178fc48952770dc164818b22 /src/mongo/db/commands
parent3da6513067131a50323f3388b8dc2918da885732 (diff)
downloadmongo-57acc8b666b8c9dfc34eaf03c226ab26ac225781.tar.gz
SERVER-44475 Remove Query Knob
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/SConscript1
-rw-r--r--src/mongo/db/commands/map_reduce_command.cpp6
-rw-r--r--src/mongo/db/commands/map_reduce_command_base.h23
-rw-r--r--src/mongo/db/commands/mr_test.cpp4
4 files changed, 26 insertions, 8 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,