Skip to content

Commit 620942c

Browse files
pdan101Evergreen Agent
authored andcommitted
SERVER-77973 Removed featureFlagSbeFull from blocking COUNT_SCAN
1 parent b2c78aa commit 620942c

File tree

4 files changed

+17
-70
lines changed

4 files changed

+17
-70
lines changed

jstests/noPassthroughWithMongod/sbe_index_count_scan_cache.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ load("jstests/libs/sbe_util.js");
99

1010
const testDb = db.getSiblingDB(jsTestName());
1111
// This test is specifically verifying the behavior of the SBE plan cache.
12-
if (!checkSBEEnabled(testDb, ["featureFlagSbeFull"])) {
12+
if (!checkSBEEnabled(testDb)) {
1313
jsTestLog("Skipping test because SBE is not enabled");
1414
return;
1515
}

src/mongo/db/query/get_executor.cpp

Lines changed: 16 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,33 +1425,6 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> getSlotBasedExe
14251425
false /* generatedByBonsai */);
14261426
} // getSlotBasedExecutor
14271427

1428-
/**
1429-
* Checks if the result of query planning is SBE compatible. If any of the query solutions in
1430-
* 'planningResult' cannot currently be compiled to an SBE plan via the SBE stage builders, then we
1431-
* will fall back to the classic engine.
1432-
*/
1433-
bool shouldPlanningResultUseSbe(const SlotBasedPrepareExecutionResult& planningResult) {
1434-
// If we have an entry in the SBE plan cache, then we can use SBE.
1435-
if (planningResult.isRecoveredFromPlanCache()) {
1436-
return true;
1437-
}
1438-
1439-
const auto& solutions = planningResult.solutions();
1440-
if (solutions.empty()) {
1441-
// Query needs subplanning (plans are generated later, we don't have access yet). We can
1442-
// proceed with using SBE in this case.
1443-
invariant(planningResult.needsSubplanning());
1444-
return true;
1445-
}
1446-
1447-
// Check that all query solutions are SBE compatible.
1448-
return std::all_of(solutions.begin(), solutions.end(), [](const auto& solution) {
1449-
// We must have a solution, otherwise we would have early exited.
1450-
invariant(solution->root());
1451-
return isQueryPlanSbeCompatible(solution.get());
1452-
});
1453-
}
1454-
14551428
/**
14561429
* Function which returns true if 'cq' uses features that are currently supported in SBE without
14571430
* 'featureFlagSbeFull' being set; false otherwise.
@@ -1518,9 +1491,6 @@ attemptToGetSlotBasedExecutor(
15181491
// SBE-compatible query using SBE, even if the query uses features that are not on in SBE by
15191492
// default. Either way, try to construct an SBE plan executor.
15201493
if (canUseRegularSbe || sbeFull) {
1521-
// Create the SBE prepare execution helper and initialize the params for the planner. If
1522-
// planning results in any 'QuerySolution' which cannot be handled by the SBE stage builder,
1523-
// then we will fall back to the classic engine.
15241494
stdx::variant<const Yieldable*, PlanYieldPolicy::YieldThroughAcquisitions> yieldable;
15251495
if (collections.isAcquisition()) {
15261496
yieldable = PlanYieldPolicy::YieldThroughAcquisitions{};
@@ -1536,24 +1506,22 @@ attemptToGetSlotBasedExecutor(
15361506
return planningResultWithStatus.getStatus();
15371507
}
15381508

1539-
if (shouldPlanningResultUseSbe(*planningResultWithStatus.getValue())) {
1540-
if (extractAndAttachPipelineStages) {
1541-
// We know now that we will use SBE, so we need to remove the pushed-down stages
1542-
// from the original pipeline object.
1543-
extractAndAttachPipelineStages(canonicalQuery.get(), false /* attachOnly */);
1544-
}
1545-
auto statusWithExecutor =
1546-
getSlotBasedExecutor(opCtx,
1547-
collections,
1548-
std::move(canonicalQuery),
1549-
std::move(sbeYieldPolicy),
1550-
plannerParams,
1551-
std::move(planningResultWithStatus.getValue()));
1552-
if (statusWithExecutor.isOK()) {
1553-
return std::move(statusWithExecutor.getValue());
1554-
} else {
1555-
return statusWithExecutor.getStatus();
1556-
}
1509+
if (extractAndAttachPipelineStages) {
1510+
// Given that we are using SBE, we need to remove the pushed-down stages
1511+
// from the original pipeline object.
1512+
extractAndAttachPipelineStages(canonicalQuery.get(), false /* attachOnly */);
1513+
}
1514+
auto statusWithExecutor =
1515+
getSlotBasedExecutor(opCtx,
1516+
collections,
1517+
std::move(canonicalQuery),
1518+
std::move(sbeYieldPolicy),
1519+
plannerParams,
1520+
std::move(planningResultWithStatus.getValue()));
1521+
if (statusWithExecutor.isOK()) {
1522+
return std::move(statusWithExecutor.getValue());
1523+
} else {
1524+
return statusWithExecutor.getStatus();
15571525
}
15581526
}
15591527

src/mongo/db/query/query_utils.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,4 @@ bool isQuerySbeCompatible(const CollectionPtr* collection, const CanonicalQuery*
9191
});
9292
}
9393

94-
bool isQueryPlanSbeCompatible(const QuerySolution* root) {
95-
tassert(7061701, "Expected QuerySolution pointer to not be nullptr", root);
96-
97-
// (Ignore FCV check): This is intentional because we always want to use this feature once the
98-
// feature flag is enabled.
99-
const bool sbeFull = feature_flags::gFeatureFlagSbeFull.isEnabledAndIgnoreFCVUnsafe();
100-
const bool isNotCountScan = !root->hasNode(StageType::STAGE_COUNT_SCAN);
101-
102-
return isNotCountScan || sbeFull;
103-
}
104-
10594
} // namespace mongo

src/mongo/db/query/query_utils.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,4 @@ bool isIdHackEligibleQuery(const CollectionPtr& collection, const CanonicalQuery
5656
* planning can be short-circuited as it is already known that the query is ineligible for SBE.
5757
*/
5858
bool isQuerySbeCompatible(const CollectionPtr* collection, const CanonicalQuery* cq);
59-
60-
/**
61-
* Checks if the given query can be executed with the SBE engine based on the query solution.
62-
*
63-
* This method determines whether the query may be compatible with SBE based on the query solution
64-
* (such as ineligible plan stages). It should be used in conjunction with the higher level
65-
* isQuerySbeCompatible() check to ensure that all aspects of the query are validated for
66-
* compatibility.
67-
*/
68-
bool isQueryPlanSbeCompatible(const QuerySolution* root);
6959
} // namespace mongo

0 commit comments

Comments
 (0)