diff options
Diffstat (limited to 'src/mongo/db/ops/update_executor.cpp')
-rw-r--r-- | src/mongo/db/ops/update_executor.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/mongo/db/ops/update_executor.cpp b/src/mongo/db/ops/update_executor.cpp index 3673382b9bd..c5de729a45f 100644 --- a/src/mongo/db/ops/update_executor.cpp +++ b/src/mongo/db/ops/update_executor.cpp @@ -160,18 +160,28 @@ namespace mongo { _driver.refreshIndexKeys(lifecycle->getIndexKeys(_request->getOpCtx())); } + // If yielding is allowed for this plan, then set an auto yield policy. Otherwise set + // a manual yield policy. + const bool canYield = !_request->isGod() && ( + _canonicalQuery.get() ? + !QueryPlannerCommon::hasNode(_canonicalQuery->root(), MatchExpression::ATOMIC) : + !LiteParsedQuery::isQueryIsolated(_request->getQuery())); + + PlanExecutor::YieldPolicy policy = canYield ? PlanExecutor::YIELD_AUTO : + PlanExecutor::YIELD_MANUAL; + PlanExecutor* rawExec = NULL; Status getExecStatus = Status::OK(); if (_canonicalQuery.get()) { // This is the regular path for when we have a CanonicalQuery. getExecStatus = getExecutorUpdate(_request->getOpCtx(), db, _canonicalQuery.release(), - _request, &_driver, _opDebug, &rawExec); + _request, &_driver, _opDebug, policy, &rawExec); } else { // This is the idhack fast-path for getting a PlanExecutor without doing the work // to create a CanonicalQuery. getExecStatus = getExecutorUpdate(_request->getOpCtx(), db, nsString.ns(), _request, - &_driver, _opDebug, &rawExec); + &_driver, _opDebug, policy, &rawExec); } if (!getExecStatus.isOK()) { @@ -181,18 +191,6 @@ namespace mongo { invariant(rawExec); _exec.reset(rawExec); - // If yielding is allowed for this plan, then set an auto yield policy. Otherwise set - // a manual yield policy. - const bool canYield = !_request->isGod() && ( - _canonicalQuery.get() ? - !QueryPlannerCommon::hasNode(_canonicalQuery->root(), MatchExpression::ATOMIC) : - !LiteParsedQuery::isQueryIsolated(_request->getQuery())); - - PlanExecutor::YieldPolicy policy = canYield ? PlanExecutor::YIELD_AUTO : - PlanExecutor::YIELD_MANUAL; - - _exec->setYieldPolicy(policy); - return Status::OK(); } |