[SERVER-35069] Explain should include command being explained Created: 18/May/18 Updated: 29/Oct/23 Resolved: 11/Nov/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | None |
| Fix Version/s: | 4.9.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Chris Harris | Assignee: | Ruoxin Xu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | QFB, asya, neweng, storch | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Sprint: | Query 2019-12-16, Query 2020-10-19, Query 2020-11-02, Query 2020-11-16 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
Updated summary: Original description: |
| Comments |
| Comment by Githook User [ 10/Nov/20 ] |
|
Author: {'name': 'Ruoxin Xu', 'email': 'ruoxin.xu@mongodb.com', 'username': 'RuoxinXu'}Message: |
| Comment by James Wahlin [ 10/Dec/19 ] |
|
Reviewing this again, our tentative plan to address will be to add the original command object to the explain output as a last step in the explain command. We will only add if doing so will not push the explain object over the 16MB limit. We can consider partial application of the original command message for future work. It will be tricky and potentially fragile as it will have to parse explain output with handling for each supported command. When explain is run against mongos, only mongos should inject the original command as doing so at the shard level will record redundant information and make it much more likely that we will exceed the 16MB limit. Part of the work for this ticket will be to figure out how best to recognize this. |
| Comment by Asya Kamsky [ 14/Mar/19 ] |
|
I’m specifically thinking that explain of update is to see how the query portion is going to be executed. We don’t currently explain anything about applying the update part so it seems ... strange to include it. |
| Comment by Charlie Swanson [ 13/Mar/19 ] |
|
asya why should we truncate the command if the explain is too large? Should we consider truncating 'rejectedPlans' instead? or perhaps 'serverInfo'? Choosing the command feels a little forced based on the fact that it's the latest addition - is it really the best place to trim? Are you proposing just adding the name of the command and hint and then keeping things as-is so that the command fails if the result BSON is larger than 16MB? |
| Comment by Asya Kamsky [ 13/Mar/19 ] |
|
charlie.swanson I think it’s fine/correct to exclude all the details of the command (maybe only if it’s big enough to blow out the limit). For instance for update we care about query portion not update portion. Aggregation could be very large but again just including which command is being run and whether a hint is specified is highest value. |
| Comment by Charlie Swanson [ 12/Jul/18 ] |
|
We briefly started to implement this but then ran into some issues and adjusted course. One interesting note that came out of the progress here: If you're explaining a large command (for example a replace-mode update with a large document), we will potentially blow the 16MB document size limit by including the entire command in the output. It may be reasonable/acceptable to fail the operation in this case? Deserves some thought. |
| Comment by Chris Harris [ 25/May/18 ] |
|
Great thought. That sounds like a reasonable approach to me. Feel free to change the title/description to match. |
| Comment by David Storch [ 22/May/18 ] |
|
Instead, should explain output include the full command which is being explained? That would prevent us from ever asking questions about the properties of the original command when it is not available. |