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 18:04:38 -0500
commit3e884ea31a0e52dc87c646a8f59d08c36c3b858a (patch)
tree6f23959124eaba6da279e575ca7425bbeca6ab21
parentbd9b7640324a8633e1d148b271d0f3cb61295ee7 (diff)
downloadmongo-3e884ea31a0e52dc87c646a8f59d08c36c3b858a.tar.gz
SERVER-22535 Migration source manager checks for PlanExecutor errors during initial index scan for documents to clone
(cherry picked from commit f5a9081a412ada3fc8a472b267f932f76b345126)
-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 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) {