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

Clarify tests for $group with null and missing values

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • QO 2022-07-25, QO 2022-08-08

    Description

      This ticket will:

      • Ensure we have proper js test coverage for the bug SERVER-23229, and
      • Investigate which bug exactly was fixed by SERVER-67416, and
      • Investigate how to best backport that bug fix, both for the fix and to quiet multiversion fuzzer BFs, like BF-12390.  The patch for SERVER-67416 involved 60+ files so it may be worth creating a more targeted patch.

      In more detail:

      The work in SERVER-67416 seems to have fixed some bug assertions in `groupMissing.js` that were originally attributed to SERVER-23229.  For example:

      coll.drop();
      coll.insert({a: null, b: 1});
      coll.insert({b: 1});
      coll.insert({a: null, b: 1});
       
      res = coll.aggregate({$group: {_id: {a: "$a", b: "$b"}}});
      assert(resultsEq(res.toArray(), [{_id: {b: 1}}, {_id: {a: null, b: 1}}]));
       
      // Bug, see SERVER-23229.
      coll.createIndex({a: 1, b: 1});
      res = coll.aggregate({$sort: {a: 1, b: 1}}, {$group: {_id: {a: "$a", b: "$b"}}});
      assert(resultsEq(res.toArray(), [{_id: {a: null, b: 1}}]));
       
      // Correct behavior after SERVER-23229 is fixed.
      if (0) {
          coll.createIndex({a: 1, b: 1});
          res = coll.aggregate({$sort: {a: 1, b: 1}}, {$group: {_id: {a: "$a", b: "$b"}}});
          assert(resultsEq(res.toArray(), [{_id: {b: 1}}, {_id: {a: null, b: 1}}]));
      }

      After SERVER-67416, the correct behavior is observed.  However, we know bug has nothing to do with SERVER-23229 because:

      • SERVER-67416 did not touch the well-known root cause of SERVER-23229.
      • the queries above are never using PROJECTION_COVERED plans.

      Attachments

        Activity

          People

            steve.tarzia@mongodb.com Steve Tarzia
            steve.tarzia@mongodb.com Steve Tarzia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: