diff options
author | Yoonsoo Kim <yoonsoo.kim@mongodb.com> | 2021-09-24 18:03:10 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-24 18:46:17 +0000 |
commit | 470a63ee30370352d9a995a0c791670c521ac5a0 (patch) | |
tree | 690941046a804e9ca0ca7bc076e3a4be0ee11dab /src/mongo/db/pipeline/pipeline_d.cpp | |
parent | 2eff178ab31e80a4842b9b2c8d967540c27c3fbc (diff) | |
download | mongo-470a63ee30370352d9a995a0c791670c521ac5a0.tar.gz |
SERVER-60191 Disable $group pushdown to SBE when $match with $or exists
Diffstat (limited to 'src/mongo/db/pipeline/pipeline_d.cpp')
-rw-r--r-- | src/mongo/db/pipeline/pipeline_d.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp index ef13b96077f..56e0bcff2cf 100644 --- a/src/mongo/db/pipeline/pipeline_d.cpp +++ b/src/mongo/db/pipeline/pipeline_d.cpp @@ -109,6 +109,7 @@ namespace { * collection. This case is necessary because we don't currently support extending the * QuerySolution with the 'postMultiPlan' QuerySolutionNode when the PlanCache is involved in * the query. This will be resolved when SERVER-58429 is complete. + * 3. $match stage does not have $or and thus, does not need subplanning. */ std::vector<std::unique_ptr<InnerPipelineStageInterface>> extractSbeCompatibleGroupsForPushdown( const intrusive_ptr<ExpressionContext>& expCtx, @@ -119,6 +120,12 @@ std::vector<std::unique_ptr<InnerPipelineStageInterface>> extractSbeCompatibleGr // which requires stages to be wrapped in an interface. std::vector<std::unique_ptr<InnerPipelineStageInterface>> groupsForPushdown; + // In case that we have a top $or for $match stage, it triggers the tripwire assertion 5842500 + // because subplanning does not expect that the base query has pushed down $group stage(s) but + // it does when $group stage exist in pipeline. + // TODO SERVER-60197: Remove this check after supporting this scenario. + auto queryNeedsSubplanning = cq->getQueryObj().hasField("$or"); + // This handles the case of unionWith against an unknown collection. if (collection == nullptr) { return {}; @@ -135,7 +142,7 @@ std::vector<std::unique_ptr<InnerPipelineStageInterface>> extractSbeCompatibleGr if (!feature_flags::gFeatureFlagSBEGroupPushdown.isEnabled( serverGlobalParams.featureCompatibility) || !cq->getEnableSlotBasedExecutionEngine() || expCtx->allowDiskUse || isSharded || - !isSingleIndex) { + !isSingleIndex || queryNeedsSubplanning) { return {}; } |