-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
-
QE 2025-06-23, QE 2025-07-07
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
0
The sub-pipeline of the DocumentSourceLookUp stage is sometimes re-written and re-optimized in case of uncorelated subquery into using caching stage DocumentSourceSequentialDocumentCache.
Currently, DocumentSourceSequentialDocumentCache::doOptimizeAt() 'disposes' the pipeline stages it removes from the pipeline. This code still relies on the fact that all stages are always shared between QO and QE pipelines.
If we simply remove the dispose() call, as we tried inĀ PR#36750, the dispose() is not called on the stages that were removed from the pipeline.
We need to remove calling dispose() from doOptimizeAt(), but we still need to call dispose() for the removed stages, because these stages were already 'executed' (this is how the lookup stage is implemented). We can call dispose() on these stages before the new execution pipeline is created in DocumentSourceLookUp.