diff options
author | David Storch <david.storch@10gen.com> | 2015-12-30 14:50:38 -0500 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2016-01-04 10:46:05 -0500 |
commit | 898818d5a299fa2eff01d3950d40c8512bab7f10 (patch) | |
tree | a6dbd116fce11f13dcf1455bd0a7b9e0a957fcd9 /src/mongo/db/exec/subplan.cpp | |
parent | c28bf48e5d3cbe6c1aceed89adcdf8ed7cba5f42 (diff) | |
download | mongo-898818d5a299fa2eff01d3950d40c8512bab7f10.tar.gz |
SERVER-21510 trip invariant on attempt to create PlanStages with a no-op extension context
Diffstat (limited to 'src/mongo/db/exec/subplan.cpp')
-rw-r--r-- | src/mongo/db/exec/subplan.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp index c77b7d05454..df514861011 100644 --- a/src/mongo/db/exec/subplan.cpp +++ b/src/mongo/db/exec/subplan.cpp @@ -327,8 +327,12 @@ Status SubplanStage::choosePlanForSubqueries(PlanYieldPolicy* yieldPolicy) { // Dump all the solutions into the MPS. for (size_t ix = 0; ix < branchResult->solutions.size(); ++ix) { PlanStage* nextPlanRoot; - invariant(StageBuilder::build( - getOpCtx(), _collection, *branchResult->solutions[ix], _ws, &nextPlanRoot)); + invariant(StageBuilder::build(getOpCtx(), + _collection, + *branchResult->canonicalQuery, + *branchResult->solutions[ix], + _ws, + &nextPlanRoot)); // Takes ownership of solution with index 'ix' and 'nextPlanRoot'. multiPlanStage.addPlan(branchResult->solutions.releaseAt(ix), nextPlanRoot, _ws); @@ -407,7 +411,8 @@ Status SubplanStage::choosePlanForSubqueries(PlanYieldPolicy* yieldPolicy) { // and set that solution as our child stage. _ws->clear(); PlanStage* root; - invariant(StageBuilder::build(getOpCtx(), _collection, *_compositeSolution.get(), _ws, &root)); + invariant(StageBuilder::build( + getOpCtx(), _collection, *_query, *_compositeSolution.get(), _ws, &root)); invariant(_children.empty()); _children.emplace_back(root); @@ -440,7 +445,7 @@ Status SubplanStage::choosePlanWholeQuery(PlanYieldPolicy* yieldPolicy) { if (1 == solutions.size()) { PlanStage* root; // Only one possible plan. Run it. Build the stages from the solution. - verify(StageBuilder::build(getOpCtx(), _collection, *solutions[0], _ws, &root)); + verify(StageBuilder::build(getOpCtx(), _collection, *_query, *solutions[0], _ws, &root)); invariant(_children.empty()); _children.emplace_back(root); @@ -462,8 +467,8 @@ Status SubplanStage::choosePlanWholeQuery(PlanYieldPolicy* yieldPolicy) { // version of StageBuild::build when WorkingSet is shared PlanStage* nextPlanRoot; - verify( - StageBuilder::build(getOpCtx(), _collection, *solutions[ix], _ws, &nextPlanRoot)); + verify(StageBuilder::build( + getOpCtx(), _collection, *_query, *solutions[ix], _ws, &nextPlanRoot)); // Takes ownership of 'solutions[ix]' and 'nextPlanRoot'. multiPlanStage->addPlan(solutions.releaseAt(ix), nextPlanRoot, _ws); |