summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2020-06-24 18:38:08 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-07-09 14:14:43 +0000
commita58d7ea75368b103a7f493c0ff6035b9a099b88d (patch)
tree971c74fde502d5549d46b5e63bcc7b854fb78f32 /src/mongo/db/pipeline
parentc37aaac0696c3b4a69df191bd991e474824e43b1 (diff)
downloadmongo-a58d7ea75368b103a7f493c0ff6035b9a099b88d.tar.gz
SERVER-48477 Make PlanExecutor interface more generic
After this change, the interface is sensible for both the classic and SBE engines (with the exception of 'getRootStage()' which is left as future work).
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r--src/mongo/db/pipeline/document_source_cursor.cpp5
-rw-r--r--src/mongo/db/pipeline/pipeline_d.cpp3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/pipeline/document_source_cursor.cpp b/src/mongo/db/pipeline/document_source_cursor.cpp
index 4aa7ce75d11..9c8389594b9 100644
--- a/src/mongo/db/pipeline/document_source_cursor.cpp
+++ b/src/mongo/db/pipeline/document_source_cursor.cpp
@@ -147,7 +147,7 @@ void DocumentSourceCursor::loadBatch() {
try {
ON_BLOCK_EXIT([this] { recordPlanSummaryStats(); });
- while ((state = _exec->getNext(&resultObj, nullptr)) == PlanExecutor::ADVANCED) {
+ while ((state = _exec->getNextDocument(&resultObj, nullptr)) == PlanExecutor::ADVANCED) {
_currentBatch.enqueue(transformDoc(std::move(resultObj)));
// As long as we're waiting for inserts, we shouldn't do any batching at this level we
@@ -244,7 +244,8 @@ Value DocumentSourceCursor::serialize(boost::optional<ExplainOptions::Verbosity>
}
void DocumentSourceCursor::detachFromOperationContext() {
- if (_exec && !_exec->isDetached()) {
+ // Only detach the underlying executor if it hasn't been detached already.
+ if (_exec && _exec->getOpCtx()) {
_exec->detachFromOperationContext();
}
}
diff --git a/src/mongo/db/pipeline/pipeline_d.cpp b/src/mongo/db/pipeline/pipeline_d.cpp
index bece5cefcea..e436fc29334 100644
--- a/src/mongo/db/pipeline/pipeline_d.cpp
+++ b/src/mongo/db/pipeline/pipeline_d.cpp
@@ -70,6 +70,7 @@
#include "mongo/db/pipeline/pipeline.h"
#include "mongo/db/query/collation/collator_interface.h"
#include "mongo/db/query/get_executor.h"
+#include "mongo/db/query/plan_executor_factory.h"
#include "mongo/db/query/plan_summary_stats.h"
#include "mongo/db/query/query_planner.h"
#include "mongo/db/query/sort_pattern.h"
@@ -169,7 +170,7 @@ StatusWith<unique_ptr<PlanExecutor, PlanExecutor::Deleter>> createRandomCursorEx
minWorkAdvancedRatio);
}
- return PlanExecutor::make(
+ return plan_executor_factory::make(
expCtx, std::move(ws), std::move(root), coll, PlanYieldPolicy::YieldPolicy::YIELD_AUTO);
}