diff options
Diffstat (limited to 'src/mongo/db/exec/sort.cpp')
-rw-r--r-- | src/mongo/db/exec/sort.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp index 1a5f609ebb6..3347e25ff39 100644 --- a/src/mongo/db/exec/sort.cpp +++ b/src/mongo/db/exec/sort.cpp @@ -307,6 +307,11 @@ namespace mongo { } if (_memUsage > kMaxBytes) { + mongoutils::str::stream ss; + ss << "sort stage buffered data usage of " << _memUsage + << " bytes exceeds internal limit of " << kMaxBytes << " bytes"; + Status status(ErrorCodes::Overflow, ss); + *out = WorkingSetCommon::allocateStatusMember( _ws, status); return PlanStage::FAILURE; } @@ -314,7 +319,7 @@ namespace mongo { // Still reading in results to sort. if (!_sorted) { - WorkingSetID id; + WorkingSetID id = WorkingSet::INVALID_ID; StageState code = _child->work(&id); if (PlanStage::ADVANCED == code) { @@ -354,6 +359,10 @@ namespace mongo { ++_commonStats.needTime; return PlanStage::NEED_TIME; } + else if (PlanStage::FAILURE == code) { + *out = id; + return code; + } else { if (PlanStage::NEED_FETCH == code) { *out = id; |