diff options
-rw-r--r-- | etc/evergreen.yml | 50 | ||||
-rw-r--r-- | etc/generate_subtasks_config.yml | 4 | ||||
-rw-r--r-- | etc/query.yml | 11 | ||||
-rw-r--r-- | jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js | 23 | ||||
-rw-r--r-- | jstests/libs/sbe_util.js | 17 | ||||
-rw-r--r-- | jstests/noPassthrough/query_knobs_validation.js | 4 | ||||
-rw-r--r-- | jstests/noPassthrough/truncate_large_profiler_entry.js | 3 | ||||
-rw-r--r-- | jstests/noPassthroughWithMongod/group_pushdown.js | 4 | ||||
-rw-r--r-- | src/mongo/db/exec/sbe_cmd.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/pipeline/pipeline_d.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/query/canonical_query.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/canonical_query.h | 8 | ||||
-rw-r--r-- | src/mongo/db/query/classic_plan_cache.h | 6 | ||||
-rw-r--r-- | src/mongo/db/query/get_executor.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache_key_factory.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/query/plan_cache_test.cpp | 25 | ||||
-rw-r--r-- | src/mongo/db/query/query_knobs.idl | 8 | ||||
-rw-r--r-- | src/mongo/dbtests/query_stage_multiplan.cpp | 3 | ||||
-rw-r--r-- | src/mongo/shell/servers.js | 1 |
19 files changed, 82 insertions, 98 deletions
diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 0e57647558a..468bca82a2e 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -8500,7 +8500,6 @@ buildvariants: test_flags: >- --runAllFeatureFlagTests --excludeWithAnyTags=incompatible_with_windows_tls - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" tasks: - name: compile_and_archive_dist_test_then_package_TG distros: @@ -8610,7 +8609,6 @@ buildvariants: test_flags: >- --runAllFeatureFlagTests --excludeWithAnyTags=incompatible_with_windows_tls - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" tasks: - name: compile_and_archive_dist_test_then_package_TG distros: @@ -9393,8 +9391,6 @@ buildvariants: # buildscripts/resmokeconfig/fully_disabled_feature_flags.yml test_flags: >- --runAllFeatureFlagTests - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" - --additionalFeatureFlags=featureFlagSbePlanCache tasks: &enterprise-rhel-80-64-bit-dynamic-all-feature-flags-tasks - name: compile_test_and_package_parallel_core_stream_TG distros: @@ -9489,16 +9485,16 @@ buildvariants: # distros: # - rhel80-large -- &enterprise-rhel-80-64-bit-dynamic-sbe-engine - name: enterprise-rhel-80-64-bit-dynamic-sbe-engine - display_name: "Shared Library Enterprise RHEL 8.0 (SBE Engine)" +- &enterprise-rhel-80-64-bit-dynamic-classic-engine + name: enterprise-rhel-80-64-bit-dynamic-classic-engine + display_name: "Shared Library Enterprise RHEL 8.0 (Classic Engine)" cron: "0 0 * * *" # Every day starting at 00:00 stepback: false modules: - enterprise run_on: - rhel80-small - expansions: &enterprise-rhel-80-64-bit-dynamic-sbe-engine-expansions + expansions: &enterprise-rhel-80-64-bit-dynamic-classic-engine-expansions additional_package_targets: archive-mongocryptd archive-mongocryptd-debug archive-mh archive-mh-debug compile_flags: --ssl MONGO_DISTMOD=rhel80 -j$(grep -c ^processor /proc/cpuinfo) --variables-files=etc/scons/mongodbtoolchain_v3_gcc.vars --link-model=dynamic multiversion_platform: rhel80 @@ -9514,8 +9510,7 @@ buildvariants: burn_in_tag_buildvariants: enterprise-rhel-80-64-bit-inmem linux-64-duroff enterprise-rhel-80-64-bit-multiversion num_scons_link_jobs_available: 0.99 test_flags: >- - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" - --additionalFeatureFlags=featureFlagTimeseriesCollection,featureFlagSbePlanCache + --mongodSetParameters="{internalQueryForceClassicEngine: true}" tasks: - name: .aggfuzzer - name: .aggregation @@ -9731,7 +9726,6 @@ buildvariants: test_flags: >- --excludeWithAnyTags=requires_fcv_51,multiversion_incompatible --runAllFeatureFlagTests - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" - name: rhel-80-64-bit-nossl display_name: "RHEL 8.0 Shared Library (No SSL)" @@ -10535,7 +10529,6 @@ buildvariants: # buildscripts/resmokeconfig/fully_disabled_feature_flags.yml test_flags: >- --runAllFeatureFlagTests - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" tasks: - name: compile_and_archive_dist_test_then_package_TG distros: @@ -11273,7 +11266,6 @@ buildvariants: # buildscripts/resmokeconfig/fully_disabled_feature_flags.yml test_flags: >- --runAllFeatureFlagTests - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" separate_debug: off tasks: - name: compile_and_archive_dist_test_then_package_TG @@ -11323,8 +11315,8 @@ buildvariants: # - name: server_selection_json_test_TG - <<: *ubuntu1804-debug-asan-template - name: ubuntu1804-debug-asan-sbe-engine - display_name: ~ ASAN Enterprise Ubuntu 18.04 DEBUG (SBE Engine) + name: ubuntu1804-debug-asan-classic-engine + display_name: ~ ASAN Enterprise Ubuntu 18.04 DEBUG (Classic Engine) cron: "0 0 * * *" # Every day starting at 00:00 modules: - enterprise @@ -11339,8 +11331,7 @@ buildvariants: san_options: LSAN_OPTIONS="suppressions=etc/lsan.suppressions:report_objects=1:external_symbolizer_path=/opt/mongodbtoolchain/v3/bin/llvm-symbolizer" ASAN_OPTIONS="detect_leaks=1:check_initialization_order=true:strict_init_order=true:abort_on_error=1:disable_coredump=0:handle_abort=1:external_symbolizer_path=/opt/mongodbtoolchain/v3/bin/llvm-symbolizer" compile_flags: --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --dbg=on --opt=on --allocator=system --sanitize=address --ssl --ocsp-stapling=off --enable-free-mon=on -j$(grep -c ^processor /proc/cpuinfo) test_flags: >- - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" - --additionalFeatureFlags=featureFlagSbePlanCache + --mongodSetParameters="{internalQueryForceClassicEngine: true}" --excludeWithAnyTags=requires_fast_memory,requires_ocsp_stapling multiversion_platform: ubuntu1804 multiversion_edition: enterprise @@ -11512,7 +11503,6 @@ buildvariants: test_flags: >- --excludeWithAnyTags=requires_ocsp_stapling --runAllFeatureFlagTests - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" multiversion_platform: ubuntu1804 multiversion_edition: enterprise resmoke_jobs_factor: 0.3 # Avoid starting too many mongod's under UBSAN build. @@ -11564,8 +11554,8 @@ buildvariants: # - name: server_selection_json_test_TG - <<: *ubuntu1804-debug-ubsan-template - name: ubuntu1804-debug-ubsan-sbe-engine - display_name: ~ UBSAN Enterprise Ubuntu 18.04 DEBUG (SBE Engine) + name: ubuntu1804-debug-ubsan-classic-engine + display_name: ~ UBSAN Enterprise Ubuntu 18.04 DEBUG (Classic Engine) cron: "0 0 * * *" # Every day starting at 00:00 modules: - enterprise @@ -11580,8 +11570,7 @@ buildvariants: san_options: UBSAN_OPTIONS="print_stacktrace=1:external_symbolizer_path=/opt/mongodbtoolchain/v3/bin/llvm-symbolizer" compile_flags: --variables-files=etc/scons/mongodbtoolchain_v3_clang.vars --dbg=on --opt=on --sanitize=undefined --ssl --ocsp-stapling=off --enable-free-mon=on -j$(grep -c ^processor /proc/cpuinfo) test_flags: >- - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" - --additionalFeatureFlags=featureFlagSbePlanCache + --mongodSetParameters="{internalQueryForceClassicEngine: true}" --excludeWithAnyTags=requires_ocsp_stapling multiversion_platform: ubuntu1804 multiversion_edition: enterprise @@ -11687,7 +11676,6 @@ buildvariants: test_flags: >- --excludeWithAnyTags=requires_ocsp_stapling --runAllFeatureFlagTests - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" resmoke_jobs_factor: 0.3 # Avoid starting too many mongod's under {A,UB}SAN build. hang_analyzer_dump_core: false scons_cache_scope: shared @@ -12120,19 +12108,18 @@ buildvariants: - windows-vsCurrent-large ### QO & QE Patch-Specific Build Variants ### -- <<: *enterprise-rhel-80-64-bit-dynamic-sbe-engine - name: enterprise-rhel-80-64-bit-dynamic-sbe-engine-query-patch-only - display_name: "~ Shared Library Enterprise RHEL 8.0 Query Patch Only (SBE Execution Engine)" +- <<: *enterprise-rhel-80-64-bit-dynamic-classic-engine + name: enterprise-rhel-80-64-bit-dynamic-classic-engine-query-patch-only + display_name: "~ Shared Library Enterprise RHEL 8.0 Query Patch Only (Classic Engine)" cron: "0 0 * * 0" # Every week starting 00:00 on Sunday . This is a patch-only variant but we run on mainline to pick up task history. expansions: - <<: *enterprise-rhel-80-64-bit-dynamic-sbe-engine-expansions + <<: *enterprise-rhel-80-64-bit-dynamic-classic-engine-expansions jstestfuzz_num_generated_files: 20 jstestfuzz_concurrent_num_files: 5 target_resmoke_time: 30 max_sub_suites: 3 test_flags: >- - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" - --additionalFeatureFlags=featureFlagTimeseriesCollection,featureFlagSbePlanCache,featureFlagSBEGroupPushdown + --mongodSetParameters="{internalQueryForceClassicEngine: true}" --excludeWithAnyTags=resource_intensive # Intentionally derive from SBE to run the SBE tests with all feature flags. @@ -12146,4 +12133,7 @@ buildvariants: jstestfuzz_concurrent_num_files: 5 target_resmoke_time: 30 max_sub_suites: 3 - test_flags: --runAllFeatureFlagTests --excludeWithAnyTags=resource_intensive + test_flags: >- + --runAllFeatureFlagTests + --additionalFeatureFlags=featureFlagSbePlanCache + --excludeWithAnyTags=resource_intensive diff --git a/etc/generate_subtasks_config.yml b/etc/generate_subtasks_config.yml index 6b835b8b79d..c14fa99c7e9 100644 --- a/etc/generate_subtasks_config.yml +++ b/etc/generate_subtasks_config.yml @@ -44,7 +44,7 @@ build_variant_large_distro_exceptions: - ubuntu1604-debug - ubuntu1804-debug-asan - ubuntu1804-debug-asan-all-feature-flags - - ubuntu1804-debug-asan-sbe-engine + - ubuntu1804-debug-asan-classic-engine - ubuntu1804-debug-ubsan - ubuntu1804-debug-ubsan-all-feature-flags - - ubuntu1804-debug-ubsan-sbe-engine + - ubuntu1804-debug-ubsan-classic-engine diff --git a/etc/query.yml b/etc/query.yml index 05a0bb2bae7..4f188133a00 100644 --- a/etc/query.yml +++ b/etc/query.yml @@ -7228,16 +7228,16 @@ modules: buildvariants: -- &enterprise-rhel-80-64-bit-dynamic-sbe-engine - name: enterprise-rhel-80-64-bit-dynamic-sbe-engine - display_name: "Shared Library Enterprise RHEL 8.0 (SBE Engine)" +- &enterprise-rhel-80-64-bit-dynamic-classic-engine + name: enterprise-rhel-80-64-bit-dynamic-classic-engine + display_name: "Shared Library Enterprise RHEL 8.0 (Classic Engine)" batchtime: 480 # 8 hour stepback: false modules: - enterprise run_on: - rhel80-small - expansions: &enterprise-rhel-80-64-bit-dynamic-sbe-engine-expansions + expansions: &enterprise-rhel-80-64-bit-dynamic-classic-engine-expansions additional_package_targets: archive-mongocryptd archive-mongocryptd-debug archive-mh archive-mh-debug compile_flags: --ssl MONGO_DISTMOD=rhel80 -j$(grep -c ^processor /proc/cpuinfo) --variables-files=etc/scons/mongodbtoolchain_v3_gcc.vars --link-model=dynamic multiversion_platform: rhel80 @@ -7251,8 +7251,7 @@ buildvariants: large_distro_name: rhel80-medium num_scons_link_jobs_available: 0.99 test_flags: >- - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" - --additionalFeatureFlags=featureFlagTimeseriesCollection,featureFlagSbePlanCache + --mongodSetParameters="{internalQueryForceClassicEngine: true}" tasks: - name: compile_and_archive_dist_test_TG distros: diff --git a/jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js b/jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js index 4afccfa7d54..e6ef9570291 100644 --- a/jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js +++ b/jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js @@ -1,7 +1,7 @@ 'use strict'; /** - * Sets the internalQueryEnableSlotBasedExecutionEngine flag to true and false, and + * Sets the internalQueryForceClassicEngine flag to true and false, and * asserts that find queries using the plan cache produce the correct results. * * @tags: [ @@ -19,7 +19,7 @@ var $config = (function() { } cluster.executeOnMongodNodes(function(db) { - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false}); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true}); }); for (let i = 0; i < 10; ++i) { @@ -33,11 +33,10 @@ var $config = (function() { let states = (function() { function init(db, coll) { - const originalParamValue = db.adminCommand( - {getParameter: 1, "internalQueryEnableSlotBasedExecutionEngine": 1}); + const originalParamValue = + db.adminCommand({getParameter: 1, "internalQueryForceClassicEngine": 1}); assertAlways.commandWorked(originalParamValue); - this.originalParamValue = - originalParamValue.internalQueryEnableSlotBasedExecutionEngine; + this.originalParamValue = originalParamValue.internalQueryForceClassicEngine; if (!checkSBEEnabled(db)) { return; @@ -50,8 +49,8 @@ var $config = (function() { return; } - assertAlways.commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); + assertAlways.commandWorked( + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); } function toggleSBESwitchOff(db, coll) { @@ -59,8 +58,8 @@ var $config = (function() { return; } - assertAlways.commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); + assertAlways.commandWorked( + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); } function runQueriesAndCheckResults(db, coll) { @@ -137,8 +136,8 @@ var $config = (function() { function teardown(db, coll, cluster) { const setParam = this.originalParamValue; cluster.executeOnMongodNodes(function(db) { - assertAlways.commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: setParam})); + assertAlways.commandWorked( + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: setParam})); }); } diff --git a/jstests/libs/sbe_util.js b/jstests/libs/sbe_util.js index 89cf6af7aef..a47aa3a1130 100644 --- a/jstests/libs/sbe_util.js +++ b/jstests/libs/sbe_util.js @@ -10,7 +10,7 @@ load("jstests/libs/fixture_helpers.js"); // For 'isMongos' * sharded clusters, SBE is either enabled on each node, or disabled on each node. */ function checkSBEEnabled(theDB) { - let checkResult = false; + let checkResult = true; assert.soon(() => { // Some test suites kill the primary, potentially resulting in networking errors. We use: @@ -23,8 +23,8 @@ function checkSBEEnabled(theDB) { return false; } - // Find a non-mongos node and check whether its SBE feature flag is on. We assume either all - // nodes in the cluster have SBE on or none. + // Find a non-mongos node and check whether its forceClassicEngine flag is on. We + // assume either all nodes in the cluster have SBE disabled or none. for (const node of nodes) { try { const conn = new Mongo(node); @@ -32,11 +32,12 @@ function checkSBEEnabled(theDB) { continue; } - const getParam = conn.adminCommand( - {getParameter: 1, internalQueryEnableSlotBasedExecutionEngine: 1}); - checkResult = - getParam.hasOwnProperty("internalQueryEnableSlotBasedExecutionEngine") && - getParam.internalQueryEnableSlotBasedExecutionEngine; + const getParam = + conn.adminCommand({getParameter: 1, internalQueryForceClassicEngine: 1}); + if (getParam.hasOwnProperty("internalQueryForceClassicEngine") && + getParam.internalQueryForceClassicEngine) { + checkResult = false; + } return true; } catch (e) { continue; diff --git a/jstests/noPassthrough/query_knobs_validation.js b/jstests/noPassthrough/query_knobs_validation.js index 4a1f25c55a7..f7c9f52183d 100644 --- a/jstests/noPassthrough/query_knobs_validation.js +++ b/jstests/noPassthrough/query_knobs_validation.js @@ -198,8 +198,8 @@ assertSetParameterSucceeds("internalQuerySlotBasedExecutionMaxStaticIndexScanInt assertSetParameterFails("internalQuerySlotBasedExecutionMaxStaticIndexScanIntervals", 0); assertSetParameterFails("internalQuerySlotBasedExecutionMaxStaticIndexScanIntervals", -1); -assertSetParameterSucceeds("internalQueryEnableSlotBasedExecutionEngine", true); -assertSetParameterSucceeds("internalQueryEnableSlotBasedExecutionEngine", false); +assertSetParameterSucceeds("internalQueryForceClassicEngine", true); +assertSetParameterSucceeds("internalQueryForceClassicEngine", false); MongoRunner.stopMongod(conn); })(); diff --git a/jstests/noPassthrough/truncate_large_profiler_entry.js b/jstests/noPassthrough/truncate_large_profiler_entry.js index 1cf05c27d45..15cdbee5e44 100644 --- a/jstests/noPassthrough/truncate_large_profiler_entry.js +++ b/jstests/noPassthrough/truncate_large_profiler_entry.js @@ -5,8 +5,7 @@ (function() { "use strict"; -const conn = - MongoRunner.runMongod({setParameter: "internalQueryEnableSlotBasedExecutionEngine=true"}); +const conn = MongoRunner.runMongod(); assert.neq(null, conn, "mongod was unable to startup"); const db = conn.getDB("test"); const collName = jsTestName(); diff --git a/jstests/noPassthroughWithMongod/group_pushdown.js b/jstests/noPassthroughWithMongod/group_pushdown.js index a00d82ea7b9..2f036a0f291 100644 --- a/jstests/noPassthroughWithMongod/group_pushdown.js +++ b/jstests/noPassthroughWithMongod/group_pushdown.js @@ -48,7 +48,7 @@ let assertResultsMatchWithAndWithoutPushdown = function( assertGroupPushdown(coll, pipeline, expectedResults, expectedGroupCountInExplain); // Turn sbe off. - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false}); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true}); // Sanity check the results when no pushdown happens. let resultNoGroupPushdown = coll.aggregate(pipeline).toArray(); @@ -56,7 +56,7 @@ let assertResultsMatchWithAndWithoutPushdown = function( // Turn sbe on which will allow $group stages that contain supported accumulators to be pushed // down under certain conditions. - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true}); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false}); let resultWithGroupPushdown = coll.aggregate(pipeline).toArray(); assert.sameMembers(resultNoGroupPushdown, resultWithGroupPushdown); diff --git a/src/mongo/db/exec/sbe_cmd.cpp b/src/mongo/db/exec/sbe_cmd.cpp index ce04a5a2bbe..a2c929354ba 100644 --- a/src/mongo/db/exec/sbe_cmd.cpp +++ b/src/mongo/db/exec/sbe_cmd.cpp @@ -70,7 +70,7 @@ public: // If SBE is disabled, then also disallow the SBE command. uassert(5772200, "the SBE command requires the SBE engine to be enabled", - internalQueryEnableSlotBasedExecutionEngine.load()); + !internalQueryForceClassicEngine.load()); // The SBE command may read from multiple collections, but no logic is in place to acquire // locks on all of the necessary collections and databases. Therefore, its implementation diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index 7453196a905..dfc8d2abedb 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -102,7 +102,7 @@ namespace { * Extracts a prefix of 'DocumentSourceGroup' stages from the given pipeline to prepare for * pushdown of $group into the inner query layer so that it can be executed using SBE. Group stages * are extracted from the pipeline under when all of the following conditions are met: - * 0. When the 'internalQueryEnableSlotBasedExecutionEngine' feature flag is 'true'. + * 0. When the 'internalQueryForceClassicEngine' feature flag is 'false'. * 1. When 'allowDiskUse' is false. We currently don't support spilling in the SBE HashAgg * stage. This will change once that is supported when SERVER-58436 is complete. * 2. When there's only a single index other than the implicit '_id' index on the provided @@ -139,7 +139,7 @@ std::vector<std::unique_ptr<InnerPipelineStageInterface>> extractSbeCompatibleGr if (!feature_flags::gFeatureFlagSBEGroupPushdown.isEnabled( serverGlobalParams.featureCompatibility) || - !cq->getEnableSlotBasedExecutionEngine() || expCtx->allowDiskUse || !isSingleIndex || + cq->getForceClassicEngine() || expCtx->allowDiskUse || !isSingleIndex || queryNeedsSubplanning) { return {}; } diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp index a2a74e2dfaf..e883263681b 100644 --- a/src/mongo/db/query/canonical_query.cpp +++ b/src/mongo/db/query/canonical_query.cpp @@ -196,7 +196,7 @@ Status CanonicalQuery::init(OperationContext* opCtx, _findCommand = std::move(findCommand); _canHaveNoopMatchNodes = canHaveNoopMatchNodes; - _enableSlotBasedExecutionEngine = internalQueryEnableSlotBasedExecutionEngine.load(); + _forceClassicEngine = internalQueryForceClassicEngine.load(); auto validStatus = isValid(root.get(), *_findCommand); if (!validStatus.isOK()) { diff --git a/src/mongo/db/query/canonical_query.h b/src/mongo/db/query/canonical_query.h index 49e2858f11e..179ac2cd8f4 100644 --- a/src/mongo/db/query/canonical_query.h +++ b/src/mongo/db/query/canonical_query.h @@ -213,8 +213,8 @@ public: return _explain; } - bool getEnableSlotBasedExecutionEngine() const { - return _enableSlotBasedExecutionEngine; + bool getForceClassicEngine() const { + return _forceClassicEngine; } void setExplain(bool explain) { @@ -273,8 +273,8 @@ private: bool _explain = false; - // Determines whether the SBE engine is enabled. - bool _enableSlotBasedExecutionEngine = false; + // Determines whether the classic engine must be used. + bool _forceClassicEngine = false; }; } // namespace mongo diff --git a/src/mongo/db/query/classic_plan_cache.h b/src/mongo/db/query/classic_plan_cache.h index daeca87857e..b0806b4b187 100644 --- a/src/mongo/db/query/classic_plan_cache.h +++ b/src/mongo/db/query/classic_plan_cache.h @@ -45,11 +45,11 @@ class PlanCacheKey { public: PlanCacheKey(CanonicalQuery::QueryShapeString shapeString, std::string indexabilityString, - bool enableSlotBasedExecution) { + bool forceClassicEngine) { _lengthOfStablePart = shapeString.size(); _key = std::move(shapeString); _key += indexabilityString; - _key += enableSlotBasedExecution ? "t" : "f"; + _key += forceClassicEngine ? "t" : "f"; } CanonicalQuery::QueryShapeString getStableKey() const { @@ -102,7 +102,7 @@ public: private: // Key is broken into three parts: - // <stable key> | <indexability discriminators> | <enableSlotBasedExecution boolean> + // <stable key> | <indexability discriminators> | <forceClassicEngine boolean> // This third part can be removed once the classic query engine reaches EOL and SBE is used // exclusively for all query execution. Combined, the three parts make up the plan cache key. // We store them in one std::string so that we can easily/cheaply extract the stable key. diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index 200b570f56b..8f3026d942f 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -1173,7 +1173,7 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutor( std::function<void(CanonicalQuery*)> extractAndAttachPipelineStages, PlanYieldPolicy::YieldPolicy yieldPolicy, size_t plannerOptions) { - return canonicalQuery->getEnableSlotBasedExecutionEngine() && + return !canonicalQuery->getForceClassicEngine() && isQuerySbeCompatible(opCtx, canonicalQuery.get(), plannerOptions) ? getSlotBasedExecutor(opCtx, collection, diff --git a/src/mongo/db/query/plan_cache_key_factory.cpp b/src/mongo/db/query/plan_cache_key_factory.cpp index 1341ef06d3a..857508c1038 100644 --- a/src/mongo/db/query/plan_cache_key_factory.cpp +++ b/src/mongo/db/query/plan_cache_key_factory.cpp @@ -84,8 +84,7 @@ PlanCacheKey make(const CanonicalQuery& query, CollectionQueryInfo::get(collection).getPlanCacheIndexabilityState(), &indexabilityKeyBuilder); - return PlanCacheKey( - shapeString, indexabilityKeyBuilder.str(), query.getEnableSlotBasedExecutionEngine()); + return PlanCacheKey(shapeString, indexabilityKeyBuilder.str(), !query.getForceClassicEngine()); } sbe::PlanCacheKey make(const CanonicalQuery& query, diff --git a/src/mongo/db/query/plan_cache_test.cpp b/src/mongo/db/query/plan_cache_test.cpp index f3ae88d7f11..6ed04e13f73 100644 --- a/src/mongo/db/query/plan_cache_test.cpp +++ b/src/mongo/db/query/plan_cache_test.cpp @@ -79,7 +79,7 @@ PlanCacheKey makeKey(const CanonicalQuery& cq, const std::vector<CoreIndexInfo>& StringBuilder indexabilityKeyBuilder; plan_cache_detail::encodeIndexability(cq.root(), indexabilityState, &indexabilityKeyBuilder); - return {cq.encodeKey(), indexabilityKeyBuilder.str(), cq.getEnableSlotBasedExecutionEngine()}; + return {cq.encodeKey(), indexabilityKeyBuilder.str(), !cq.getForceClassicEngine()}; } /** @@ -226,11 +226,11 @@ void assertPlanCacheKeysUnequalDueToDiscriminators(const PlanCacheKey& a, const } /** - * Check that the stable keys of 'a' and 'b' are equal, but the 'enableSlotBasedExecutionEngine' + * Check that the stable keys of 'a' and 'b' are equal, but the 'forceClassicEngine' * values are not. */ -void assertPlanCacheKeysUnequalDueToEnableSlotBasedExecutionEngineValue(const PlanCacheKey& a, - const PlanCacheKey& b) { +void assertPlanCacheKeysUnequalDueToForceClassicEngineValue(const PlanCacheKey& a, + const PlanCacheKey& b) { ASSERT_EQ(a.getStableKeyStringData(), b.getStableKeyStringData()); auto aUnstablePart = a.getUnstablePart(); auto bUnstablePart = b.getUnstablePart(); @@ -1332,9 +1332,7 @@ protected: }; const std::string mockKey("mock_cache_key"); -const PlanCacheKey CachePlanSelectionTest::ck(mockKey, - "", - internalQueryEnableSlotBasedExecutionEngine.load()); +const PlanCacheKey CachePlanSelectionTest::ck(mockKey, "", internalQueryForceClassicEngine.load()); // // Equality @@ -2656,21 +2654,20 @@ TEST(PlanCacheTest, DifferentQueryEngines) { false, // sparse IndexEntry::Identifier{""})}; // name - // Helper to construct a plan cache key given the 'enableSlotBasedExecutionEngine' flag. - auto constructPlanCacheKey = [&](bool enableSlotBasedExecutionEngine) { - RAIIServerParameterControllerForTest controller{ - "internalQueryEnableSlotBasedExecutionEngine", enableSlotBasedExecutionEngine}; + // Helper to construct a plan cache key given the 'forceClassicEngine' flag. + auto constructPlanCacheKey = [&](bool forceClassicEngine) { + RAIIServerParameterControllerForTest controller{"internalQueryForceClassicEngine", + forceClassicEngine}; const auto queryStr = "{a: 0}"; unique_ptr<CanonicalQuery> cq(canonicalize(queryStr)); return makeKey(*cq, indexCores); }; const auto classicEngineKey = constructPlanCacheKey(false); - const auto slotBasedExecutionEngineKey = constructPlanCacheKey(true); + const auto noClassicEngineKey = constructPlanCacheKey(true); // Check that the two plan cache keys are not equal because the plans were created under // different engines. - assertPlanCacheKeysUnequalDueToEnableSlotBasedExecutionEngineValue(classicEngineKey, - slotBasedExecutionEngineKey); + assertPlanCacheKeysUnequalDueToForceClassicEngineValue(classicEngineKey, noClassicEngineKey); } } // namespace diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl index 26445055af4..75a80dc3eee 100644 --- a/src/mongo/db/query/query_knobs.idl +++ b/src/mongo/db/query/query_knobs.idl @@ -500,11 +500,11 @@ server_parameters: validator: gt: 0 - internalQueryEnableSlotBasedExecutionEngine: - description: "If true, the system will use the SBE execution engine for eligible queries, - otherwise all queries will execute using the classic execution engine." + internalQueryForceClassicEngine: + description: "If true, the system will use the classic execution engine for all queries, + otherwise eligible queries will execute using the SBE execution engine." set_at: [ startup, runtime ] - cpp_varname: "internalQueryEnableSlotBasedExecutionEngine" + cpp_varname: "internalQueryForceClassicEngine" cpp_vartype: AtomicWord<bool> default: false diff --git a/src/mongo/dbtests/query_stage_multiplan.cpp b/src/mongo/dbtests/query_stage_multiplan.cpp index a2682723b63..eaf04add3f1 100644 --- a/src/mongo/dbtests/query_stage_multiplan.cpp +++ b/src/mongo/dbtests/query_stage_multiplan.cpp @@ -551,8 +551,7 @@ TEST_F(QueryStageMultiPlanTest, MPSExplainAllPlans) { // // This is a regression test for SERVER-20111. TEST_F(QueryStageMultiPlanTest, MPSSummaryStats) { - RAIIServerParameterControllerForTest controller("internalQueryEnableSlotBasedExecutionEngine", - false); + RAIIServerParameterControllerForTest controller("internalQueryForceClassicEngine", true); const int N = 5000; for (int i = 0; i < N; ++i) { diff --git a/src/mongo/shell/servers.js b/src/mongo/shell/servers.js index eb03c09ebae..8a9da3d4b34 100644 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -694,6 +694,7 @@ MongoRunner.mongodOptions = function(opts = {}) { opts, "enableDefaultWriteConcernUpdatesForInitiate", "5.0.0"); _removeSetParameterIfBeforeVersion(opts, "enableReconfigRollbackCommittedWritesCheck", "5.0.0"); _removeSetParameterIfBeforeVersion(opts, "featureFlagRetryableFindAndModify", "5.0.0"); + _removeSetParameterIfBeforeVersion(opts, "internalQueryForceClassicEngine", "5.1.0"); if (!opts.logFile && opts.useLogFiles) { opts.logFile = opts.dbpath + "/mongod.log"; |