summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/pipeline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/pipeline/pipeline.cpp')
-rw-r--r--src/mongo/db/pipeline/pipeline.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/pipeline/pipeline.cpp b/src/mongo/db/pipeline/pipeline.cpp
index 5c2ce92237f..89975fc4cf2 100644
--- a/src/mongo/db/pipeline/pipeline.cpp
+++ b/src/mongo/db/pipeline/pipeline.cpp
@@ -272,8 +272,7 @@ void Pipeline::dispose(OperationContext* opCtx) {
pCtx->opCtx = opCtx;
// Make sure all stages are connected, in case we are being disposed via an error path and
- // were
- // not stitched at the time of the error.
+ // were not stitched at the time of the error.
stitch();
if (!_sources.empty()) {
@@ -332,6 +331,7 @@ void Pipeline::unsplitFromSharded(
_unsplitSources.reset();
_splitForSharded = false;
+
stitch();
}
@@ -351,6 +351,8 @@ void Pipeline::Optimizations::Sharded::findSplitPoint(Pipeline* shardPipe, Pipel
// split this source into Merge and Shard _sources
intrusive_ptr<DocumentSource> shardSource = splittable->getShardSource();
intrusive_ptr<DocumentSource> mergeSource = splittable->getMergeSource();
+ invariant(shardSource != mergeSource);
+
if (shardSource)
shardPipe->_sources.push_back(shardSource);
if (mergeSource)