[SERVER-32732] Explain on aggregation can fail Created: 17/Jan/18  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor - P4
Reporter: Ian Boros Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: query-44-grooming
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File document_source_sort_limit.patch    
Issue Links:
Duplicate
is duplicated by SERVER-32660 Inner PlanExecutor failing doesn't ha... Closed
Assigned Teams:
Query Execution
Operating System: ALL
Participants:

 Description   

Apply the attached patch (to limit the amount of memory available to the Sort stage) and then run the following:

    var largeStr = '';
    for (var i = 0; i < 32 * 1024; ++i) {
        largeStr += 'x';
    }
    for (var i = 0; i < 100; ++i) {
        assert.writeOK(coll.insert({a: largeStr, b: i}));
    }
    var res = db.explainsort.explain('executionStats').aggregate([{$sort: {a:1}}])

explain won't catch the "exceeded memory" error, and instead fail.

The entire explain will also fail if we throw an exception from the inner executor here.

To fix this, we may want to add a try-catch around the code where explain actually executes the plan, and add a new field like "executionSuccess" to the top level of explain's output.


Generated at Thu Feb 08 04:31:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.