[SERVER-64123] $elemMatch value predicate causes queries to accidentally fall back to the classic engine Created: 02/Mar/22  Updated: 29/Oct/23  Resolved: 12/Sep/22

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

Type: Bug Priority: Major - P3
Reporter: David Storch Assignee: Drew Paroski
Resolution: Fixed Votes: 0
Labels: pm2697-m2, quick-tech-debt, sbe
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-59757 Evaluate supporting queries with matc... Closed
Related
is related to SERVER-59757 Evaluate supporting queries with matc... Closed
is related to SERVER-57854 Changed behavior in SBE when filter i... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QE 2022-08-08, QE 2022-09-19
Participants:

 Description   

When SBE was first implemented, it supported execution of $elemMatch value expressions. We still have plenty of code to handle translation of $elemMatch value to an SBE plan (see here).

We subsequently made a change in SERVER-57854 to fallback to the classic engine when there are predicates over empty field names. This is implemented by marking the query SBE-incompatible if any path predicate with an empty path is detected. This had the unintended side effect of preventing queries involving $elemMatch value from ever executing in SBE. The reason (as noted in SERVER-59757) is that the match expression parser internally creates predicates with empty field names as part of constructing the MatchExpression tree to represent an $elemMatch value.

This isn't technically a correctness bug, but it does leave the code base in a confusing state. The code appears to support $elemMatch value in SBE, but in fact it does not. The work for this ticket is to restore $elemMatch value support in SBE via the stage builders (or potentially delete the dead stage builder code?).



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

Author:

{'name': 'Drew Paroski', 'email': 'drew.paroski@mongodb.com', 'username': 'paroski'}

Message: SERVER-64123 Re-enable support for ElemMatchValueMatchExpressions in SBE
Branch: master
https://github.com/mongodb/mongo/commit/2f78c8ce493186984bd630b6e9678699d740a66c

Comment by Kyle Suarez [ 07/Jul/22 ]

CC mickey.winters@mongodb.com, jennifer.peshansky@mongodb.com

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