[SERVER-77737] $top/$bottom gives incorrect result for sharded collection and constant expressions Created: 02/Jun/23 Updated: 29/Oct/23 Resolved: 06/Jun/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Rui Liu | Assignee: | Rui Liu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | auto-reverted | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Sprint: | QE 2023-06-12 | ||||
| Participants: | |||||
| Linked BF Score: | 164 | ||||
| Description |
|
For sharded collection, the following query gives incorrect results:
This is a pretty useless query. However, the results from both Classic engine and SBE are incorrect:
This is due to the erroneous logic for serializing constant argument: https://github.com/10gen/mongo/blob/c6b787ec1d8cc77b3ae09fda85e278cd6e752ee6/src/mongo/db/pipeline/accumulator_multi.cpp#L473 When the argument is constant, the serialized value will be {$const: {output: ...}} instead of {output: ...}, so the logic to distinguish merging group is wrong and the output field is appended incorrectly. |
| Comments |
| Comment by Githook User [ 06/Jun/23 ] |
|
Author: {'name': 'Rui Liu', 'email': 'lriuui0x0@gmail.com', 'username': 'lriuui0x0'}Message: |
| Comment by xgen-buildbaron-user [ 06/Jun/23 ] |
|
Ticket re-opened due to revert. aggregation began a consistent failure of jstests\aggregation\accumulators\top_bottom_top_n_bottom_n.js |
| Comment by Githook User [ 06/Jun/23 ] |
|
Author: {'name': 'auto-revert-processor', 'email': 'dev-prod-dag@mongodb.com', 'username': ''}Message: Revert " This reverts commit f0ecff46204b3f308b90d9f0750568f9673fd65b. |
| Comment by Githook User [ 05/Jun/23 ] |
|
Author: {'name': 'Rui Liu', 'email': 'lriuui0x0@gmail.com', 'username': 'lriuui0x0'}Message: |