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

Update MatchExpression optimizations to respect BSON lifetime

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Optimization
    • QO 2024-05-13, QO 2024-05-27

      This test in particular demonstrates the problem when we apply to change pending for SERVER-87277 (delete backing BSONObj for ComparisonMatchExpression).

      {$or: [{a: 1}, {a: 1}]}

      Will first optimize to

      {a: {$in: [1, 1]}}
      

      as part of the $or -> $in rewrite. This rewrite currently will construct new BSON for each element of the $in operand. Then we recursively invoke MatchExpression optimization, which ends up destroying the $in and the backing BSON for [1, 1].

      The recursive invocation will end up in the $in -> $eq rewrite, which currently initializes the $eq with a BSONElement.

       

       

            Assignee:
            matt.olma@mongodb.com Matt Olma
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: