[SERVER-67963] Clarify tests for $group with null and missing values Created: 11/Jul/22  Updated: 29/Oct/23  Resolved: 29/Jul/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Steve Tarzia Assignee: Steve Tarzia
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: QO 2022-07-25, QO 2022-08-08
Participants:

 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.


 Comments   
Comment by Steve Tarzia [ 29/Jul/22 ]

Merged in https://github.com/mongodb/mongo/commit/522b73cf2ee3904b039d97c0e0f107d6faedd748.

Comment by Steve Tarzia [ 13/Jul/22 ]

The result of my investigation is that no bugs were fixed by SERVER-67416.  The tests results from groupMissing.js are the same on today's master as on 6.0.0rc10.  In my patch I've expanded this test and corrected the comments.

Generated at Thu Feb 08 06:09:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.