[SERVER-68691] $graphLookup does not report variable references for 'restrictSearchWithMatch' filter Created: 09/Aug/22  Updated: 29/Oct/23  Resolved: 31/Aug/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 6.0.0-rc13
Fix Version/s: 4.2.23, 4.4.17, 5.0.13, 6.0.2

Type: Bug Priority: Major - P3
Reporter: Nicholas Zolnierz Assignee: Nicholas Zolnierz
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-63845 Separate interface to get set of refe... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0, v4.4, v4.2
Sprint: QO 2022-09-05
Participants:

 Description   

As part of $lookup sub-pipeline correlation analysis, we try to detect the largest prefix of the pipeline which is non-correlated and temporarily cache the result instead of re-running for each document in the outer pipeline. This optimization relies on each aggregation stage correctly reporting it's variable dependencies, which may include a variable defined in the 'let' of the $lookup.

However $graphLookup does not fully report its dependencies for the 'restrictSearchWithMatch' option, which means if its contained in a $lookup sub-pipeline then it may be incorrectly treated as non-correlated.



 Comments   
Comment by Githook User [ 06/Sep/22 ]

Author:

{'name': 'Nicholas Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}

Message: SERVER-68691 Report variable references for $graphLookup 'restrictSearchWithMatch' filter

(cherry picked from commit 5521f98c392f8af2fbb678f3cbf8089b641d9dba)
Branch: v4.4
https://github.com/mongodb/mongo/commit/85a44be9eed8f1b3663798a4c585339fe981afcc

Comment by Githook User [ 06/Sep/22 ]

Author:

{'name': 'Nicholas Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}

Message: SERVER-68691 Report variable references for $graphLookup 'restrictSearchWithMatch' filter

(cherry picked from commit 5521f98c392f8af2fbb678f3cbf8089b641d9dba)
Branch: v4.2
https://github.com/mongodb/mongo/commit/e187062b23c92bda0eef094ec222f555db783563

Comment by Githook User [ 02/Sep/22 ]

Author:

{'name': 'Nicholas Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}

Message: SERVER-68691 Report variable references for $graphLookup 'restrictSearchWithMatch' filter

(cherry picked from commit 5521f98c392f8af2fbb678f3cbf8089b641d9dba)
Branch: v5.0
https://github.com/mongodb/mongo/commit/4b37709d13d1ee29cb0420f875af4cd19d3c2a6c

Comment by Githook User [ 30/Aug/22 ]

Author:

{'name': 'Nicholas Zolnierz', 'email': 'nicholas.zolnierz@mongodb.com', 'username': 'nzolnierzmdb'}

Message: SERVER-68691 Report variable references for $graphLookup 'restrictSearchWithMatch' filter
Branch: v6.0
https://github.com/mongodb/mongo/commit/5521f98c392f8af2fbb678f3cbf8089b641d9dba

Comment by Nicholas Zolnierz [ 09/Aug/22 ]

Marking as related to SERVER-63845 as that ticket fixes the issue in a bit of a different way, but is not planning to be back ported so this ticket would track 6.0 and earlier versions.

Generated at Thu Feb 08 06:11:29 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.