summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/pipeline_d.cpp
diff options
context:
space:
mode:
authorIan Boros <ian.boros@mongodb.com>2020-11-02 14:47:03 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-01-19 00:28:40 +0000
commitb110afdd003360552959b58c3e6a8798bc569173 (patch)
treef73ba621fc9c9a15d2cec39d1727cc0eacd8a0f4 /src/mongo/db/pipeline/pipeline_d.cpp
parentac96dfc44f04202e70c2026be8f434e13a2a0713 (diff)
downloadmongo-b110afdd003360552959b58c3e6a8798bc569173.tar.gz
SERVER-50754 introduce MakeBSONObjStage and various perf improvements to SBE
Diffstat (limited to 'src/mongo/db/pipeline/pipeline_d.cpp')
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index a4ef8e1c521..a1617aefff9 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -169,8 +169,12 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> createRandomCursorEx
trialStage = static_cast<TrialStage*>(root.get());
}
- auto exec = plan_executor_factory::make(
- expCtx, std::move(ws), std::move(root), &coll, PlanYieldPolicy::YieldPolicy::YIELD_AUTO);
+ auto exec = plan_executor_factory::make(expCtx,
+ std::move(ws),
+ std::move(root),
+ &coll,
+ PlanYieldPolicy::YieldPolicy::YIELD_AUTO,
+ QueryPlannerParams::RETURN_OWNED_DATA);
// For sharded collections, the root of the plan tree is a TrialStage that may have chosen
// either a random-sampling cursor trial plan or a COLLSCAN backup plan. We can only optimize
@@ -674,7 +678,8 @@ StatusWith<std::unique_ptr<PlanExecutor, PlanExecutor::Deleter>> PipelineD::prep
bool* hasNoRequirements) {
invariant(hasNoRequirements);
- size_t plannerOpts = QueryPlannerParams::DEFAULT;
+ // Any data returned from the inner executor must be owned.
+ size_t plannerOpts = QueryPlannerParams::DEFAULT | QueryPlannerParams::RETURN_OWNED_DATA;
if (pipeline->peekFront() && pipeline->peekFront()->constraints().isChangeStreamStage()) {
invariant(expCtx->tailableMode == TailableModeEnum::kTailableAndAwaitData);