[SERVER-64585] CollectionsInfo map doesn't contain foreign collection when $lookup is a sub-pipeline Created: 16/Mar/22  Updated: 29/Oct/23  Resolved: 22/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: Eric Cox (Inactive) Assignee: Mihai Andrei
Resolution: Fixed Votes: 0
Labels: sbe
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-64646 Investigate and fix test failures whe... Closed
is duplicated by SERVER-64723 Investigate and fix test failure at j... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Start mongod with lookup pushdown feature flag on,

./build/opt/install/bin/mongod --setParameter featureFlagSBELookupPushdown=true

Run these commands in a shell

> assert.commandWorked(db.createCollection("baseColl"));
> assert.commandWorked(db.createCollection("unionColl"));
> assert.commandWorked(db.createCollection("lookupColl"));
> db.baseColl.explain().aggregate([{$unionWith: {coll: "unionColl", pipeline: [{$lookup: {from: "lookupColl", localField: "_id", foreignField: "_id", as: "results"}}]}}])

The error we get is:

uncaught exception: Error: command failed: {uncaught exception: Error: command failed: { "ok" : 0, "errmsg" : "Expected collection info, but found none; target collection: test.lookupColl", "code" : 5842600, "codeName" : "Location5842600"} with original command request: { "aggregate" : "baseColl", "pipeline" : [ { "$unionWith" : { "coll" : "unionColl", "pipeline" : [ { "$lookup" : { "from" : "lookupColl", "localField" : "_id", "foreignField" : "_id", "as" : "results" } } ] } } ], "explain" : true, "cursor" : { }, "lsid" : { "id" : UUID("e48870c4-edc9-4044-9b0d-579a8a5fffd4") }}

 

Sprint: QE 2022-04-04, QE 2022-03-21
Participants:

 Description   

We are observing a tassert tripping when deciding on the lookup algorithm strategy when $lookup is a sub-pipeline of $unionWith. If I run the repro steps below and dump the collectionsInfo map in QueryPlannerAnalysis::determineLookupStrategy all that the map contains is

*** Collection info:
k = test.unionColl
*** Collection info done



 Comments   
Comment by Githook User [ 21/Mar/22 ]

Author:

{'name': 'Yoonsoo Kim', 'email': 'yoonsoo.kim@mongodb.com', 'username': 'yun-soo'}

Message: SERVER-64585 Fix use of 'MultipleCollectionAccessor' in 'attachCursorSourceToPipelineForLocalRead'

Co-authored-by: Mihai Andrei <mihai.andrei@10gen.com>
Branch: master
https://github.com/mongodb/mongo/commit/d7b2d79aad3db9ba365dd655cee6c8683a76e9e9

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