Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SERVER-12931 add failure status to working set if child stage fails w…

…ithout providing reason
  • Loading branch information...
commit d8f5f9a8221498e3637971fb0a74818d1d4782c5 1 parent 7ef1c03
Benety Goh benety authored
30 src/mongo/db/exec/and_hash.cpp
View
@@ -32,6 +32,7 @@
#include "mongo/db/exec/filter.h"
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/exec/working_set.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -108,6 +109,16 @@ namespace mongo {
else if (PlanStage::FAILURE == childStatus) {
// Propage error to parent.
*out = _lookAheadResults[i];
+ // 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 == *out) {
+ mongoutils::str::stream ss;
+ ss << "hashed AND stage failed to read in look ahead results "
+ << "from child " << i;
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
_hashingChildren = false;
_dataMap.clear();
@@ -250,6 +261,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == childStatus) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "hashed AND stage failed to read in results to from first child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
return childStatus;
}
else {
@@ -333,6 +353,16 @@ namespace mongo {
}
else if (PlanStage::FAILURE == childStatus) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "hashed AND stage failed to read in results from other child "
+ << _currentChild;
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
return childStatus;
}
else {
19 src/mongo/db/exec/and_sorted.cpp
View
@@ -31,6 +31,7 @@
#include "mongo/db/exec/and_common-inl.h"
#include "mongo/db/exec/filter.h"
#include "mongo/db/exec/working_set_common.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -109,6 +110,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == state) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "sorted AND stage failed to read in results from first child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
_isEOF = true;
return state;
}
@@ -218,6 +228,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == state) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "sorted AND stage failed to read in results from child " << workingChildNumber;
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
_isEOF = true;
_ws->free(_targetId);
return state;
9 src/mongo/db/exec/fetch.cpp
View
@@ -115,6 +115,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == status) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "fetch stage failed to read in results from child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
return status;
}
else {
11 src/mongo/db/exec/limit.cpp
View
@@ -27,6 +27,8 @@
*/
#include "mongo/db/exec/limit.h"
+#include "mongo/db/exec/working_set_common.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -54,6 +56,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == status) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "limit stage failed to read in results from child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
return status;
}
else {
10 src/mongo/db/exec/merge_sort.cpp
View
@@ -30,6 +30,7 @@
#include "mongo/db/exec/working_set.h"
#include "mongo/db/exec/working_set_common.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -122,6 +123,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == code) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "merge sort stage failed to read in results from child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
return code;
}
else {
11 src/mongo/db/exec/or.cpp
View
@@ -28,6 +28,8 @@
#include "mongo/db/exec/or.h"
#include "mongo/db/exec/filter.h"
+#include "mongo/db/exec/working_set_common.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -108,6 +110,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == childStatus) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "OR stage failed to read in results from child " << _currentChild;
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
return childStatus;
}
else {
9 src/mongo/db/exec/projection.cpp
View
@@ -72,6 +72,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == status) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "projection stage failed to read in results from child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
}
else if (PlanStage::NEED_FETCH == status) {
*out = id;
8 src/mongo/db/exec/s2near.cpp
View
@@ -258,7 +258,13 @@ namespace mongo {
double minDistance = numeric_limits<double>::max();
BSONObj minDistanceObj;
for (BSONElementSet::iterator git = geom.begin(); git != geom.end(); ++git) {
- if (!git->isABSONObj()) { return PlanStage::FAILURE; }
+ if (!git->isABSONObj()) {
+ mongoutils::str::stream ss;
+ ss << "s2near stage read invalid geometry element " << *git << " from child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ return PlanStage::FAILURE;
+ }
BSONObj obj = git->Obj();
double distToObj;
11 src/mongo/db/exec/skip.cpp
View
@@ -27,6 +27,8 @@
*/
#include "mongo/db/exec/skip.h"
+#include "mongo/db/exec/working_set_common.h"
+#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -61,6 +63,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == status) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "skip stage failed to read in results from child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
return status;
}
else {
9 src/mongo/db/exec/sort.cpp
View
@@ -362,6 +362,15 @@ namespace mongo {
}
else if (PlanStage::FAILURE == code) {
*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) {
+ mongoutils::str::stream ss;
+ ss << "sort stage failed to read in results to sort from child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
return code;
}
else {
9 src/mongo/db/exec/text.cpp
View
@@ -193,6 +193,15 @@ namespace mongo {
if (PlanStage::FAILURE == childState) {
// Propagate failure from below.
*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) {
+ mongoutils::str::stream ss;
+ ss << "text stage failed to read in results from child";
+ Status status(ErrorCodes::InternalError, ss);
+ *out = WorkingSetCommon::allocateStatusMember( _ws, status);
+ }
}
return childState;
}
Please sign in to comment.
Something went wrong with that request. Please try again.