[SERVER-73073] Refactor existing time-series deletes to use expression_algo::splitMatchExpressionBy() Created: 19/Jan/23  Updated: 29/Oct/23  Resolved: 25/Feb/23

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

Type: Improvement Priority: Major - P3
Reporter: Charlie Swanson Assignee: Yoon Soo Kim
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-73535 Add more support for $jsonSchema in '... Closed
depends on SERVER-73074 Add splitMatchExpressionBy test cases... Closed
depends on SERVER-73914 Implement renames for kArrayMatching ... Closed
is depended on by SERVER-73142 Add multi-update ability for TS_WRITE... Closed
is depended on by SERVER-73077 Add TS_WRITE stage which supports mul... Closed
Problem/Incident
Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2023-02-20
Participants:
Linked BF Score: 171

 Description   

The existing delete path calls into 'timeseries::translateQuery()', which is an algorithm over the raw BSON object. We have well tested algorithms to do essentially the same thing - the 'renames' argument to expression_algo::splitMatchExpressionBy() will provide the same ability to detect, split, and rename the predicates on the meta field. It returns a pair of new MatchExpressions, one of which has the renames applied and should be only the meta expressions. The other one will have "the rest." For now, if "the rest" is not nullptr we can return an error - that's the current behavior. Caveat: the current helper function may or may not support the same expressions. It looks like it attempts to support some $jsonSchema operators which I don't think we bother to do in the 'splitMatchExpressionBy()' algorithm.

The catch of course is that it operates on a MatchExpression*, which we don't have at the point we call 'timeseries::translateQuery()' today. This is conceptually quite easy - we can just parse the query earlier. In practice it turns out to be tricky though due to the way we used this 'DeleteRequest' and 'ParsedDelete' utilities, and how we cannot correctly parse a query until we've made an ExpressionContext - which should have the correct collator set - among other params.

So this ticket tracks just the work for the delete path. There will be similar work focused on UpdateRequest and ParsedUpdate later in a subsequent ticket.



 Comments   
Comment by Githook User [ 25/Feb/23 ]

Author:

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

Message: SERVER-73073 Refactor existing time-series deletes to use splitMatchExpressionBy()
Branch: master
https://github.com/mongodb/mongo/commit/ffc0b6855b8152e2211353fb8a1038fa41815160

Comment by Githook User [ 24/Feb/23 ]

Author:

{'name': 'liubov.molchanova', 'email': 'liubov.molchanova@mongodb.com', 'username': 'liubov-molchanova'}

Message: Revert "SERVER-73073 Refactor existing time-series deletes to use splitMatchExpressionBy()"

This reverts commit 20947dce4e6bd0a07f83b7d32f858c1e060a914d.
Branch: master
https://github.com/mongodb/mongo/commit/8b6bcdb6ef76c1548ea046447c23e32d72003566

Comment by Githook User [ 24/Feb/23 ]

Author:

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

Message: SERVER-73073 Refactor existing time-series deletes to use splitMatchExpressionBy()
Branch: master
https://github.com/mongodb/mongo/commit/20947dce4e6bd0a07f83b7d32f858c1e060a914d

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