-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
ALL
-
-
200
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Currently, we use the canonical query from ParsedUpdate to serialize the q with serialization options. However, the match expression (`CanonicalQuery::getPrimaryMatchExpression()`) has been optimized. That leads to problem with parsing. For example:
- Given a query: {$or: [{_id: 1}, \{_id: 1}]}
- In ParsedUpdate, it is optimized to {_id: 1}
- When its debugging format is requests by $queryStats, the optimized query {_id: 1} will not be parsed by ParsedUpdate because ParsedUpdate recognizes it as IDHACK.
In general, we should not shapify using an optimized match expression. So we should seek solution to obtain an unoptimized match expression when shapifying an update.
How does find obtain an unoptimized query?
We could refer to find command shapes to see how it avoid this issue. The steps it takes to shapify a find:
- Construct a ParsedFindCommand. This contains an unoptimized MatchExpression.
- Use this MatchExpression to shapifying FindCmdShape.
- Then, it std::move(ParsedFindCommand) to the constructor of CanonicalQuery
- Eventually, the CanonicalQuery takes the ownership of that and generates an optimized MatchExpression. (i.e. an unoptimized MatchExpression no longer exists beyond this point)
We may follow the approach to break down the parsing of update commands into similar steps such that we can obtain an unoptimized query when registering an request.
- duplicates
-
SERVER-113840 Refactor ParsedUpdate to allow shapifying with unoptimized query
-
- Closed
-