summaryrefslogtreecommitdiff
path: root/src/mongo/db/query/plan_yield_policy_sbe.cpp
diff options
context:
space:
mode:
authorDavid Storch <david.storch@mongodb.com>2020-08-27 14:56:52 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-09-01 16:25:25 +0000
commit996a22c6e70af35cda8045eb8a0e48c92cfc8931 (patch)
tree6526be339211cc27913e8fc011e63b97caa70b49 /src/mongo/db/query/plan_yield_policy_sbe.cpp
parent3f70a7ed1c4a8c30bcd2f7d30adfe3e018fc13a8 (diff)
downloadmongo-996a22c6e70af35cda8045eb8a0e48c92cfc8931.tar.gz
SERVER-48555 Allow yielding during SBE runtime planning
Diffstat (limited to 'src/mongo/db/query/plan_yield_policy_sbe.cpp')
-rw-r--r--src/mongo/db/query/plan_yield_policy_sbe.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mongo/db/query/plan_yield_policy_sbe.cpp b/src/mongo/db/query/plan_yield_policy_sbe.cpp
index c7a76154f3c..113389c6a7b 100644
--- a/src/mongo/db/query/plan_yield_policy_sbe.cpp
+++ b/src/mongo/db/query/plan_yield_policy_sbe.cpp
@@ -37,13 +37,15 @@ namespace mongo {
// so that SBE does not depend on CurOp. But we should still expose that statistic and keep it fresh
// as the operation executes.
Status PlanYieldPolicySBE::yield(OperationContext* opCtx, std::function<void()> whileYieldingFn) {
- if (!_rootStage) {
+ if (!_yieldingPlans.empty()) {
// This yield policy isn't bound to an execution tree yet.
return Status::OK();
}
try {
- _rootStage->saveState();
+ for (auto&& root : _yieldingPlans) {
+ root->saveState();
+ }
opCtx->recoveryUnit()->abandonSnapshot();
@@ -51,7 +53,9 @@ Status PlanYieldPolicySBE::yield(OperationContext* opCtx, std::function<void()>
whileYieldingFn();
}
- _rootStage->restoreState();
+ for (auto&& root : _yieldingPlans) {
+ root->restoreState();
+ }
} catch (...) {
return exceptionToStatus();
}