[SERVER-51886] $lookup + $merge pipeline may fail to resolve views correctly when collection names collide Created: 30/Oct/20 Updated: 29/Oct/23 Resolved: 04/Dec/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 4.2.0, 4.4.0 |
| Fix Version/s: | 4.9.0, 4.2.12, 4.4.4 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Max Hirschhorn | Assignee: | Mihai Andrei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Operating System: | ALL | ||||||||||||
| Backport Requested: |
v4.4, v4.2
|
||||||||||||
| Sprint: | Query 2020-11-30, Query 2020-12-14 | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
Getting the namespace involved in a cross-database $merge stage causes the StringMap<ResolvedNamespace> to store a key for the target collection name with an empty pipeline. But that collection name may also be the name for a collection or view in the database the aggregate command is being run against. For certain pipelines, this may cause a $lookup on a view to instead act as if it were performing the $lookup on an empty collection without erroring.
Note that because LiteParsedPipeline::getInvolvedNamespaces() returns a stdx::unordered_set<NamespaceString> that namespaces may be resolved in different orders across multiple aggregate command executions. And also note that because resolveInvolvedNamespaces() skips resolving a namespace if its collection name already exists in the StringMap, this issue would only manifest if the $merge namespace was resolved before the $lookup namespace. |
| Comments |
| Comment by Githook User [ 04/Jan/21 ] |
|
Author: {'name': 'Mihai Andrei', 'email': 'mihai.andrei@10gen.com', 'username': 'mtandrei'}Message: (cherry picked from commit 045829020fb4a3972b316b1ad60e9ed2f285b092) |
| Comment by Githook User [ 16/Dec/20 ] |
|
Author: {'name': 'Mihai Andrei', 'email': 'mihai.andrei@10gen.com', 'username': 'mtandrei'}Message: (cherry picked from commit 7ee29eedb7029d4e3563057b6329678f9102996a) |
| Comment by Githook User [ 15/Dec/20 ] |
|
Author: {'name': 'Mihai Andrei', 'email': 'mihai.andrei@10gen.com', 'username': 'mtandrei'}Message: |
| Comment by Githook User [ 10/Dec/20 ] |
|
Author: {'name': 'Mihai Andrei', 'email': 'mihai.andrei@10gen.com', 'username': 'mtandrei'}Message: (cherry picked from commit 045829020fb4a3972b316b1ad60e9ed2f285b092) |
| Comment by Githook User [ 03/Dec/20 ] |
|
Author: {'name': 'Mihai Andrei', 'email': 'mihai.andrei@10gen.com', 'username': 'mtandrei'}Message: |