[SERVER-33895] Not needed SORT_KEY_GENERATOR in aggregation explain output Created: 14/Mar/18 Updated: 25/Apr/18 Resolved: 25/Apr/18 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | 3.6.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Renato Riccio | Assignee: | Charlie Swanson |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
|||||||||||||||
| Operating System: | ALL | |||||||||||||||
| Steps To Reproduce: |
|
|||||||||||||||
| Sprint: | Query 2018-05-07 | |||||||||||||||
| Participants: | ||||||||||||||||
| Description |
|
In 3.6 the aggregation explain output shows a SORT_KEY_GENERATOR stage even when it is not needed. |
| Comments |
| Comment by Charlie Swanson [ 25/Apr/18 ] | |
|
It looks like this is simply a bug in the explain output. In the reproduction script the output for the following line does not include a SORT_KEY_GENERATOR stage:
This is because the explain path on mongos diverges from the regular, non-explain path pretty early. In particular, the non-explain path will transform the query sent to the shards in transformQueryForShards. This transformation does not happen in the explain path, and causes us to leave off the projection {$sortKey: 1} which will signal to the shards that we intend to merge the sorted output on mongos. I think this is a different symptom, but the same root cause as the bug described in SERVER-29449. I'll clean up and generalize that ticket, then close this one as a duplicate. | |
| Comment by Asya Kamsky [ 09/Apr/18 ] | |
|
Aggregation needs the sort keys to merge sorted streams on mongos. The real question seems to be why doesn't find show the same? |