summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/document_source_lookup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/document_source_lookup.cpp')
-rw-r--r--src/mongo/db/pipeline/document_source_lookup.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/mongo/db/pipeline/document_source_lookup.cpp b/src/mongo/db/pipeline/document_source_lookup.cpp
index bf8a890924f..e4fd70920f6 100644
--- a/src/mongo/db/pipeline/document_source_lookup.cpp
+++ b/src/mongo/db/pipeline/document_source_lookup.cpp
@@ -70,7 +70,7 @@ constexpr size_t DocumentSourceLookUp::kMaxSubPipelineDepth;
DocumentSourceLookUp::DocumentSourceLookUp(NamespaceString fromNs,
std::string as,
const boost::intrusive_ptr<ExpressionContext>& pExpCtx)
- : DocumentSourceNeedsMongoProcessInterface(pExpCtx),
+ : DocumentSource(pExpCtx),
_fromNs(std::move(fromNs)),
_as(std::move(as)),
_variables(pExpCtx->variables),
@@ -249,7 +249,7 @@ DocumentSource::GetNextResult DocumentSourceLookUp::getNext() {
return output.freeze();
}
-std::unique_ptr<Pipeline, Pipeline::Deleter> DocumentSourceLookUp::buildPipeline(
+std::unique_ptr<Pipeline, PipelineDeleter> DocumentSourceLookUp::buildPipeline(
const Document& inputDoc) {
// Copy all 'let' variables into the foreign pipeline's expression context.
copyVariablesToExpCtx(_variables, _variablesParseState, _fromExpCtx.get());
@@ -260,21 +260,18 @@ std::unique_ptr<Pipeline, Pipeline::Deleter> DocumentSourceLookUp::buildPipeline
// If we don't have a cache, build and return the pipeline immediately.
if (!_cache || _cache->isAbandoned()) {
return uassertStatusOK(
- _mongoProcessInterface->makePipeline(_resolvedPipeline, _fromExpCtx));
+ pExpCtx->mongoProcessInterface->makePipeline(_resolvedPipeline, _fromExpCtx));
}
// Tailor the pipeline construction for our needs. We want a non-optimized pipeline without a
- // cursor source. If the cache is present and serving, then we will not be adding a cursor
- // source later, so inject a MongoProcessInterface into all stages that need one.
+ // cursor source.
MongoProcessInterface::MakePipelineOptions pipelineOpts;
-
pipelineOpts.optimize = false;
pipelineOpts.attachCursorSource = false;
- pipelineOpts.forceInjectMongoProcessInterface = _cache->isServing();
// Construct the basic pipeline without a cache stage.
auto pipeline = uassertStatusOK(
- _mongoProcessInterface->makePipeline(_resolvedPipeline, _fromExpCtx, pipelineOpts));
+ pExpCtx->mongoProcessInterface->makePipeline(_resolvedPipeline, _fromExpCtx, pipelineOpts));
// Add the cache stage at the end and optimize. During the optimization process, the cache will
// either move itself to the correct position in the pipeline, or will abandon itself if no
@@ -286,8 +283,8 @@ std::unique_ptr<Pipeline, Pipeline::Deleter> DocumentSourceLookUp::buildPipeline
if (!_cache->isServing()) {
// The cache has either been abandoned or has not yet been built. Attach a cursor.
- uassertStatusOK(
- _mongoProcessInterface->attachCursorSourceToPipeline(_fromExpCtx, pipeline.get()));
+ uassertStatusOK(pExpCtx->mongoProcessInterface->attachCursorSourceToPipeline(
+ _fromExpCtx, pipeline.get()));
}
// If the cache has been abandoned, release it.
@@ -712,7 +709,7 @@ DocumentSource::GetDepsReturn DocumentSourceLookUp::getDependencies(DepsTracker*
return SEE_NEXT;
}
-void DocumentSourceLookUp::doDetachFromOperationContext() {
+void DocumentSourceLookUp::detachFromOperationContext() {
if (_pipeline) {
// We have a pipeline we're going to be executing across multiple calls to getNext(), so we
// use Pipeline::detachFromOperationContext() to take care of updating '_fromExpCtx->opCtx'.
@@ -723,7 +720,7 @@ void DocumentSourceLookUp::doDetachFromOperationContext() {
}
}
-void DocumentSourceLookUp::doReattachToOperationContext(OperationContext* opCtx) {
+void DocumentSourceLookUp::reattachToOperationContext(OperationContext* opCtx) {
if (_pipeline) {
// We have a pipeline we're going to be executing across multiple calls to getNext(), so we
// use Pipeline::reattachToOperationContext() to take care of updating '_fromExpCtx->opCtx'.