diff options
author | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-03-01 11:56:31 -0500 |
---|---|---|
committer | Tess Avitabile <tess.avitabile@mongodb.com> | 2016-03-09 16:12:50 -0500 |
commit | c75dbbf696febfd4f5649088934cdb1e80743352 (patch) | |
tree | 3787e1df612195a18272c0b10be3b7386a4973f9 | |
parent | f313d9f91a28661b0a7fc18eb6216596ce0051fb (diff) | |
download | mongo-c75dbbf696febfd4f5649088934cdb1e80743352.tar.gz |
SERVER-22871 splitChunk needs to check for a failed index scan
-rw-r--r-- | src/mongo/s/d_split.cpp | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/mongo/s/d_split.cpp b/src/mongo/s/d_split.cpp index 3b72bbca20c..e2d06e61853 100644 --- a/src/mongo/s/d_split.cpp +++ b/src/mongo/s/d_split.cpp @@ -44,6 +44,7 @@ #include "mongo/db/commands.h" #include "mongo/db/db_raii.h" #include "mongo/db/dbhelpers.h" +#include "mongo/db/exec/working_set_common.h" #include "mongo/db/index_legacy.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/db/instance.h" @@ -173,7 +174,8 @@ public: RecordId loc; BSONObj currKey; - while (PlanExecutor::ADVANCED == exec->getNext(&currKey, &loc)) { + PlanExecutor::ExecState state; + while (PlanExecutor::ADVANCED == (state = exec->getNext(&currKey, &loc))) { // check that current key contains non missing elements for all fields in keyPattern BSONObjIterator i(currKey); for (int k = 0; k < keyPatternLength; k++) { @@ -210,6 +212,14 @@ public: } } + if (PlanExecutor::DEAD == state || PlanExecutor::FAILURE == state) { + return appendCommandStatus( + result, + Status(ErrorCodes::OperationFailed, + str::stream() << "Executor error while checking sharding index: " + << WorkingSetCommon::toStatusString(currKey))); + } + return true; } } cmdCheckShardingIndex; @@ -455,6 +465,14 @@ public: state = exec->getNext(&currKey, NULL); } + if (PlanExecutor::DEAD == state || PlanExecutor::FAILURE == state) { + return appendCommandStatus( + result, + Status(ErrorCodes::OperationFailed, + str::stream() << "Executor error during splitVector command: " + << WorkingSetCommon::toStatusString(currKey))); + } + if (!forceMedianSplit) break; @@ -939,12 +957,17 @@ private: PlanExecutor::YIELD_MANUAL)); // check if exactly one document found - if (PlanExecutor::ADVANCED == exec->getNext(NULL, NULL)) { - if (PlanExecutor::IS_EOF == exec->getNext(NULL, NULL)) { + PlanExecutor::ExecState state; + BSONObj obj; + if (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, NULL))) { + if (PlanExecutor::IS_EOF == (state = exec->getNext(&obj, NULL))) { return true; } } + // Non-yielding collection scans from InternalPlanner will never error. + invariant(PlanExecutor::ADVANCED == state || PlanExecutor::IS_EOF == state); + return false; } |