[SERVER-83220] Lookup between unsplittable collections gets incorrectly pushed down to SBE Created: 14/Nov/23  Updated: 06/Feb/24  Resolved: 06/Feb/24

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

Type: Bug Priority: Major - P3
Reporter: Ivan Fefer Assignee: Mihai Andrei
Resolution: Fixed Votes: 0
Labels: auto-reverted
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Query Execution
Backwards Compatibility: Fully Compatible
Sprint: QE 2023-12-11, QE 2023-12-25, QE 2024-01-08, QE 2024-01-22, QE 2024-02-05, QE 2024-02-19
Participants:

 Description   

Currently, SBE doesn't support remote reads, so we check that all involved collections are unsharded, before we do $lookup in SBE:

https://github.com/mongodb/mongo/blob/fd12276470b4fc66c1b9d90cc8434907c8be86d6/src/mongo/db/pipeline/pipeline_d.cpp#L486

We need to check for data colocation instead.



 Comments   
Comment by Githook User [ 05/Feb/24 ]

Author:

{'name': 'Mihai Andrei', 'email': 'mihai.andrei@mongodb.com', 'username': 'mtandrei'}

Message: SERVER-83220 Introduce MultiCollectionRouter to correctly handle secondary collection shard versions for SBE $lookup pushdown

Co-authored-by: Jordi Serra Torrens <jordi.serra-torrens@mongodb.com>
GitOrigin-RevId: af2fa171664410e31170ca25521fd5ac8880805f
Branch: master
https://github.com/mongodb/mongo/commit/50fd4f4a9626e05e8094fd5f46007834e768bf9e

Comment by Githook User [ 03/Feb/24 ]

Author:

{'name': 'auto-revert-processor', 'email': 'dev-prod-dag@mongodb.com', 'username': ''}

Message: Revert "SERVER-83220 Introduce MultiCollectionRouter to correctly handle secondary collection shard versions for SBE $lookup pushdown"

This reverts commit a63db2a047e3b654820ac085a1207488b6418cd2.

GitOrigin-RevId: b67c20a8ac78de07743fa5df6cea83057ae92034
Branch: master
https://github.com/mongodb/mongo/commit/9039385b875c07532512ad2b24b33279d5412fbb

Comment by Githook User [ 03/Feb/24 ]

Author:

{'name': 'Mihai Andrei', 'email': 'mihai.andrei@mongodb.com', 'username': 'mtandrei'}

Message: SERVER-83220 Introduce MultiCollectionRouter to correctly handle secondary collection shard versions for SBE $lookup pushdown

Co-authored-by: Jordi Serra Torrens <jordi.serra-torrens@mongodb.com>
GitOrigin-RevId: a63db2a047e3b654820ac085a1207488b6418cd2
Branch: master
https://github.com/mongodb/mongo/commit/3ca96ff553cd9e80edcffe3a59afaa71ad9547fe

Comment by Ivan Fefer [ 20/Nov/23 ]

Good thing is that both isMainCollectionSharded and collections.isAnySecondaryNamespaceAViewOrSharded() are only used here, so we can remove this in favor of something like areAllNamespacesColocated() or something like that.

We need to change this code in db RAII: 

https://github.com/mongodb/mongo/blob/fd12276470b4fc66c1b9d90cc8434907c8be86d6/src/mongo/db/db_raii.cpp#L139

 

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