summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoonsoo Kim <yoonsoo.kim@mongodb.com>2022-04-08 22:56:11 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-04-08 23:30:25 +0000
commit86efc4be5f8921af9e8b89ef4219b089ef0c67cd (patch)
tree6af922acf8f1d86c21a903df88784e9ecb08145c
parent72f118efc3078b75be837b6abbb95603995a605a (diff)
downloadmongo-86efc4be5f8921af9e8b89ef4219b089ef0c67cd.tar.gz
SERVER-65341 Enable the SBE lookup feature by default
-rw-r--r--jstests/noPassthrough/check_sbe_lookup_feature.js15
-rw-r--r--jstests/sharding/query/lookup_graph_lookup_foreign_becomes_sharded.js10
-rw-r--r--src/mongo/db/commands/run_aggregate.cpp4
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp4
-rw-r--r--src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp4
-rw-r--r--src/mongo/db/query/query_feature_flags.idl3
6 files changed, 34 insertions, 6 deletions
diff --git a/jstests/noPassthrough/check_sbe_lookup_feature.js b/jstests/noPassthrough/check_sbe_lookup_feature.js
new file mode 100644
index 00000000000..9841522c806
--- /dev/null
+++ b/jstests/noPassthrough/check_sbe_lookup_feature.js
@@ -0,0 +1,15 @@
+(function() {
+'use strict';
+
+const conn = MongoRunner.runMongod();
+
+const res = assert.commandWorked(
+ conn.getDB("admin").adminCommand({getParameter: 1, featureFlagSBELookupPushdown: 1}),
+ "featureFlagSBELookupPushdown must have been turned on by default since 6.0");
+assert(res.hasOwnProperty("featureFlagSBELookupPushdown"), res);
+const featureFlag = res.featureFlagSBELookupPushdown;
+assert(featureFlag.hasOwnProperty("value") && featureFlag.value, res);
+assert(featureFlag.hasOwnProperty("version") && featureFlag.version == "6.0", res);
+
+MongoRunner.stopMongod(conn);
+}());
diff --git a/jstests/sharding/query/lookup_graph_lookup_foreign_becomes_sharded.js b/jstests/sharding/query/lookup_graph_lookup_foreign_becomes_sharded.js
index 99e0e88cab9..4a0e65db1cb 100644
--- a/jstests/sharding/query/lookup_graph_lookup_foreign_becomes_sharded.js
+++ b/jstests/sharding/query/lookup_graph_lookup_foreign_becomes_sharded.js
@@ -116,8 +116,11 @@ const isShardedLookupEnabled = getShardedLookupParam.hasOwnProperty("featureFlag
let res = shard0.getPrimary().getDB("admin").adminCommand(
{getParameter: 1, featureFlagSBELookupPushdown: 1});
+let fcvCmdRes = assert.commandWorked(shard0.getPrimary().getDB("admin").adminCommand(
+ {getParameter: 1, featureCompatibilityVersion: 1}));
let isSBELookupEnabled = res.ok && res.hasOwnProperty("featureFlagSBELookupPushdown") &&
- res.featureFlagSBELookupPushdown.value;
+ res.featureFlagSBELookupPushdown.value &&
+ parseFloat(fcvCmdRes.featureCompatibilityVersion.version) >= 6.0;
// Now run a getMore for each of the test cases. The collection has become sharded mid-iteration, so
// we should observe the error code associated with the test case.
@@ -198,8 +201,11 @@ shard0.restart(shard0.getPrimary());
// is running after restart.
res = shard0.getPrimary().getDB("admin").adminCommand(
{getParameter: 1, featureFlagSBELookupPushdown: 1});
+fcvCmdRes = assert.commandWorked(shard0.getPrimary().getDB("admin").adminCommand(
+ {getParameter: 1, featureCompatibilityVersion: 1}));
isSBELookupEnabled = res.ok && res.hasOwnProperty("featureFlagSBELookupPushdown") &&
- res.featureFlagSBELookupPushdown.value;
+ res.featureFlagSBELookupPushdown.value &&
+ parseFloat(fcvCmdRes.featureCompatibilityVersion.version) >= 6.0;
// Enable profiling on shard0 to capture stale shard version exceptions.
const primaryDB = shard0.getPrimary().getDB(jsTestName());
diff --git a/src/mongo/db/commands/run_aggregate.cpp b/src/mongo/db/commands/run_aggregate.cpp
index ccf2ef01760..71356f55cda 100644
--- a/src/mongo/db/commands/run_aggregate.cpp
+++ b/src/mongo/db/commands/run_aggregate.cpp
@@ -673,7 +673,9 @@ Status runAggregate(OperationContext* opCtx,
std::vector<NamespaceStringOrUUID> secondaryExecNssList;
// Taking locks over multiple collections is not supported outside of $lookup pushdown.
- if (feature_flags::gFeatureFlagSBELookupPushdown.isEnabledAndIgnoreFCV() &&
+ if (serverGlobalParams.featureCompatibility.isVersionInitialized() &&
+ feature_flags::gFeatureFlagSBELookupPushdown.isEnabled(
+ serverGlobalParams.featureCompatibility) &&
!internalQuerySlotBasedExecutionDisableLookupPushdown.load()) {
secondaryExecNssList = liteParsedPipeline.getForeignExecutionNamespaces();
}
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index 63dfcc1a7e4..03e1d0f77f5 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -157,7 +157,9 @@ std::vector<std::unique_ptr<InnerPipelineStageInterface>> extractSbeCompatibleSt
// sharded and which ones aren't. As such, if any secondary collection is a view or is sharded,
// no $lookup will be eligible for pushdown.
const bool disallowLookupPushdown =
- !feature_flags::gFeatureFlagSBELookupPushdown.isEnabledAndIgnoreFCV() ||
+ !(serverGlobalParams.featureCompatibility.isVersionInitialized() &&
+ feature_flags::gFeatureFlagSBELookupPushdown.isEnabled(
+ serverGlobalParams.featureCompatibility)) ||
internalQuerySlotBasedExecutionDisableLookupPushdown.load() || isMainCollectionSharded ||
collections.isAnySecondaryNamespaceAViewOrSharded();
diff --git a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
index 80334058987..2dd640821e0 100644
--- a/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
+++ b/src/mongo/db/pipeline/process_interface/common_mongod_process_interface.cpp
@@ -434,7 +434,9 @@ CommonMongodProcessInterface::attachCursorSourceToPipelineForLocalRead(Pipeline*
// Reparse 'pipeline' to discover whether there are secondary namespaces that we need to lock
// when constructing our query executor.
std::vector<NamespaceStringOrUUID> secondaryNamespaces = [&]() {
- if (feature_flags::gFeatureFlagSBELookupPushdown.isEnabledAndIgnoreFCV() &&
+ if (serverGlobalParams.featureCompatibility.isVersionInitialized() &&
+ feature_flags::gFeatureFlagSBELookupPushdown.isEnabled(
+ serverGlobalParams.featureCompatibility) &&
!internalQuerySlotBasedExecutionDisableLookupPushdown.load()) {
auto lpp = LiteParsedPipeline(expCtx->ns, pipeline->serializeToBson());
return lpp.getForeignExecutionNamespaces();
diff --git a/src/mongo/db/query/query_feature_flags.idl b/src/mongo/db/query/query_feature_flags.idl
index 8e2632c893a..084d606ff14 100644
--- a/src/mongo/db/query/query_feature_flags.idl
+++ b/src/mongo/db/query/query_feature_flags.idl
@@ -132,7 +132,8 @@ feature_flags:
featureFlagSBELookupPushdown:
description: "Feature flag for allowing SBE $lookup pushdown"
cpp_varname: gFeatureFlagSBELookupPushdown
- default: false
+ default: true
+ version: 6.0
featureFlagSearchShardedFacets:
description: "Enable use of $$SEARCH_META on sharded collections"