-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Optimization
-
QO 2025-02-17
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
-
0
Currently, the ExpressionContext::copyWith() function explicitly selects which properties to copy over from the parent expCtx to the child expCtx, e.g. for the subpipeline in pipeline-style $lookup. However, this seems very error-prone as the subpipeline likely should inherit most of its properties from the higher-level expCtx. If any new properties are added to the expCtx in the future, it's very easy to overlook updating the copyWith function here.
This came out of an investigation for a bug where a bounded sort optimization was incorrectly applied to a $lookup pipeline where the foreign collection had extended range timeseries values - the subpipeline previously didn't inherit the _requiresExtendedRangeSupportForTimeseries value from the parent expCtx.
It seems like a better design would be to clone all properties by default, and explicitly opt-out of cloning for properties that should be different between the parent and subpipeline. An audit of what's currently cloned and whether we're missing any important properties should also be done as part of this ticket.
- is related to
-
SERVER-104719 $lookup on time-series collection using bounded sorter can lead to incorrect uassert
-
- Closed
-
- related to
-
SERVER-105533 Correctly track _isIncompatibleWithMemoryTracking from foreign coll in $lookup
-
- Backlog
-