diff options
-rw-r--r-- | src/mongo/db/s/migration_source_manager.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/s/migration_source_manager.cpp b/src/mongo/db/s/migration_source_manager.cpp index e6f9bf8000f..5a0f2795a3d 100644 --- a/src/mongo/db/s/migration_source_manager.cpp +++ b/src/mongo/db/s/migration_source_manager.cpp @@ -40,6 +40,7 @@ #include "mongo/db/db_raii.h" #include "mongo/db/dbhelpers.h" #include "mongo/db/exec/plan_stage.h" +#include "mongo/db/exec/working_set_common.h" #include "mongo/db/index/index_descriptor.h" #include "mongo/db/operation_context.h" #include "mongo/db/query/internal_plans.h" @@ -419,8 +420,10 @@ bool MigrationSourceManager::storeCurrentLocs(OperationContext* txn, bool isLargeChunk = false; unsigned long long recCount = 0; + BSONObj obj; RecordId recordId; - while (PlanExecutor::ADVANCED == exec->getNext(NULL, &recordId)) { + PlanExecutor::ExecState state; + while (PlanExecutor::ADVANCED == (state = exec->getNext(&obj, &recordId))) { if (!isLargeChunk) { stdx::lock_guard<stdx::mutex> lk(_cloneLocsMutex); _cloneLocs.insert(recordId); @@ -433,6 +436,12 @@ bool MigrationSourceManager::storeCurrentLocs(OperationContext* txn, } } + 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) { |