-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
$facet and $lookup each run entire sub-pipeline executions inside one doGetNext() call. Sub-pipeline stages check interrupts every 128 getNext() calls via Stage::getNext -> ExpressionContext::InterruptChecker, but (a) sub-pipelines processing fewer than 128 docs may never trip the amortized checker (each sub-pipeline has its own ExpressionContext counter), (b) per-input plan build/optimize/translate cost is check-free, and (c) blocking sub-stages expose their full span inside the call (addressed by the $group ticket and SERVER-135754). These changes bound the stage-level span regardless of sub-pipeline contents.
Changes
- $facet drain — FacetStage::doGetNext() (src/mongo/db/exec/agg/facet_stage.cpp, while (!allPipelinesEOF) loop ~line 121): the entire facet output is produced in this one call, draining every sub-pipeline to EOF. Add pExpCtx->checkForInterrupt(); per round-robin pass over the facets.
- $lookup non-unwind drain — LookUpStage::doGetNext() (src/mongo/db/exec/agg/lookup_stage.cpp, while (auto result = execPipeline->getNext()) ~line 291): drains the entire sub-pipeline for one input doc, accumulating results. Add pExpCtx->checkForInterrupt(); per iteration.
- $lookup unwind loop — LookUpStage::unwindResult() (same file, ~line 571): each iteration disposes the previous sub-pipeline, pulls one input, and rebuilds (buildPipeline + exec::agg::buildPipeline, including view resolution). Add pExpCtx->checkForInterrupt(); at the top of each iteration.
Equality $lookups lowered to SBE (hash_lookup.cpp build draining via innerChild()->getNext(), hybrid_hash_join) are already covered — child scan stages check per record (scan.h handleInterruptAndSlotAccess).
- is related to
-
SERVER-135750 Investigate fixes to ticket and interrupt delinquency that occur in $facet, $group, $lookup, and distinct
-
- Backlog
-
-
SERVER-135754 Update $sort’s custom comparator to check for interrupt every few thousand documents.
-
- Closed
-
- related to
-
SERVER-135750 Investigate fixes to ticket and interrupt delinquency that occur in $facet, $group, $lookup, and distinct
-
- Backlog
-