[SERVER-82218] Unify explain and execution path in sharded_agg_helpers Created: 16/Oct/23 Updated: 17/Nov/23 Resolved: 09/Nov/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.3.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Ivan Fefer | Assignee: | Ivan Fefer |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Sprint: | QE 2023-10-30, QE 2023-11-13 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
In sharded aggregations, explain() uses slightly different code to target shards than actual execution. explain() uses scatterGather functions: https://github.com/mongodb/mongo/blob/62b3b9a2d52afeae975c9c6dbb0430c77b72a055/src/mongo/db/pipeline/sharded_agg_helpers.cpp#L1214 This functions re-do the shard targeting, that is already done at this point. But execution path uses establishShardCursors function that just attaches shard and db version to the remote command and wraps the result into RemoteCursor: https://github.com/mongodb/mongo/blob/62b3b9a2d52afeae975c9c6dbb0430c77b72a055/src/mongo/db/pipeline/sharded_agg_helpers.cpp#L1242 This can lead to differences between explain() output and what actually happens. We should use a single function to do both things and only do targeting once.
Instead of having a separate function to do RemoteCursors and explain commands, we just need a single function to send out requests and a separate function to wrap results in RemoteCursors. |
| Comments |
| Comment by Githook User [ 09/Nov/23 ] |
|
Author: {'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}Message: |