diff options
author | Mihai Andrei <mihai.andrei@10gen.com> | 2022-05-19 15:33:37 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-05-19 16:41:34 +0000 |
commit | 89945d5b9581f1baadc78a46fd87a07c090d053c (patch) | |
tree | 222f15736146298ef637682f2b05994577d1246a | |
parent | 3805148358ae9b82e5f3b9307bd25fbf7a4dd4b5 (diff) | |
download | mongo-89945d5b9581f1baadc78a46fd87a07c090d053c.tar.gz |
SERVER-66551 Rename internalQueryEnableSlotBasedExecutionEngine back to internalQueryForceClassicEngine
31 files changed, 129 insertions, 180 deletions
diff --git a/buildscripts/resmokeconfig/suites/clustered_collection_passthrough.yml b/buildscripts/resmokeconfig/suites/clustered_collection_passthrough.yml index d1ce985bcdf..e52a1a9d0a4 100644 --- a/buildscripts/resmokeconfig/suites/clustered_collection_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/clustered_collection_passthrough.yml @@ -92,6 +92,6 @@ executor: set_parameters: enableTestCommands: 1 # SBE is not compatible with clustered collections - internalQueryEnableSlotBasedExecutionEngine: 0 + internalQueryForceClassicEngine: 1 failpoint.clusterAllCollectionsByDefault: "{mode: 'alwaysOn'}" num_nodes: 2 diff --git a/etc/evergreen.yml b/etc/evergreen.yml index 3843019dc70..e76fe7adb91 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -1644,7 +1644,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}" + --mongodSetParameters="{internalQueryForceClassicEngine: false}" tasks: - name: .aggfuzzer - name: .aggregation @@ -2354,7 +2354,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}" + --mongodSetParameters="{internalQueryForceClassicEngine: false}" --excludeWithAnyTags=requires_fast_memory,requires_ocsp_stapling multiversion_platform: rhel80 multiversion_edition: enterprise @@ -2509,7 +2509,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}" + --mongodSetParameters="{internalQueryForceClassicEngine: false}" --excludeWithAnyTags=requires_ocsp_stapling multiversion_platform: rhel80 multiversion_edition: enterprise @@ -3055,7 +3055,7 @@ buildvariants: target_resmoke_time: 30 max_sub_suites: 3 test_flags: >- - --mongodSetParameters="{internalQueryEnableSlotBasedExecutionEngine: true}" + --mongodSetParameters="{internalQueryForceClassicEngine: false}" --excludeWithAnyTags=resource_intensive # Intentionally derive from SBE to run the SBE tests with all feature flags. diff --git a/jstests/concurrency/fsm_workloads/agg_lookup.js b/jstests/concurrency/fsm_workloads/agg_lookup.js index 73a930eb35b..9395c503d3c 100644 --- a/jstests/concurrency/fsm_workloads/agg_lookup.js +++ b/jstests/concurrency/fsm_workloads/agg_lookup.js @@ -74,7 +74,7 @@ var $config = (function() { getParameter: 1, featureFlagShardedLookup: 1, featureFlagSBELookupPushdown: 1, - internalQueryEnableSlotBasedExecutionEngine: 1 + internalQueryForceClassicEngine: 1 }); const isShardedLookupEnabled = getParam.hasOwnProperty("featureFlagShardedLookup") && getParam.featureFlagShardedLookup.value; @@ -97,9 +97,9 @@ var $config = (function() { assertWhenOwnColl.eq(this.numDocs, db[collName].find().itcount()); const isLookupPushdownEnabled = getParam.hasOwnProperty("featureFlagSBELookupPushdown") && - getParam.hasOwnProperty("internalQueryEnableSlotBasedExecutionEngine") && + getParam.hasOwnProperty("internalQueryForceClassicEngine") && getParam.featureFlagSBELookupPushdown.value && - getParam.internalQueryEnableSlotBasedExecutionEngine.value; + !getParam.internalQueryForceClassicEngine.value; this.allowDiskUse = true; // If $lookup pushdown into SBE is enabled, we select a random join algorithm to use and diff --git a/jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js b/jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js index b284b75b9e8..51e421f3e26 100644 --- a/jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js +++ b/jstests/concurrency/fsm_workloads/find_flip_sbe_enabled.js @@ -1,8 +1,8 @@ 'use strict'; /** - * Sets the internalQueryEnableSlotBasedExecutionEngine flag to true and false, and - * asserts that find queries using the plan cache produce the correct results. + * Sets the internalQueryForceClassicEngine flag to true and false, and asserts that find queries + * using the plan cache produce the correct results. * * @tags: [ * # Our test infrastructure prevents tests which use the 'setParameter' command from running in @@ -20,10 +20,10 @@ var $config = (function() { function setup(db, collName, cluster) { const originalParamValue = - db.adminCommand({getParameter: 1, internalQueryEnableSlotBasedExecutionEngine: 1}); + db.adminCommand({getParameter: 1, internalQueryForceClassicEngine: 1}); assertAlways.commandWorked(originalParamValue); - assert(originalParamValue.hasOwnProperty("internalQueryEnableSlotBasedExecutionEngine")); - this.originalParamValue = originalParamValue.internalQueryEnableSlotBasedExecutionEngine; + assert(originalParamValue.hasOwnProperty("internalQueryForceClassicEngine")); + this.originalParamValue = originalParamValue.internalQueryForceClassicEngine; const coll = db.getCollection(getCollectionName(collName)); for (let i = 0; i < 10; ++i) { assertAlways.commandWorked( @@ -35,14 +35,14 @@ var $config = (function() { } let states = (function() { - function setEnableSlotBasedExecutionEngineOn(db, collName) { - assertAlways.commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); + function setForceClassicEngineOn(db, collName) { + assertAlways.commandWorked( + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); } - function setEnableSlotBasedExecutionEngineOff(db, collName) { - assertAlways.commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); + function setForceClassicEngineOff(db, collName) { + assertAlways.commandWorked( + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); } function runQueriesAndCheckResults(db, collName) { @@ -77,8 +77,8 @@ var $config = (function() { } return { - setEnableSlotBasedExecutionEngineOn: setEnableSlotBasedExecutionEngineOn, - setEnableSlotBasedExecutionEngineOff: setEnableSlotBasedExecutionEngineOff, + setForceClassicEngineOn: setForceClassicEngineOn, + setForceClassicEngineOff: setForceClassicEngineOff, runQueriesAndCheckResults: runQueriesAndCheckResults, createIndex: createIndex, dropIndex: dropIndex @@ -86,36 +86,36 @@ var $config = (function() { })(); let transitions = { - setEnableSlotBasedExecutionEngineOn: { - setEnableSlotBasedExecutionEngineOn: 0.1, - setEnableSlotBasedExecutionEngineOff: 0.1, + setForceClassicEngineOn: { + setForceClassicEngineOn: 0.1, + setForceClassicEngineOff: 0.1, runQueriesAndCheckResults: 0.8 }, - setEnableSlotBasedExecutionEngineOff: { - setEnableSlotBasedExecutionEngineOn: 0.1, - setEnableSlotBasedExecutionEngineOff: 0.1, + setForceClassicEngineOff: { + setForceClassicEngineOn: 0.1, + setForceClassicEngineOff: 0.1, runQueriesAndCheckResults: 0.8 }, runQueriesAndCheckResults: { - setEnableSlotBasedExecutionEngineOn: 0.1, - setEnableSlotBasedExecutionEngineOff: 0.1, + setForceClassicEngineOn: 0.1, + setForceClassicEngineOff: 0.1, runQueriesAndCheckResults: 0.78, createIndex: 0.02, }, createIndex: { - setEnableSlotBasedExecutionEngineOn: 0.1, - setEnableSlotBasedExecutionEngineOff: 0.1, + setForceClassicEngineOn: 0.1, + setForceClassicEngineOff: 0.1, runQueriesAndCheckResults: 0.78, createIndex: 0.01, dropIndex: 0.01 }, dropIndex: { - setEnableSlotBasedExecutionEngineOn: 0.1, - setEnableSlotBasedExecutionEngineOff: 0.1, + setForceClassicEngineOn: 0.1, + setForceClassicEngineOff: 0.1, runQueriesAndCheckResults: 0.78, createIndex: 0.02, } @@ -125,15 +125,15 @@ var $config = (function() { // Restore the original state of the ForceClassicEngine parameter. const setParam = this.originalParamValue; cluster.executeOnMongodNodes(function(db) { - assertAlways.commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: setParam})); + assertAlways.commandWorked( + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: setParam})); }); } return { threadCount: 10, iterations: 100, - startState: 'setEnableSlotBasedExecutionEngineOn', + startState: 'setForceClassicEngineOff', states: states, transitions: transitions, setup: setup, diff --git a/jstests/libs/sbe_util.js b/jstests/libs/sbe_util.js index fe623fe6d7e..faed62238d9 100644 --- a/jstests/libs/sbe_util.js +++ b/jstests/libs/sbe_util.js @@ -24,8 +24,8 @@ function checkSBEEnabled(theDB, featureFlags = []) { return false; } - // Find a non-mongos node and check whether its SBE flag is on. We assume either - // all nodes in the cluster have SBE disabled 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); @@ -38,14 +38,15 @@ function checkSBEEnabled(theDB, featureFlags = []) { internalQueryForceClassicEngine: 1, internalQueryEnableSlotBasedExecutionEngine: 1 }); - if (getParam.hasOwnProperty("internalQueryEnableSlotBasedExecutionEngine") && - getParam.internalQueryEnableSlotBasedExecutionEngine) { + + if (getParam.hasOwnProperty("internalQueryForceClassicEngine") && + !getParam.internalQueryForceClassicEngine) { checkResult = true; } // Some versions use a different parameter to disable SBE instead of enabling it. - if (getParam.hasOwnProperty("internalQueryForceClassicEngine") && - !getParam.internalQueryForceClassicEngine) { + if (getParam.hasOwnProperty("internalQueryEnableSlotBasedExecutionEngine") && + getParam.internalQueryEnableSlotBasedExecutionEngine) { checkResult = true; } diff --git a/jstests/noPassthrough/accumulator_bug_fix.js b/jstests/noPassthrough/accumulator_bug_fix.js index 73bd312acda..5c044c151f0 100644 --- a/jstests/noPassthrough/accumulator_bug_fix.js +++ b/jstests/noPassthrough/accumulator_bug_fix.js @@ -26,7 +26,7 @@ // Turns on the classical engine. assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); const pipeline = [{$group: {_id: "$k", o: accSpec}}, {$group: {_id: "$o"}}]; @@ -75,13 +75,13 @@ // Turns on the classical engine. assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); const classicRes = assert.commandWorked(db.runCommand(aggCmd)).cursor.firstBatch; assert.eq(classicRes, expectedRes, testDesc); // Turns off the classical engine. assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); const sbeRes = assert.commandWorked(db.runCommand(aggCmd)).cursor.firstBatch; assert.eq(sbeRes, expectedRes, testDesc); }; @@ -211,20 +211,20 @@ let verifyShardedAccumulatorResultsOnBothEngine = (testDesc, coll, pipeline, expectedRes) => { // Turns to the classic engine at the shards. - assert.commandWorked(dbAtShard0.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); - assert.commandWorked(dbAtShard1.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); + assert.commandWorked( + dbAtShard0.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); + assert.commandWorked( + dbAtShard1.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); // Verifies that the classic engine's results are same as the expected results. const classicRes = coll.aggregate(pipeline).toArray(); assert.eq(classicRes, expectedRes, testDesc); // Turns to the SBE engine at the shards. - assert.commandWorked(dbAtShard0.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); - assert.commandWorked(dbAtShard1.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); + assert.commandWorked( + dbAtShard0.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); + assert.commandWorked( + dbAtShard1.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); // Verifies that the SBE engine's results are same as the expected results. const sbeRes = coll.aggregate(pipeline).toArray(); diff --git a/jstests/noPassthrough/agg_group.js b/jstests/noPassthrough/agg_group.js index 885c43852d2..234237baf72 100644 --- a/jstests/noPassthrough/agg_group.js +++ b/jstests/noPassthrough/agg_group.js @@ -42,8 +42,8 @@ st.ensurePrimaryShard(db.getName(), st.shard0.shardName); let assertShardedGroupResultsMatch = (coll, pipeline) => { // Turns to the classic engine at the shard before figuring out its result. - assert.commandWorked(dbAtShard.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); + assert.commandWorked( + dbAtShard.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); // Collects the classic engine's result as the expected result, executing the pipeline at the // mongos. @@ -52,8 +52,8 @@ let assertShardedGroupResultsMatch = (coll, pipeline) => { .cursor.firstBatch; // Turns to the SBE engine at the shard. - assert.commandWorked(dbAtShard.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); + assert.commandWorked( + dbAtShard.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); // Verifies that the SBE engine's results are same as the expected results, executing the // pipeline at the mongos. diff --git a/jstests/noPassthrough/profile_operation_metrics.js b/jstests/noPassthrough/profile_operation_metrics.js index 5ef83ba6d61..41da73e9e50 100644 --- a/jstests/noPassthrough/profile_operation_metrics.js +++ b/jstests/noPassthrough/profile_operation_metrics.js @@ -20,15 +20,13 @@ const isDebugBuild = (db) => { return db.adminCommand('buildInfo').debug; }; const isGroupPushdownEnabled = (db) => { - const internalQueryEnableSlotBasedExecutionEngine = - assert - .commandWorked( - db.adminCommand({getParameter: 1, internalQueryEnableSlotBasedExecutionEngine: 1})) - .internalQueryEnableSlotBasedExecutionEngine; + const internalQueryForceClassicEngine = + assert.commandWorked(db.adminCommand({getParameter: 1, internalQueryForceClassicEngine: 1})) + .internalQueryForceClassicEngine; const featureFlagSBEGroupPushdown = assert.commandWorked(db.adminCommand({getParameter: 1, featureFlagSBEGroupPushdown: 1})) .featureFlagSBEGroupPushdown.value; - return internalQueryEnableSlotBasedExecutionEngine && featureFlagSBEGroupPushdown; + return !internalQueryForceClassicEngine && featureFlagSBEGroupPushdown; }; const assertMetricsExist = (profilerEntry) => { diff --git a/jstests/noPassthrough/query_engine_stats.js b/jstests/noPassthrough/query_engine_stats.js index 3e6b0ebe938..492b4792efe 100644 --- a/jstests/noPassthrough/query_engine_stats.js +++ b/jstests/noPassthrough/query_engine_stats.js @@ -107,8 +107,7 @@ function compareQueryEngineCounters(expectedCounters) { } // Start with SBE off. -assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); +assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); // Run a find command. let expectedCounters = generateExpectedCounters(engine.find.classic); @@ -143,8 +142,7 @@ compareQueryEngineCounters(expectedCounters); verifyProfiler(queryComment, engine.find.classic); // Turn SBE on. -assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); +assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); // Run a find command. expectedCounters = generateExpectedCounters(engine.find.sbe); diff --git a/jstests/noPassthrough/query_knobs_validation.js b/jstests/noPassthrough/query_knobs_validation.js index cb76a691934..d5636ebadaf 100644 --- a/jstests/noPassthrough/query_knobs_validation.js +++ b/jstests/noPassthrough/query_knobs_validation.js @@ -216,8 +216,8 @@ assertSetParameterSucceeds("internalQuerySlotBasedExecutionMaxStaticIndexScanInt assertSetParameterFails("internalQuerySlotBasedExecutionMaxStaticIndexScanIntervals", 0); assertSetParameterFails("internalQuerySlotBasedExecutionMaxStaticIndexScanIntervals", -1); -assertSetParameterSucceeds("internalQueryEnableSlotBasedExecutionEngine", true); -assertSetParameterSucceeds("internalQueryEnableSlotBasedExecutionEngine", false); +assertSetParameterSucceeds("internalQueryForceClassicEngine", true); +assertSetParameterSucceeds("internalQueryForceClassicEngine", false); assertSetParameterSucceeds("internalQueryCollectionMaxNoOfDocumentsToChooseHashJoin", 1); assertSetParameterFails("internalQueryCollectionMaxNoOfDocumentsToChooseHashJoin", 0); diff --git a/jstests/noPassthrough/sbe_multiplanner_trial_termination.js b/jstests/noPassthrough/sbe_multiplanner_trial_termination.js index 2d77b962467..75739587a9f 100644 --- a/jstests/noPassthrough/sbe_multiplanner_trial_termination.js +++ b/jstests/noPassthrough/sbe_multiplanner_trial_termination.js @@ -54,8 +54,7 @@ assert.commandWorked(db.adminCommand({setParameter: 1, [worksKnob]: trialLengthF // Force the classic engine and run an "allPlansExecution" verbosity explain. Confirm that the trial // period terminates based on the the "collection fraction" as opposed to // 'internalQueryPlanEvaluationWorks'. -assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); +assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); let allPlans = getAllPlansExecution("1"); for (let plan of allPlans) { assert(plan.hasOwnProperty("executionStages"), plan); @@ -93,8 +92,7 @@ assert.gt(getParamRes[worksKnobSbe], numDocs); // default value of SBE's works knob exceeds the size of the collection, we expect the number of // reads to exceed the collection size as well. By construction of the test, this also means that // the trial period length exceeds both 'trialLengthFromCollFrac' and 'trialLengthFromWorksKnob'. -assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); +assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); allPlans = getAllPlansExecution("2"); verifySbeNumReads(allPlans, numDocs, assert.gt); diff --git a/jstests/noPassthrough/sbe_plan_cache_key_reporting.js b/jstests/noPassthrough/sbe_plan_cache_key_reporting.js index 5c39ec6362e..940b199dc27 100644 --- a/jstests/noPassthrough/sbe_plan_cache_key_reporting.js +++ b/jstests/noPassthrough/sbe_plan_cache_key_reporting.js @@ -42,7 +42,7 @@ function runTestAgainstSbeAndClassicEngines(testToRun) { return ["sbe", "classic"].map((engine) => { setupCollection(); assert.commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: engine === "sbe"})); + {setParameter: 1, internalQueryForceClassicEngine: engine === "classic"})); return testToRun(engine); }); } @@ -193,7 +193,7 @@ function assertQueryHashAndPlanCacheKey(sbe, classic) { assert.eq(classic.explainVersion, "1", classic); // The query hashes and the plan cache keys ('the keys') are different now because - // 'internalQueryEnableSlotBasedExecutionEngine' flag is encoded into query shape, once this + // 'internalQueryForceClassicEngine' flag is encoded into query shape, once this // flag is removed from the query shape encoding the keys will be the same until SERVER-61507 // is completed, then the keys will be different forever. assertQueryHashAndPlanCacheKey(sbe.queryPlanner, classic.stages[0]["$cursor"].queryPlanner); @@ -219,7 +219,7 @@ function assertQueryHashAndPlanCacheKey(sbe, classic) { assert.eq(classic.explainVersion, "1", classic); // The query hashes and the plan cache keys ('the keys') are different now because - // 'internalQueryEnableSlotBasedExecutionEngine' flag is encoded into query shape, once this + // 'internalQueryForceClassicEngine' flag is encoded into query shape, once this // flag is removed from the query shape encoding the keys will be the same until SERVER-61507 // is completed, then the keys will be different forever. assertQueryHashAndPlanCacheKey(sbe.queryPlanner, classic.stages[0]["$cursor"].queryPlanner); diff --git a/jstests/noPassthrough/sbe_plan_cache_memory_debug_info.js b/jstests/noPassthrough/sbe_plan_cache_memory_debug_info.js index 9c8f6fb5461..df3ac0d3fd9 100644 --- a/jstests/noPassthrough/sbe_plan_cache_memory_debug_info.js +++ b/jstests/noPassthrough/sbe_plan_cache_memory_debug_info.js @@ -75,8 +75,7 @@ const planCacheSizeAfterSbeStep = getPlanCacheSize(); assert.lt(initialPlanCacheSize, planCacheSizeAfterSbeStep); // Force classic plan cache. -assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); +assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); // Create a new collection for classic queries so we can easily assess its plan cache. const classicColl = createTestCollection("classic"); diff --git a/jstests/noPassthrough/sbe_plan_cache_size_metric.js b/jstests/noPassthrough/sbe_plan_cache_size_metric.js index 8e37ac8e26e..4cec6ba7f78 100644 --- a/jstests/noPassthrough/sbe_plan_cache_size_metric.js +++ b/jstests/noPassthrough/sbe_plan_cache_size_metric.js @@ -76,8 +76,7 @@ if (isSbePlanCacheEnabled) { // Step 2. Insert an entry to Classic Plan Cache. // Force classic plan cache. - assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); + assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); assert.eq(1, coll.find(classicQuery).itcount()); assertQueryInPlanCache(coll, classicQuery); // Plan Cache must contain exactly 2 entries. @@ -96,7 +95,7 @@ if (isSbePlanCacheEnabled) { // Step 4. Remove the entry from SBE Plan Cache. // Move back to SBE plan cache. assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); // Clean up SBE Plan Cache assert.commandWorked(db.runCommand({planCacheClear: collectionName, query: sbeQuery})); // Assert metric is decremented back to initial value. diff --git a/jstests/noPassthrough/server_status_multiplanner.js b/jstests/noPassthrough/server_status_multiplanner.js index 10ac1d67e0a..f185cdb7841 100644 --- a/jstests/noPassthrough/server_status_multiplanner.js +++ b/jstests/noPassthrough/server_status_multiplanner.js @@ -44,8 +44,7 @@ assert.eq(multiPlannerMetrics.histograms.classicMicros[0].lowerBound, 0); // Run with classic engine and verify metrics. { - assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})); + assert.commandWorked(db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})); assert.commandWorked(coll.find({a: 1, b: 1, c: 1}).explain()); multiPlannerMetrics = db.serverStatus().metrics.query.multiPlanner; @@ -67,7 +66,7 @@ assert.eq(multiPlannerMetrics.histograms.classicMicros[0].lowerBound, 0); // Run with SBE and verify metrics. { assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); assert.commandWorked(coll.find({a: 1, b: 1, c: 1}).explain()); multiPlannerMetrics = db.serverStatus().metrics.query.multiPlanner; diff --git a/jstests/noPassthroughWithMongod/group_pushdown.js b/jstests/noPassthroughWithMongod/group_pushdown.js index 30f6bd58bf7..43476441ef3 100644 --- a/jstests/noPassthroughWithMongod/group_pushdown.js +++ b/jstests/noPassthroughWithMongod/group_pushdown.js @@ -79,7 +79,7 @@ let assertResultsMatchWithAndWithoutGroupPushdown = 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(); @@ -87,7 +87,7 @@ let assertResultsMatchWithAndWithoutGroupPushdown = 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); @@ -100,7 +100,7 @@ let assertResultsMatchWithAndWithoutProjectPushdown = function( {coll: coll, pipeline: pipeline, expectProjectToBePushedDown: expectProjectToBePushedDown}); // Turn sbe off. - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false}); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true}); // Sanity check the results when no project pushdown happens. let resultNoProjectPushdown = coll.aggregate(pipeline).toArray(); @@ -108,7 +108,7 @@ let assertResultsMatchWithAndWithoutProjectPushdown = 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 resultWithProjectPushdown = coll.aggregate(pipeline).toArray(); assert.sameMembers(resultNoProjectPushdown, resultWithProjectPushdown); @@ -117,8 +117,8 @@ let assertResultsMatchWithAndWithoutProjectPushdown = function( let assertShardedGroupResultsMatch = function(coll, pipeline, expectedGroupCountInExplain = 1) { const originalSBEEngineStatus = assert - .commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: false})) + .commandWorked( + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: true})) .was; const cmd = { @@ -131,7 +131,7 @@ let assertShardedGroupResultsMatch = function(coll, pipeline, expectedGroupCount const classicalRes = coll.runCommand(cmd).cursor.firstBatch; assert.commandWorked( - db.adminCommand({setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: true})); + db.adminCommand({setParameter: 1, internalQueryForceClassicEngine: false})); const explainCmd = { aggregate: coll.getName(), pipeline: pipeline, @@ -147,7 +147,7 @@ let assertShardedGroupResultsMatch = function(coll, pipeline, expectedGroupCount assert.sameMembers(sbeRes, classicalRes); assert.commandWorked(db.adminCommand( - {setParameter: 1, internalQueryEnableSlotBasedExecutionEngine: originalSBEEngineStatus})); + {setParameter: 1, internalQueryForceClassicEngine: originalSBEEngineStatus})); }; // Try a pipeline with no group stage. 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 2c799f31f88..c3924654a74 100644 --- a/jstests/sharding/query/lookup_graph_lookup_foreign_becomes_sharded.js +++ b/jstests/sharding/query/lookup_graph_lookup_foreign_becomes_sharded.js @@ -117,11 +117,11 @@ const isShardedLookupEnabled = getShardedLookupParam.hasOwnProperty("featureFlag let res = st.getPrimaryShard(jsTestName()).getDB("admin").adminCommand({ getParameter: 1, featureFlagSBELookupPushdown: 1, - internalQueryEnableSlotBasedExecutionEngine: 1 + internalQueryForceClassicEngine: 1 }); let isSBELookupEnabled = res.ok && res.hasOwnProperty("featureFlagSBELookupPushdown") && - res.hasOwnProperty("internalQueryEnableSlotBasedExecutionEngine") && - res.featureFlagSBELookupPushdown.value && res.internalQueryEnableSlotBasedExecutionEngine; + res.hasOwnProperty("internalQueryForceClassicEngine") && + res.featureFlagSBELookupPushdown.value && !res.internalQueryForceClassicEngine; // 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. diff --git a/src/mongo/db/commands/plan_cache_clear_command.cpp b/src/mongo/db/commands/plan_cache_clear_command.cpp index a3e8fcfc1fb..daf4bb18937 100644 --- a/src/mongo/db/commands/plan_cache_clear_command.cpp +++ b/src/mongo/db/commands/plan_cache_clear_command.cpp @@ -92,7 +92,7 @@ Status clear(OperationContext* opCtx, // sbe::isQuerySbeCompatible here. const size_t plannerOptions = 0; if (feature_flags::gFeatureFlagSbePlanCache.isEnabledAndIgnoreFCV() && - cq->getEnableSlotBasedExecutionEngine() && + !cq->getForceClassicEngine() && sbe::isQuerySbeCompatible(&collection, cq.get(), plannerOptions)) { cq->setSbeCompatible(true); sbe::getPlanCache(opCtx).remove( diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index ff034ff6cc0..fbba650d37d 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -110,14 +110,14 @@ namespace { * pipeline to prepare for pushdown of $group and $lookup into the inner query layer so that it * can be executed using SBE. * Group stages are extracted from the pipeline 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 the DocumentSourceGroup has 'doingMerge=false', this will change when we implement * hash table spilling in SERVER-58436. * * Lookup stages are extracted from the pipeline 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 the 'featureFlagSBELookupPushdown' feature flag is 'true'. * 2. The $lookup uses only the 'localField'/'foreignField' syntax (no pipelines). * 3. The foreign collection is neither sharded nor a view. @@ -138,7 +138,7 @@ std::vector<std::unique_ptr<InnerPipelineStageInterface>> extractSbeCompatibleSt } // No pushdown if we're using the classic engine. - if (!cq->getEnableSlotBasedExecutionEngine()) { + if (cq->getForceClassicEngine()) { return {}; } diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp index 7df5350daac..2271f4ce494 100644 --- a/src/mongo/db/query/canonical_query.cpp +++ b/src/mongo/db/query/canonical_query.cpp @@ -195,7 +195,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()) { @@ -545,7 +545,7 @@ CanonicalQuery::QueryShapeString CanonicalQuery::encodeKey() const { // TODO SERVER-61507: remove '_pipeline.empty()' check. Canonical queries with pushed down // $group/$lookup stages are not SBE-compatible until SERVER-61507 is complete. return (feature_flags::gFeatureFlagSbePlanCache.isEnabledAndIgnoreFCV() && - _enableSlotBasedExecutionEngine && _sbeCompatible && _pipeline.empty()) + !_forceClassicEngine && _sbeCompatible && _pipeline.empty()) ? canonical_query_encoder::encodeSBE(*this) : canonical_query_encoder::encode(*this); } diff --git a/src/mongo/db/query/canonical_query.h b/src/mongo/db/query/canonical_query.h index 9f25a92740b..661b66f0458 100644 --- a/src/mongo/db/query/canonical_query.h +++ b/src/mongo/db/query/canonical_query.h @@ -221,8 +221,8 @@ public: return _explain; } - bool getEnableSlotBasedExecutionEngine() const { - return _enableSlotBasedExecutionEngine; + bool getForceClassicEngine() const { + return _forceClassicEngine; } void setSbeCompatible(bool sbeCompatible) { @@ -304,8 +304,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 = true; // True if this query can be executed by the SBE. bool _sbeCompatible = false; diff --git a/src/mongo/db/query/canonical_query_encoder.cpp b/src/mongo/db/query/canonical_query_encoder.cpp index bfbaa2544c5..a6a94915e91 100644 --- a/src/mongo/db/query/canonical_query_encoder.cpp +++ b/src/mongo/db/query/canonical_query_encoder.cpp @@ -667,7 +667,7 @@ CanonicalQuery::QueryShapeString encode(const CanonicalQuery& cq) { // This encoding can be removed once the classic query engine reaches EOL and SBE is used // exclusively for all query execution. - keyBuilder << kEncodeEngineSection << (cq.getEnableSlotBasedExecutionEngine() ? "t" : "f"); + keyBuilder << kEncodeEngineSection << (cq.getForceClassicEngine() ? "f" : "t"); return keyBuilder.str(); } diff --git a/src/mongo/db/query/canonical_query_encoder_test.cpp b/src/mongo/db/query/canonical_query_encoder_test.cpp index 27e8ae74707..486b4f2d14f 100644 --- a/src/mongo/db/query/canonical_query_encoder_test.cpp +++ b/src/mongo/db/query/canonical_query_encoder_test.cpp @@ -148,9 +148,8 @@ TEST(CanonicalQueryEncoderTest, ComputeKey) { // The computed key depends on which execution engine is enabled. As such, we disable SBE for // this test so that the test doesn't break should the default value of - // 'internalQueryEnableSlotBasedExecutionEngine' change in the future. - RAIIServerParameterControllerForTest controllerSBE( - "internalQueryEnableSlotBasedExecutionEngine", false); + // 'internalQueryForceClassicEngine' change in the future. + RAIIServerParameterControllerForTest controllerSBE("internalQueryForceClassicEngine", true); // No sorts testComputeKey("{}", "{}", "{}", "an@f"); @@ -224,9 +223,8 @@ TEST(CanonicalQueryEncoderTest, ComputeKey) { TEST(CanonicalQueryEncoderTest, EncodeNotEqualNullPredicates) { // The computed key depends on which execution engine is enabled. As such, we disable SBE for // this test so that the test doesn't break should the default value of - // 'internalQueryEnableSlotBasedExecutionEngine' change in the future. - RAIIServerParameterControllerForTest controllerSBE( - "internalQueryEnableSlotBasedExecutionEngine", false); + // 'internalQueryForceClassicEngine' change in the future. + RAIIServerParameterControllerForTest controllerSBE("internalQueryForceClassicEngine", true); // With '$eq', '$gte', and '$lte' negation comparison to 'null'. testComputeKey("{a: {$not: {$eq: null}}}", "{}", "{_id: 0, a: 1}", "ntnot_eq_null[eqa]|a@f"); @@ -246,9 +244,8 @@ TEST(CanonicalQueryEncoderTest, EncodeNotEqualNullPredicates) { TEST(CanonicalQueryEncoderTest, ComputeKeyEscaped) { // The computed key depends on which execution engine is enabled. As such, we disable SBE for // this test so that the test doesn't break should the default value of - // 'internalQueryEnableSlotBasedExecutionEngine' change in the future. - RAIIServerParameterControllerForTest controllerSBE( - "internalQueryEnableSlotBasedExecutionEngine", false); + // 'internalQueryForceClassicEngine' change in the future. + RAIIServerParameterControllerForTest controllerSBE("internalQueryForceClassicEngine", true); // Field name in query. testComputeKey("{'a,[]~|-<>': 1}", "{}", "{}", "eqa\\,\\[\\]\\~\\|\\-<>@f"); @@ -284,9 +281,8 @@ TEST(CanonicalQueryEncoderTest, ComputeKeyGeoWithin) { TEST(CanonicalQueryEncoderTest, ComputeKeyGeoNear) { // The computed key depends on which execution engine is enabled. As such, we disable SBE for // this test so that the test doesn't break should the default value of - // 'internalQueryEnableSlotBasedExecutionEngine' change in the future. - RAIIServerParameterControllerForTest controllerSBE( - "internalQueryEnableSlotBasedExecutionEngine", false); + // 'internalQueryForceClassicEngine' change in the future. + RAIIServerParameterControllerForTest controllerSBE("internalQueryForceClassicEngine", true); testComputeKey("{a: {$near: [0,0], $maxDistance:0.3 }}", "{}", "{}", "gnanrfl@f"); testComputeKey("{a: {$nearSphere: [0,0], $maxDistance: 0.31 }}", "{}", "{}", "gnanssp@f"); @@ -301,8 +297,7 @@ TEST(CanonicalQueryEncoderTest, ComputeKeyGeoNear) { TEST(CanonicalQueryEncoderTest, ComputeKeyRegexDependsOnFlags) { // The computed key depends on which execution engine is enabled. As such, we enable SBE for // this test in order to ensure that we have coverage for both SBE and the classic engine. - RAIIServerParameterControllerForTest controllerSBE( - "internalQueryEnableSlotBasedExecutionEngine", true); + RAIIServerParameterControllerForTest controllerSBE("internalQueryForceClassicEngine", false); testComputeKey("{a: {$regex: \"sometext\"}}", "{}", "{}", "rea@t"); testComputeKey("{a: {$regex: \"sometext\", $options: \"\"}}", "{}", "{}", "rea@t"); @@ -335,9 +330,8 @@ TEST(CanonicalQueryEncoderTest, ComputeKeyRegexDependsOnFlags) { TEST(CanonicalQueryEncoderTest, ComputeKeyMatchInDependsOnPresenceOfRegexAndFlags) { // The computed key depends on which execution engine is enabled. As such, we disable SBE for // this test so that the test doesn't break should the default value of - // 'internalQueryEnableSlotBasedExecutionEngine' change in the future. - RAIIServerParameterControllerForTest controllerSBE( - "internalQueryEnableSlotBasedExecutionEngine", false); + // 'internalQueryForceClassicEngine' change in the future. + RAIIServerParameterControllerForTest controllerSBE("internalQueryForceClassicEngine", true); // Test that an $in containing a single regex is unwrapped to $regex. testComputeKey("{a: {$in: [/foo/]}}", "{}", "{}", "rea@f"); @@ -386,9 +380,8 @@ TEST(CanonicalQueryEncoderTest, ComputeKeyMatchInDependsOnPresenceOfRegexAndFlag TEST(CanonicalQueryEncoderTest, CheckCollationIsEncoded) { // The computed key depends on which execution engine is enabled. As such, we disable SBE for // this test so that the test doesn't break should the default value of - // 'internalQueryEnableSlotBasedExecutionEngine' change in the future. - RAIIServerParameterControllerForTest controllerSBE( - "internalQueryEnableSlotBasedExecutionEngine", false); + // 'internalQueryForceClassicEngine' change in the future. + RAIIServerParameterControllerForTest controllerSBE("internalQueryForceClassicEngine", true); unique_ptr<CanonicalQuery> cq(canonicalize( fromjson("{a: 1, b: 1}"), {}, {}, fromjson("{locale: 'mock_reverse_string'}"))); @@ -400,8 +393,7 @@ TEST(CanonicalQueryEncoderTest, ComputeKeySBE) { // Generated cache keys should be treated as opaque to the user. // SBE must be enabled in order to generate SBE plan cache keys. - RAIIServerParameterControllerForTest controllerSBE( - "internalQueryEnableSlotBasedExecutionEngine", true); + RAIIServerParameterControllerForTest controllerSBE("internalQueryForceClassicEngine", false); // TODO SERVER-61314: Remove when featureFlagSbePlanCache is removed. RAIIServerParameterControllerForTest controllerSBEPlanCache("featureFlagSbePlanCache", true); diff --git a/src/mongo/db/query/explain.cpp b/src/mongo/db/query/explain.cpp index 4ec9e8d9e7d..414badb8332 100644 --- a/src/mongo/db/query/explain.cpp +++ b/src/mongo/db/query/explain.cpp @@ -96,7 +96,7 @@ void generatePlannerInfo(PlanExecutor* exec, QuerySettingsDecoration::get(collection->getSharedDecorations()); if (exec->getCanonicalQuery()->isSbeCompatible() && feature_flags::gFeatureFlagSbePlanCache.isEnabledAndIgnoreFCV() && - exec->getCanonicalQuery()->getEnableSlotBasedExecutionEngine() && + !exec->getCanonicalQuery()->getForceClassicEngine() && // TODO(SERVER-61507): Remove pipeline check once lowered pipelines are integrated with // SBE plan cache. exec->getCanonicalQuery()->pipeline().empty()) { diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp index 537ec7d5c69..f1a6be4d958 100644 --- a/src/mongo/db/query/get_executor.cpp +++ b/src/mongo/db/query/get_executor.cpp @@ -1386,7 +1386,7 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getExecutor( const auto& mainColl = collections.getMainCollection(); canonicalQuery->setSbeCompatible( sbe::isQuerySbeCompatible(&mainColl, canonicalQuery.get(), plannerOptions)); - return canonicalQuery->getEnableSlotBasedExecutionEngine() && canonicalQuery->isSbeCompatible() + return !canonicalQuery->getForceClassicEngine() && canonicalQuery->isSbeCompatible() ? getSlotBasedExecutor(opCtx, collections, std::move(canonicalQuery), diff --git a/src/mongo/db/query/plan_cache_key_info_test.cpp b/src/mongo/db/query/plan_cache_key_info_test.cpp index 472b1f0ab9c..7235386e7f4 100644 --- a/src/mongo/db/query/plan_cache_key_info_test.cpp +++ b/src/mongo/db/query/plan_cache_key_info_test.cpp @@ -420,17 +420,17 @@ TEST(PlanCacheKeyInfoTest, 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 noClassicEngineKey = constructPlanCacheKey(true); + const auto classicEngineKey = constructPlanCacheKey(true); + const auto noClassicEngineKey = constructPlanCacheKey(false); // Check that the two plan cache keys are not equal because the plans were created under // different engines. diff --git a/src/mongo/db/query/query_knobs.idl b/src/mongo/db/query/query_knobs.idl index 5120ec5f1d3..7e2fee1563f 100644 --- a/src/mongo/db/query/query_knobs.idl +++ b/src/mongo/db/query/query_knobs.idl @@ -653,13 +653,13 @@ server_parameters: default: false on_update: plan_cache_util::clearSbeCacheOnParameterChange - 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 + default: true internalQueryAppendIdToSetWindowFieldsSort: description: "If true, appends _id to the sort stage generated by desugaring $setWindowFields to diff --git a/src/mongo/db/query/query_planner.cpp b/src/mongo/db/query/query_planner.cpp index 69c679888f8..fa810499cb4 100644 --- a/src/mongo/db/query/query_planner.cpp +++ b/src/mongo/db/query/query_planner.cpp @@ -212,7 +212,7 @@ void tryToAddColumnScan(const QueryPlannerParams& params, // We only want to use the columnar index if we can avoid fetching the whole document. return; } - if (!query.isSbeCompatible() || !query.getEnableSlotBasedExecutionEngine()) { + if (!query.isSbeCompatible() || query.getForceClassicEngine()) { // We only support column scans in SBE. return; } diff --git a/src/mongo/db/query/query_planner_columnar_test.cpp b/src/mongo/db/query/query_planner_columnar_test.cpp index 10c92f6cebd..2d255ebbeeb 100644 --- a/src/mongo/db/query/query_planner_columnar_test.cpp +++ b/src/mongo/db/query/query_planner_columnar_test.cpp @@ -85,8 +85,7 @@ protected: private: // SBE must be enabled in order to test columnar indexes. - RAIIServerParameterControllerForTest _controllerSBE{ - "internalQueryEnableSlotBasedExecutionEngine", true}; + RAIIServerParameterControllerForTest _controllerSBE{"internalQueryForceClassicEngine", false}; }; TEST_F(QueryPlannerColumnarTest, InclusionProjectionUsesColumnarIndex) { diff --git a/src/mongo/dbtests/query_stage_multiplan.cpp b/src/mongo/dbtests/query_stage_multiplan.cpp index ce40f343858..3552cf095fd 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 9d39eced9a9..c48527ba68f 100644 --- a/src/mongo/shell/servers.js +++ b/src/mongo/shell/servers.js @@ -643,20 +643,6 @@ var _isMongodVersionEqualOrAfter = function(version1, version2) { return false; }; -// Returns if version2 came before version 1. -var _isMongodVersionBefore = function(version1, version2) { - var versionParts1 = _convertVersionToIntegerArray(version1); - var versionParts2 = _convertVersionToIntegerArray(version2); - if (versionParts2[0] < versionParts1[0] || - (versionParts2[0] === versionParts1[0] && versionParts2[1] < versionParts1[1]) || - (versionParts2[0] === versionParts1[0] && versionParts2[1] === versionParts1[1] && - versionParts2[2] < versionParts1[2])) { - return true; - } - - return false; -}; - // Removes a setParameter parameter from mongods or mongoses running a version that won't recognize // them. var _removeSetParameterIfBeforeVersion = function( @@ -672,24 +658,6 @@ var _removeSetParameterIfBeforeVersion = function( } }; -// Similar to the function above, but accepts two versions such that if the configured binVersion is -// between the specified versions, it removes the setParameter parameter. -var _removeSetParameterIfBetweenSpecifiedVersions = function( - opts, parameterName, afterVersion, beforeVersion, isMongos = false) { - var processString = isMongos ? "mongos" : "mongod"; - var versionCompatible = (opts.binVersion === "" || opts.binVersion === undefined || - // For 'opts.binVersion' to be compatible with 'parameterName', it must - // be GTE 'afterVersion' or LT 'beforeVersion'. - _isMongodVersionEqualOrAfter(afterVersion, opts.binVersion) || - _isMongodVersionBefore(beforeVersion, opts.binVersion)); - if (!versionCompatible && opts.setParameter && opts.setParameter[parameterName] != undefined) { - print("Removing '" + parameterName + "' setParameter with value " + - opts.setParameter[parameterName] + " because it isn't compatible with " + - processString + " running version " + opts.binVersion); - delete opts.setParameter[parameterName]; - } -}; - /** * @option {object} opts * @@ -735,8 +703,7 @@ MongoRunner.mongodOptions = function(opts = {}) { opts, "enableDefaultWriteConcernUpdatesForInitiate", "5.0.0"); _removeSetParameterIfBeforeVersion(opts, "enableReconfigRollbackCommittedWritesCheck", "5.0.0"); _removeSetParameterIfBeforeVersion(opts, "featureFlagRetryableFindAndModify", "5.0.0"); - _removeSetParameterIfBetweenSpecifiedVersions( - opts, "internalQueryEnableSlotBasedExecutionEngine", "6.0.0", "5.1.0"); + _removeSetParameterIfBeforeVersion(opts, "internalQueryForceClassicEngine", "5.1.0"); _removeSetParameterIfBeforeVersion(opts, "allowMultipleArbiters", "5.3.0"); if (!opts.logFile && opts.useLogFiles) { |