summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-02-09 14:27:16 -0500
committerTess Avitabile <tess.avitabile@mongodb.com>2016-02-09 17:16:02 -0500
commitf5a9081a412ada3fc8a472b267f932f76b345126 (patch)
treeacf56c75dffc4bc7cac3915142e11dd92e8c3b5b
parent5d96ef87f02c0aab2ecc3158f12509e54ec18f8f (diff)
downloadmongo-f5a9081a412ada3fc8a472b267f932f76b345126.tar.gz
SERVER-22535 Migration source manager checks for PlanExecutor errors during initial index scan for documents to clone
-rw-r--r--src/mongo/db/s/migration_source_manager.cpp11
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 043d72a9644..93657eb1481 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"
@@ -433,8 +434,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);
@@ -447,6 +450,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) {