Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-73073

Refactor existing time-series deletes to use expression_algo::splitMatchExpressionBy()

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • Fully Compatible
    • Execution Team 2023-02-20
    • 171

      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.

            Assignee:
            yoonsoo.kim@mongodb.com Yoon Soo Kim
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: