-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Integration
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
If a $lookup subpipeline goes through addCacheStageAndOptimize() there is no call to pipeline->validateCommon() post-optimization. One of the ramifications is that for subpipelines with DocumentSourceChangeStreamSplitLargeEvent or DocumentSourceGeoNear, validatePipelinePosition() will be bypassed entirely, as alreadyOptimized will always be false.
Thus, in the case for a $lookup whose subpipeline has $geoNear as not-the-first-stage in the pipeline, the command does not uassert because of the misplacement of the stage. This is followed by DocumentSourceGeoNear not getting swapped into DocumentSourceGeoNearCursor as that only happens when it's at the front of the pipeline. Further down the line, when trying to execute the pipeline, we hit the 10395401 tassert as there is no agg::Stage for DocumentSourceGeoNear, since only DocumentSourceGeoNearCursor has an agg::Stage.
In 8.0 we hit a MONGO_UNREACHABLE_TASSERT (see AF-7237) as the QE/QO split wasn't in place yet and we'd try to call DocumentSourceGeoNear::doGetNext().