summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-02-27 10:18:43 -0500
committerBenety Goh <benety@mongodb.com>2014-02-27 15:14:00 -0500
commitd8f5f9a8221498e3637971fb0a74818d1d4782c5 (patch)
tree19e699062041426db4aa90bfa49bcb5b30be91d5 /src
parent7ef1c038a8b7929a687eb931e8861deef444ce22 (diff)
downloadmongo-d8f5f9a8221498e3637971fb0a74818d1d4782c5.tar.gz
SERVER-12931 add failure status to working set if child stage fails without providing reason
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/exec/and_hash.cpp30
-rw-r--r--src/mongo/db/exec/and_sorted.cpp19
-rw-r--r--src/mongo/db/exec/fetch.cpp9
-rw-r--r--src/mongo/db/exec/limit.cpp11
-rw-r--r--src/mongo/db/exec/merge_sort.cpp10
-rw-r--r--src/mongo/db/exec/or.cpp11
-rw-r--r--src/mongo/db/exec/projection.cpp9
-rw-r--r--src/mongo/db/exec/s2near.cpp8
-rw-r--r--src/mongo/db/exec/skip.cpp11
-rw-r--r--src/mongo/db/exec/sort.cpp9
-rw-r--r--src/mongo/db/exec/text.cpp9
11 files changed, 135 insertions, 1 deletions
diff --git a/src/mongo/db/exec/and_hash.cpp b/src/mongo/db/exec/and_hash.cpp
index 683009ac7e0..8f60859b58f 100644
--- a/src/mongo/db/exec/and_hash.cpp
+++ b/src/mongo/db/exec/and_hash.cpp
@@ -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 {
diff --git a/src/mongo/db/exec/and_sorted.cpp b/src/mongo/db/exec/and_sorted.cpp
index 2e123455579..51741e4f974 100644
--- a/src/mongo/db/exec/and_sorted.cpp
+++ b/src/mongo/db/exec/and_sorted.cpp
@@ -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;
diff --git a/src/mongo/db/exec/fetch.cpp b/src/mongo/db/exec/fetch.cpp
index 6bd37d3de7f..d255050fffa 100644
--- a/src/mongo/db/exec/fetch.cpp
+++ b/src/mongo/db/exec/fetch.cpp
@@ -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 {
diff --git a/src/mongo/db/exec/limit.cpp b/src/mongo/db/exec/limit.cpp
index 879f0b86e37..da0b9e03cc1 100644
--- a/src/mongo/db/exec/limit.cpp
+++ b/src/mongo/db/exec/limit.cpp
@@ -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 {
diff --git a/src/mongo/db/exec/merge_sort.cpp b/src/mongo/db/exec/merge_sort.cpp
index 52d1c00bd67..8e8c760c336 100644
--- a/src/mongo/db/exec/merge_sort.cpp
+++ b/src/mongo/db/exec/merge_sort.cpp
@@ -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 {
diff --git a/src/mongo/db/exec/or.cpp b/src/mongo/db/exec/or.cpp
index 8387369c900..83a441d3896 100644
--- a/src/mongo/db/exec/or.cpp
+++ b/src/mongo/db/exec/or.cpp
@@ -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 {
diff --git a/src/mongo/db/exec/projection.cpp b/src/mongo/db/exec/projection.cpp
index d83dd757366..1a094011193 100644
--- a/src/mongo/db/exec/projection.cpp
+++ b/src/mongo/db/exec/projection.cpp
@@ -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;
diff --git a/src/mongo/db/exec/s2near.cpp b/src/mongo/db/exec/s2near.cpp
index fb7cc66eff9..7a28348d854 100644
--- a/src/mongo/db/exec/s2near.cpp
+++ b/src/mongo/db/exec/s2near.cpp
@@ -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;
diff --git a/src/mongo/db/exec/skip.cpp b/src/mongo/db/exec/skip.cpp
index 09401905d11..b79bdccb307 100644
--- a/src/mongo/db/exec/skip.cpp
+++ b/src/mongo/db/exec/skip.cpp
@@ -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 {
diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp
index a7bff5a1e98..69862c65258 100644
--- a/src/mongo/db/exec/sort.cpp
+++ b/src/mongo/db/exec/sort.cpp
@@ -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 {
diff --git a/src/mongo/db/exec/text.cpp b/src/mongo/db/exec/text.cpp
index 15a32d2cc33..2d14ea004c5 100644
--- a/src/mongo/db/exec/text.cpp
+++ b/src/mongo/db/exec/text.cpp
@@ -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;
}