SERVER-132297ClosedFixed

Prevent plan shape counters from executing on foreign side of classic $lookup

In the current implementation of the plan shape counters, we increment for each query to the foreign collection when a $lookup is executed in classic. Our intention was to only increment them for the local side, this fixes the issue by first checking some data on the canonicalQuery about if we're in a $lookup or a subpipeline The counters are incremented for every query to the foreign collection, which has caused minor perf regressions

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
9.1.0-rc09.0.0-rc2
Components
Server components related to this issue

No components specified.

Labels
Tags and classification
bkpplan-shape-counters