summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-02-22 17:55:03 -0500
committerRamon Fernandez <ramon@mongodb.com>2016-02-22 17:55:55 -0500
commit92c072f6162ace680b733b8fef2dcd7b1c4c6b50 (patch)
tree864dbeedb9deffe7bab99b910e44ae307d239e46
parente5f5b4ef8e6b6cf6f36af8d90ad08869d7274f30 (diff)
downloadmongo-92c072f6162ace680b733b8fef2dcd7b1c4c6b50.tar.gz
SERVER-22535 Migration source manager checks for PlanExecutor errors during initial index scan for documents to clone
Custom backport from f5a9081a412ada3fc8a472b267f932f76b345126
-rw-r--r--src/mongo/s/d_migrate.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp
index 77beca54897..b5e66402208 100644
--- a/src/mongo/s/d_migrate.cpp
+++ b/src/mongo/s/d_migrate.cpp
@@ -59,6 +59,7 @@
#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/dbhelpers.h"
#include "mongo/db/exec/plan_stage.h"
+#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/storage/mmap_v1/dur.h"
#include "mongo/db/field_parser.h"
#include "mongo/db/hasher.h"
@@ -552,9 +553,11 @@ public:
// we want the number of records to better report, in that case
bool isLargeChunk = false;
unsigned long long recCount = 0;
- ;
+
+ BSONObj obj;
RecordId dl;
- while (PlanExecutor::ADVANCED == exec->getNext(NULL, &dl)) {
+ PlanExecutor::ExecState state;
+ while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, &dl))) {
if (!isLargeChunk) {
scoped_lock lk(_cloneLocsMutex);
_cloneLocs.insert(dl);
@@ -566,6 +569,13 @@ public:
// just to get the correct value for recCount.
}
}
+
+ if (PlanExecutor::DEAD == state || PlanExecutor::FAILURE == state) {
+ errmsg = "Executor error while scanning for documents belonging to chunk: " +
+ WorkingSetCommon::toStatusString(obj);
+ return false;
+ }
+
exec.reset();
if (isLargeChunk) {