summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/count.cpp
diff options
context:
space:
mode:
authorNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-04-27 15:49:07 -0400
committerNick Zolnierz <nicholas.zolnierz@mongodb.com>2018-05-01 13:47:50 -0400
commit46f72213f60bd74367a11aec7f02b38780ae7c3a (patch)
tree45018ee4a9531cb973f6fbb96c321ef44774278c /src/mongo/db/exec/count.cpp
parent0d097ebf4d5c78e77d789dad3f8a45a942d37d47 (diff)
downloadmongo-46f72213f60bd74367a11aec7f02b38780ae7c3a.tar.gz
SERVER-34725: Group and count plan stages do not set the WorkingSetID output on PlanStage::DEAD state
Diffstat (limited to 'src/mongo/db/exec/count.cpp')
-rw-r--r--src/mongo/db/exec/count.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/mongo/db/exec/count.cpp b/src/mongo/db/exec/count.cpp
index 61e50d7b305..bf97950426e 100644
--- a/src/mongo/db/exec/count.cpp
+++ b/src/mongo/db/exec/count.cpp
@@ -119,17 +119,11 @@ PlanStage::StageState CountStage::doWork(WorkingSetID* out) {
if (PlanStage::IS_EOF == state) {
_commonStats.isEOF = true;
return PlanStage::IS_EOF;
- } else if (PlanStage::DEAD == state) {
- return state;
- } else if (PlanStage::FAILURE == state) {
+ } else if (PlanStage::FAILURE == state || PlanStage::DEAD == state) {
+ // The stage which produces a failure is responsible for allocating a working set member
+ // with error details.
+ invariant(WorkingSet::INVALID_ID != id);
*out = id;
- // If a stage fails, it may create a status WSM to indicate why it failed, in which
- // case 'id' is valid. If ID is invalid, we create our own error message.
- if (WorkingSet::INVALID_ID == id) {
- const std::string errmsg = "count stage failed to read result from child";
- Status status = Status(ErrorCodes::InternalError, errmsg);
- *out = WorkingSetCommon::allocateStatusMember(_ws, status);
- }
return state;
} else if (PlanStage::ADVANCED == state) {
// We got a result. If we're still skipping, then decrement the number left to skip.