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

Rework targetDelete() to use a single CanonicalQuery

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Execution
    • Fully Compatible
    • QE 2023-06-26, QE 2023-07-10, QE 2023-07-24

      The CollectionRoutingInfoTargeter::targetDelete() currently has few inefficiencies that we can improve. Here are a three improvements that we should consider.

      1. We should short circuit unsharded deletes at the beginning of the function and avoid parsing the query on mongos. We do this for targetUpdate()
      2. We make three different calls to CanonicalQuery::canonicalize() during this function, (1) inside extractShardKeyFromBasicQueryWithContext(), (2) top level of targetDelete() and (3) inside _targetQuery(). We should refactor all of these to use a single CanconicalQuery and ExpressionContext throughout.
      3. The "extract shard key from query" is first attempted in extractShardKeyFromBasicQueryWithContext() and then also inside the _targetQuery() ---> getShardIdsForQuery().

      I believe targetUpdate() can benefit from similar improvements.

            Assignee:
            sebastien.mendez@mongodb.com Sebastien Mendez
            Reporter:
            arun.banala@mongodb.com Arun Banala
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: