[SERVER-80922] Object field order is undefined when using $setWindowField Created: 08/Sep/23 Updated: 08/Dec/23 Resolved: 13/Oct/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 7.0.0, 7.0.1, 6.3.2 |
| Fix Version/s: | 7.2.0-rc0, 7.0.5, 7.1.2 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Colin Stolley | Assignee: | Drew Paroski |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Query Execution
|
||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||
| Backport Requested: |
v7.1, v7.0
|
||||||||||||
| Sprint: | QE 2023-10-02, QE 2023-10-16 | ||||||||||||
| Participants: | |||||||||||||
| Linked BF Score: | 105 | ||||||||||||
| Description |
|
We store $setWindowFields output functions in a StringMap, which has an undefined iteration order. This can cause the field order to vary from one execution to the next. This can lead to surprising results, as illustrated in the following reproduction script:
The output from the above script oscillates between:
and
depending on how the field order comes out. Converting the above StringMap to a std::map fixes the oscillation issue, but it's unclear if we should do more to enforce a specific field order. This was first spotted by the fuzzer in BF-29818. |
| Comments |
| Comment by Githook User [ 07/Dec/23 ] |
|
Author: {'name': 'Matthew Boros', 'email': 'matt.boros@mongodb.com', 'username': 'mattBoros'}Message: GitOrigin-RevId: d37a2b7583d2f2b6a6c6f65e5a5b270f1d9488bc |
| Comment by Githook User [ 07/Dec/23 ] |
|
Author: {'name': 'Matthew Boros', 'email': 'matt.boros@mongodb.com', 'username': 'mattBoros'}Message: |
| Comment by Matt Boros [ 01/Dec/23 ] |
|
projjal.chanda@mongodb.com did we consider backporting this? I'm seeing a multiversion fuzzer failure where the root cause is this issue. (BF-30994) |
| Comment by Githook User [ 12/Oct/23 ] |
|
Author: {'name': 'Projjal Chanda', 'email': 'projjal.chanda@mongodb.com', 'username': 'projjal'}Message: |
| Comment by Kevin Cherkauer [ 08/Sep/23 ] |
|
This same kind of thing is occurring in BF-29907 for $project pushed down to SBE (with some as-yet unexplained dependency on a $sort having been done first). Concise repro and differences are documented in this comment in the BF. |