From b5a2cc0fec6ac30b1a0196da5feb41d85a8b76c3 Mon Sep 17 00:00:00 2001 From: Charlie Swanson Date: Tue, 19 Dec 2017 14:31:36 -0500 Subject: SERVER-32190 Make MongoProcessInterface always available --- src/mongo/db/pipeline/pipeline.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'src/mongo/db/pipeline/pipeline.cpp') diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp index 6f71c129707..4e12ba4358d 100644 --- a/src/mongo/db/pipeline/pipeline.cpp +++ b/src/mongo/db/pipeline/pipeline.cpp @@ -78,17 +78,17 @@ Pipeline::~Pipeline() { invariant(_disposed); } -StatusWith> Pipeline::parse( +StatusWith> Pipeline::parse( const std::vector& rawPipeline, const intrusive_ptr& expCtx) { return parseTopLevelOrFacetPipeline(rawPipeline, expCtx, false); } -StatusWith> Pipeline::parseFacetPipeline( +StatusWith> Pipeline::parseFacetPipeline( const std::vector& rawPipeline, const intrusive_ptr& expCtx) { return parseTopLevelOrFacetPipeline(rawPipeline, expCtx, true); } -StatusWith> Pipeline::parseTopLevelOrFacetPipeline( +StatusWith> Pipeline::parseTopLevelOrFacetPipeline( const std::vector& rawPipeline, const intrusive_ptr& expCtx, const bool isFacetPipeline) { @@ -103,22 +103,22 @@ StatusWith> Pipeline::parseTopLevel return createTopLevelOrFacetPipeline(std::move(stages), expCtx, isFacetPipeline); } -StatusWith> Pipeline::create( +StatusWith> Pipeline::create( SourceContainer stages, const intrusive_ptr& expCtx) { return createTopLevelOrFacetPipeline(std::move(stages), expCtx, false); } -StatusWith> Pipeline::createFacetPipeline( +StatusWith> Pipeline::createFacetPipeline( SourceContainer stages, const intrusive_ptr& expCtx) { return createTopLevelOrFacetPipeline(std::move(stages), expCtx, true); } -StatusWith> Pipeline::createTopLevelOrFacetPipeline( +StatusWith> Pipeline::createTopLevelOrFacetPipeline( SourceContainer stages, const intrusive_ptr& expCtx, const bool isFacetPipeline) { - std::unique_ptr pipeline(new Pipeline(std::move(stages), expCtx), - Pipeline::Deleter(expCtx->opCtx)); + std::unique_ptr pipeline(new Pipeline(std::move(stages), expCtx), + PipelineDeleter(expCtx->opCtx)); try { if (isFacetPipeline) { pipeline->validateFacetPipeline(); @@ -276,6 +276,7 @@ bool Pipeline::aggSupportsWriteConcern(const BSONObj& cmd) { void Pipeline::detachFromOperationContext() { pCtx->opCtx = nullptr; + pCtx->mongoProcessInterface->setOperationContext(nullptr); for (auto&& source : _sources) { source->detachFromOperationContext(); @@ -284,6 +285,7 @@ void Pipeline::detachFromOperationContext() { void Pipeline::reattachToOperationContext(OperationContext* opCtx) { pCtx->opCtx = opCtx; + pCtx->mongoProcessInterface->setOperationContext(opCtx); for (auto&& source : _sources) { source->reattachToOperationContext(opCtx); @@ -307,7 +309,7 @@ void Pipeline::dispose(OperationContext* opCtx) { } } -std::unique_ptr Pipeline::splitForSharded() { +std::unique_ptr Pipeline::splitForSharded() { invariant(!isSplitForShards()); invariant(!isSplitForMerge()); invariant(!_unsplitSources); @@ -315,8 +317,8 @@ std::unique_ptr Pipeline::splitForSharded() { // Create and initialize the shard spec we'll return. We start with an empty pipeline on the // shards and all work being done in the merger. Optimizations can move operations between // the pipelines to be more efficient. - std::unique_ptr shardPipeline(new Pipeline(pCtx), - Pipeline::Deleter(pCtx->opCtx)); + std::unique_ptr shardPipeline(new Pipeline(pCtx), + PipelineDeleter(pCtx->opCtx)); // Keep a copy of the original source list in case we need to reset the pipeline from split to // unsplit later. @@ -337,7 +339,7 @@ std::unique_ptr Pipeline::splitForSharded() { } void Pipeline::unsplitFromSharded( - std::unique_ptr pipelineForMergingShard) { + std::unique_ptr pipelineForMergingShard) { invariant(isSplitForShards()); invariant(!isSplitForMerge()); invariant(pipelineForMergingShard); -- cgit v1.2.1