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

[CQF] uasserts when memo encounters multiple empty value scans in different groups

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Optimization
    • ALL
    • QO 2023-12-11, QO 2023-12-25

    Description

      To reproduce:

       

      // In bonsai M2 mode
      db.c.drop()
      db.c.insert({a: {b: 1}})
      db.c.createIndex({"a.b": 1})
      db.c.find({$and: [{a: {$elemMatch: {b: {$elemMatch: {$gte: 1, $lte: 4}}}}}, {"a.b": {$in: [2, 5]}}]}).hint({$natural: 1})
      

       

      // In bonsai M4 mode
      db.c.drop()
      db.c.insert({a: {b: 1}})
      db.c.createIndex({"a.b": 1})
      db.c.find({$and: [{a: {$elemMatch: {b: {$elemMatch: {$gte: 1, $lte: 4}}}}}, {"a.b": {$in: [2, 5]}}]})

       

      This results in a uassert that we are inserting an empty value scan into the memo when such a node already exists in the memo in a different group. This occurs due to a combination of rewrites (filter decomposition, multikeyness simplification and filter substitution) resulting in multiple groups being simplified to an empty value scan.

      Some options we should consider are relaxing this assertion, allowing identical groups to be merged, and inserting a delegator to the other group in such a case.

       

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: