summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2014-03-18 17:57:07 -0400
committerHari Khalsa <hkhalsa@10gen.com>2014-03-21 11:49:01 -0400
commit092deb74634465c62f6d47ea3405233d84400e36 (patch)
treeeaa7259eebe17ed8a1a202314fc479a96abd2f23
parent1b6ec9b66097ddb9b7f766cc36aea86cd7a89561 (diff)
downloadmongo-092deb74634465c62f6d47ea3405233d84400e36.tar.gz
SERVER-10026 don't forget to propagate restoreState down to backup plan in MPR
-rw-r--r--src/mongo/db/query/multi_plan_runner.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mongo/db/query/multi_plan_runner.cpp b/src/mongo/db/query/multi_plan_runner.cpp
index d99ad25cd85..4547b92e3e2 100644
--- a/src/mongo/db/query/multi_plan_runner.cpp
+++ b/src/mongo/db/query/multi_plan_runner.cpp
@@ -127,10 +127,14 @@ namespace mongo {
if (_failure || _killed) { return false; }
if (NULL != _bestPlan) {
- return _bestPlan->restoreState();
+ bool best = _bestPlan->restoreState();
+ // backup plan is OK by default. Only can be set to not-OK if it exists and fails.
+ bool backup = true;
if (NULL != _backupPlan) {
- _backupPlan->restoreState();
+ backup = _backupPlan->restoreState();
}
+ // We're OK to continue if the best plan and the backup plan are OK.
+ return best && backup;
}
else {
allPlansRestoreState();
@@ -215,6 +219,7 @@ namespace mongo {
_killed = true;
_collection = NULL;
if (NULL != _bestPlan) { _bestPlan->kill(); }
+ if (NULL != _backupPlan) { _backupPlan->kill(); }
}
Runner::RunnerState MultiPlanRunner::getNext(BSONObj* objOut, DiskLoc* dlOut) {
@@ -295,11 +300,14 @@ namespace mongo {
PlanCache* cache = collection->infoCache()->getPlanCache();
cache->remove(*_query);
+ // Move the backup info into the bestPlan info and clear the backup
+ // info.
_bestPlan.reset(_backupPlan);
_backupPlan = NULL;
_bestSolution.reset(_backupSolution);
_backupSolution = NULL;
_alreadyProduced = _backupAlreadyProduced;
+ _backupAlreadyProduced.clear();
return getNext(objOut, dlOut);
}