diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-09-30 11:19:31 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-10-13 00:32:43 +0000 |
commit | bcab0c7e1c1b2e1516d06d23233fea9a425b99f7 (patch) | |
tree | 8d805048d69ece52bb64e740532f5968b671865c /src/mongo/db/query/plan_executor_impl.cpp | |
parent | 0dadef8dd93175bf3a75412d8a32b377d9eba42c (diff) | |
download | mongo-bcab0c7e1c1b2e1516d06d23233fea9a425b99f7.tar.gz |
SERVER-51200 CollectionPtr in RequiresCollectionStage point to instance owned by AutoGetCollection
RequiresCollectionStage now holds a pointer to CollectionPtr owned by an AutoGetCollection.
When we save and restore the executor a new CollectionPtr pointer needs to be assigned.
Plan executors can no longer be created with temporary CollectionPtr instances and their interface have been changed to take pointers to avoid binding to rvalues.
RequiresCollectionStage no longer loads collections from the catalog and will be in sync with the owning AutoGetCollection.
Diffstat (limited to 'src/mongo/db/query/plan_executor_impl.cpp')
-rw-r--r-- | src/mongo/db/query/plan_executor_impl.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/query/plan_executor_impl.cpp b/src/mongo/db/query/plan_executor_impl.cpp index bb32e0aa566..d571cced21b 100644 --- a/src/mongo/db/query/plan_executor_impl.cpp +++ b/src/mongo/db/query/plan_executor_impl.cpp @@ -232,9 +232,9 @@ void PlanExecutorImpl::saveState() { _currentState = kSaved; } -void PlanExecutorImpl::restoreState(const Yieldable* yieldable) { +void PlanExecutorImpl::restoreState(const RestoreContext& context) { try { - restoreStateWithoutRetrying(yieldable); + restoreStateWithoutRetrying(context, context.collection()); } catch (const WriteConflictException&) { if (!_yieldPolicy->canAutoYield()) throw; @@ -244,12 +244,13 @@ void PlanExecutorImpl::restoreState(const Yieldable* yieldable) { } } -void PlanExecutorImpl::restoreStateWithoutRetrying(const Yieldable* yieldable) { +void PlanExecutorImpl::restoreStateWithoutRetrying(const RestoreContext& context, + const Yieldable* yieldable) { invariant(_currentState == kSaved); _yieldPolicy->setYieldable(yieldable); if (!isMarkedAsKilled()) { - _root->restoreState(); + _root->restoreState(context); } _currentState = kUsable; |