diff options
author | David Storch <david.storch@10gen.com> | 2014-07-29 13:58:50 -0400 |
---|---|---|
committer | David Storch <david.storch@10gen.com> | 2014-07-29 17:16:37 -0400 |
commit | 1488bc89c42c6a39c5fdbd2b0c2b15e3abbb4108 (patch) | |
tree | a770bc9c7b17fdeb26b66115bb98cf7ca99372a0 /src/mongo/db | |
parent | 81676bfa36c68b1247f0e08b666e33c3e3875755 (diff) | |
download | mongo-1488bc89c42c6a39c5fdbd2b0c2b15e3abbb4108.tar.gz |
SERVER-14633 rename prepareToYield() and recoverFromYield() to saveState() and restoreState()
Also renames PlanExecutor::getStages() to PlanExecutor::getRootStage()
Diffstat (limited to 'src/mongo/db')
64 files changed, 188 insertions, 192 deletions
diff --git a/src/mongo/db/commands/parallel_collection_scan.cpp b/src/mongo/db/commands/parallel_collection_scan.cpp index fbfda3e8138..fe745a44691 100644 --- a/src/mongo/db/commands/parallel_collection_scan.cpp +++ b/src/mongo/db/commands/parallel_collection_scan.cpp @@ -89,15 +89,15 @@ namespace mongo { _iterators.clear(); } - virtual void prepareToYield() { + virtual void saveState() { for (size_t i = 0; i < _iterators.size(); i++) { - _iterators[i]->prepareToYield(); + _iterators[i]->saveState(); } } - virtual void recoverFromYield(OperationContext* opCtx) { + virtual void restoreState(OperationContext* opCtx) { for (size_t i = 0; i < _iterators.size(); i++) { - if (!_iterators[i]->recoverFromYield()) { + if (!_iterators[i]->restoreState()) { kill(); } } @@ -217,7 +217,7 @@ namespace mongo { // TODO consider using a common work queue once invalidation issues go away. for (size_t i = 0; i < iterators.size(); i++) { PlanExecutor* theExec = execs[i % execs.size()]; - MultiIteratorStage* mis = static_cast<MultiIteratorStage*>(theExec->getStages()); + MultiIteratorStage* mis = static_cast<MultiIteratorStage*>(theExec->getRootStage()); mis->addIterator(iterators.releaseAt(i)); } diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp index 36a9a7c75a8..20d05a86e90 100644 --- a/src/mongo/db/commands/pipeline_command.cpp +++ b/src/mongo/db/commands/pipeline_command.cpp @@ -116,10 +116,10 @@ namespace { // Manage our OperationContext. We intentionally don't propagate to the child // Runner as that is handled by DocumentSourceCursor as it needs to. - virtual void prepareToYield() { + virtual void saveState() { _pipeline->getContext()->opCtx = NULL; } - virtual void recoverFromYield(OperationContext* opCtx) { + virtual void restoreState(OperationContext* opCtx) { _pipeline->getContext()->opCtx = opCtx; } @@ -234,7 +234,7 @@ namespace { if (resultsArray.len() + next.objsize() > byteLimit) { // Get the pipeline proxy stage wrapped by this PlanExecutor. - PipelineProxyStage* proxy = static_cast<PipelineProxyStage*>(exec->getStages()); + PipelineProxyStage* proxy = static_cast<PipelineProxyStage*>(exec->getRootStage()); // too big. next will be the first doc in the second batch proxy->pushBack(next); break; diff --git a/src/mongo/db/exec/and_hash.cpp b/src/mongo/db/exec/and_hash.cpp index 4e43f55da82..26a4a72d7ea 100644 --- a/src/mongo/db/exec/and_hash.cpp +++ b/src/mongo/db/exec/and_hash.cpp @@ -432,19 +432,19 @@ namespace mongo { } } - void AndHashStage::prepareToYield() { + void AndHashStage::saveState() { ++_commonStats.yields; for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->prepareToYield(); + _children[i]->saveState(); } } - void AndHashStage::recoverFromYield(OperationContext* opCtx) { + void AndHashStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->recoverFromYield(opCtx); + _children[i]->restoreState(opCtx); } } diff --git a/src/mongo/db/exec/and_hash.h b/src/mongo/db/exec/and_hash.h index 3ae34cca5a7..16197bb5c93 100644 --- a/src/mongo/db/exec/and_hash.h +++ b/src/mongo/db/exec/and_hash.h @@ -75,8 +75,8 @@ namespace mongo { virtual StageState work(WorkingSetID* out); virtual bool isEOF(); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/and_sorted.cpp b/src/mongo/db/exec/and_sorted.cpp index 42025074b70..8d8ff94d27e 100644 --- a/src/mongo/db/exec/and_sorted.cpp +++ b/src/mongo/db/exec/and_sorted.cpp @@ -257,19 +257,19 @@ namespace mongo { } } - void AndSortedStage::prepareToYield() { + void AndSortedStage::saveState() { ++_commonStats.yields; for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->prepareToYield(); + _children[i]->saveState(); } } - void AndSortedStage::recoverFromYield(OperationContext* opCtx) { + void AndSortedStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->recoverFromYield(opCtx); + _children[i]->restoreState(opCtx); } } diff --git a/src/mongo/db/exec/and_sorted.h b/src/mongo/db/exec/and_sorted.h index f3660b17881..fe37d5be76e 100644 --- a/src/mongo/db/exec/and_sorted.h +++ b/src/mongo/db/exec/and_sorted.h @@ -61,8 +61,8 @@ namespace mongo { virtual StageState work(WorkingSetID* out); virtual bool isEOF(); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/cached_plan.cpp b/src/mongo/db/exec/cached_plan.cpp index 488daf003f3..02947916209 100644 --- a/src/mongo/db/exec/cached_plan.cpp +++ b/src/mongo/db/exec/cached_plan.cpp @@ -93,24 +93,24 @@ namespace mongo { return childStatus; } - void CachedPlanStage::prepareToYield() { + void CachedPlanStage::saveState() { if (! _usingBackupChild) { - _mainChildPlan->prepareToYield(); + _mainChildPlan->saveState(); } if (NULL != _backupChildPlan.get()) { - _backupChildPlan->prepareToYield(); + _backupChildPlan->saveState(); } ++_commonStats.yields; } - void CachedPlanStage::recoverFromYield(OperationContext* opCtx) { + void CachedPlanStage::restoreState(OperationContext* opCtx) { if (NULL != _backupChildPlan.get()) { - _backupChildPlan->recoverFromYield(opCtx); + _backupChildPlan->restoreState(opCtx); } if (! _usingBackupChild) { - _mainChildPlan->recoverFromYield(opCtx); + _mainChildPlan->restoreState(opCtx); } ++_commonStats.unyields; } diff --git a/src/mongo/db/exec/cached_plan.h b/src/mongo/db/exec/cached_plan.h index 8041e5f3e26..2c71064abe8 100644 --- a/src/mongo/db/exec/cached_plan.h +++ b/src/mongo/db/exec/cached_plan.h @@ -56,8 +56,8 @@ namespace mongo { virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/collection_scan.cpp b/src/mongo/db/exec/collection_scan.cpp index a939aee0b84..963d2a3ef4e 100644 --- a/src/mongo/db/exec/collection_scan.cpp +++ b/src/mongo/db/exec/collection_scan.cpp @@ -144,17 +144,17 @@ namespace mongo { } } - void CollectionScan::prepareToYield() { + void CollectionScan::saveState() { ++_commonStats.yields; if (NULL != _iter) { - _iter->prepareToYield(); + _iter->saveState(); } } - void CollectionScan::recoverFromYield(OperationContext* opCtx) { + void CollectionScan::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; if (NULL != _iter) { - if (!_iter->recoverFromYield()) { + if (!_iter->restoreState()) { warning() << "Collection dropped or state deleted during yield of CollectionScan"; _nsDropped = true; } diff --git a/src/mongo/db/exec/collection_scan.h b/src/mongo/db/exec/collection_scan.h index f70dc5facbf..48f779293e1 100644 --- a/src/mongo/db/exec/collection_scan.h +++ b/src/mongo/db/exec/collection_scan.h @@ -56,8 +56,8 @@ namespace mongo { virtual bool isEOF(); virtual void invalidate(const DiskLoc& dl, InvalidationType type); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/count.cpp b/src/mongo/db/exec/count.cpp index 092f3bc1006..b43f8227ad1 100644 --- a/src/mongo/db/exec/count.cpp +++ b/src/mongo/db/exec/count.cpp @@ -144,7 +144,7 @@ namespace mongo { return _hitEnd || _btreeCursor->isEOF(); } - void Count::prepareToYield() { + void Count::saveState() { ++_commonStats.yields; if (_hitEnd || (NULL == _btreeCursor.get())) { return; } @@ -152,7 +152,7 @@ namespace mongo { _endCursor->savePosition(); } - void Count::recoverFromYield(OperationContext* opCtx) { + void Count::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; if (_hitEnd || (NULL == _btreeCursor.get())) { return; } diff --git a/src/mongo/db/exec/count.h b/src/mongo/db/exec/count.h index 60873374cdc..68ad5ea30de 100644 --- a/src/mongo/db/exec/count.h +++ b/src/mongo/db/exec/count.h @@ -73,8 +73,8 @@ namespace mongo { virtual StageState work(WorkingSetID* out); virtual bool isEOF(); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/distinct_scan.cpp b/src/mongo/db/exec/distinct_scan.cpp index a3d0fe57994..b6f4ad63f1d 100644 --- a/src/mongo/db/exec/distinct_scan.cpp +++ b/src/mongo/db/exec/distinct_scan.cpp @@ -145,7 +145,7 @@ namespace mongo { return _hitEnd || _btreeCursor->isEOF(); } - void DistinctScan::prepareToYield() { + void DistinctScan::saveState() { ++_commonStats.yields; if (_hitEnd || (NULL == _btreeCursor.get())) { return; } @@ -158,7 +158,7 @@ namespace mongo { _btreeCursor->savePosition(); } - void DistinctScan::recoverFromYield(OperationContext* opCtx) { + void DistinctScan::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; if (_hitEnd || (NULL == _btreeCursor.get())) { return; } diff --git a/src/mongo/db/exec/distinct_scan.h b/src/mongo/db/exec/distinct_scan.h index 25200e853b5..7a42759e051 100644 --- a/src/mongo/db/exec/distinct_scan.h +++ b/src/mongo/db/exec/distinct_scan.h @@ -84,8 +84,8 @@ namespace mongo { virtual StageState work(WorkingSetID* out); virtual bool isEOF(); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/eof.cpp b/src/mongo/db/exec/eof.cpp index c160f2a5ef7..f17084d7dae 100644 --- a/src/mongo/db/exec/eof.cpp +++ b/src/mongo/db/exec/eof.cpp @@ -50,11 +50,11 @@ namespace mongo { return PlanStage::IS_EOF; } - void EOFStage::prepareToYield() { + void EOFStage::saveState() { ++_commonStats.yields; } - void EOFStage::recoverFromYield(OperationContext* opCtx) { + void EOFStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; } diff --git a/src/mongo/db/exec/eof.h b/src/mongo/db/exec/eof.h index 5475fa9dbe7..25798a504a2 100644 --- a/src/mongo/db/exec/eof.h +++ b/src/mongo/db/exec/eof.h @@ -45,8 +45,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/fetch.cpp b/src/mongo/db/exec/fetch.cpp index e13cf3857f7..2290a77835f 100644 --- a/src/mongo/db/exec/fetch.cpp +++ b/src/mongo/db/exec/fetch.cpp @@ -111,14 +111,14 @@ namespace mongo { } } - void FetchStage::prepareToYield() { + void FetchStage::saveState() { ++_commonStats.yields; - _child->prepareToYield(); + _child->saveState(); } - void FetchStage::recoverFromYield(OperationContext* opCtx) { + void FetchStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; - _child->recoverFromYield(opCtx); + _child->restoreState(opCtx); } void FetchStage::invalidate(const DiskLoc& dl, InvalidationType type) { diff --git a/src/mongo/db/exec/fetch.h b/src/mongo/db/exec/fetch.h index 7933fc583ab..6c5b4a3be23 100644 --- a/src/mongo/db/exec/fetch.h +++ b/src/mongo/db/exec/fetch.h @@ -55,8 +55,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/idhack.cpp b/src/mongo/db/exec/idhack.cpp index 5d15b2d7418..83fe0e8c5ea 100644 --- a/src/mongo/db/exec/idhack.cpp +++ b/src/mongo/db/exec/idhack.cpp @@ -130,11 +130,11 @@ namespace mongo { return PlanStage::ADVANCED; } - void IDHackStage::prepareToYield() { + void IDHackStage::saveState() { ++_commonStats.yields; } - void IDHackStage::recoverFromYield(OperationContext* opCtx) { + void IDHackStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; } diff --git a/src/mongo/db/exec/idhack.h b/src/mongo/db/exec/idhack.h index a708a332c27..b03fcfa69bf 100644 --- a/src/mongo/db/exec/idhack.h +++ b/src/mongo/db/exec/idhack.h @@ -53,8 +53,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); /** diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp index 0be67cda714..0d165623ee1 100644 --- a/src/mongo/db/exec/index_scan.cpp +++ b/src/mongo/db/exec/index_scan.cpp @@ -237,7 +237,7 @@ namespace mongo { return _hitEnd || _indexCursor->isEOF(); } - void IndexScan::prepareToYield() { + void IndexScan::saveState() { ++_commonStats.yields; if (_hitEnd || (NULL == _indexCursor.get())) { return; } @@ -248,7 +248,7 @@ namespace mongo { _indexCursor->savePosition(); } - void IndexScan::recoverFromYield(OperationContext* opCtx) { + void IndexScan::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; if (_hitEnd || (NULL == _indexCursor.get())) { return; } diff --git a/src/mongo/db/exec/index_scan.h b/src/mongo/db/exec/index_scan.h index 40ad7a7315c..012566c403e 100644 --- a/src/mongo/db/exec/index_scan.h +++ b/src/mongo/db/exec/index_scan.h @@ -89,8 +89,8 @@ namespace mongo { virtual StageState work(WorkingSetID* out); virtual bool isEOF(); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/keep_mutations.cpp b/src/mongo/db/exec/keep_mutations.cpp index af76962a383..6698465b27f 100644 --- a/src/mongo/db/exec/keep_mutations.cpp +++ b/src/mongo/db/exec/keep_mutations.cpp @@ -103,14 +103,14 @@ namespace mongo { } } - void KeepMutationsStage::prepareToYield() { + void KeepMutationsStage::saveState() { ++_commonStats.yields; - _child->prepareToYield(); + _child->saveState(); } - void KeepMutationsStage::recoverFromYield(OperationContext* opCtx) { + void KeepMutationsStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; - _child->recoverFromYield(opCtx); + _child->restoreState(opCtx); } void KeepMutationsStage::invalidate(const DiskLoc& dl, InvalidationType type) { diff --git a/src/mongo/db/exec/keep_mutations.h b/src/mongo/db/exec/keep_mutations.h index fc3bfbd4323..e5a8efabdf3 100644 --- a/src/mongo/db/exec/keep_mutations.h +++ b/src/mongo/db/exec/keep_mutations.h @@ -51,8 +51,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/limit.cpp b/src/mongo/db/exec/limit.cpp index d13a378fcb3..a5bf2a1ad80 100644 --- a/src/mongo/db/exec/limit.cpp +++ b/src/mongo/db/exec/limit.cpp @@ -83,14 +83,14 @@ namespace mongo { } } - void LimitStage::prepareToYield() { + void LimitStage::saveState() { ++_commonStats.yields; - _child->prepareToYield(); + _child->saveState(); } - void LimitStage::recoverFromYield(OperationContext* opCtx) { + void LimitStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; - _child->recoverFromYield(opCtx); + _child->restoreState(opCtx); } void LimitStage::invalidate(const DiskLoc& dl, InvalidationType type) { diff --git a/src/mongo/db/exec/limit.h b/src/mongo/db/exec/limit.h index 8a14d4ddea9..b0068d46b6e 100644 --- a/src/mongo/db/exec/limit.h +++ b/src/mongo/db/exec/limit.h @@ -49,8 +49,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/merge_sort.cpp b/src/mongo/db/exec/merge_sort.cpp index c9f449caa53..372bb912d47 100644 --- a/src/mongo/db/exec/merge_sort.cpp +++ b/src/mongo/db/exec/merge_sort.cpp @@ -182,17 +182,17 @@ namespace mongo { return PlanStage::ADVANCED; } - void MergeSortStage::prepareToYield() { + void MergeSortStage::saveState() { ++_commonStats.yields; for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->prepareToYield(); + _children[i]->saveState(); } } - void MergeSortStage::recoverFromYield(OperationContext* opCtx) { + void MergeSortStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->recoverFromYield(opCtx); + _children[i]->restoreState(opCtx); } } diff --git a/src/mongo/db/exec/merge_sort.h b/src/mongo/db/exec/merge_sort.h index 1475f811793..042778bc8fa 100644 --- a/src/mongo/db/exec/merge_sort.h +++ b/src/mongo/db/exec/merge_sort.h @@ -65,8 +65,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/mock_stage.h b/src/mongo/db/exec/mock_stage.h index 4742cc3aa7a..2f1ca80fb00 100644 --- a/src/mongo/db/exec/mock_stage.h +++ b/src/mongo/db/exec/mock_stage.h @@ -58,8 +58,8 @@ namespace mongo { // These don't really mean anything here. // Some day we could count the # of calls to the yield functions to check that other stages // have correct yielding behavior. - virtual void prepareToYield() { } - virtual void recoverFromYield(OperationContext* opCtx) { } + virtual void saveState() { } + virtual void restoreState(OperationContext* opCtx) { } virtual void invalidate(const DiskLoc& dl, InvalidationType type) { } virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/multi_plan.cpp b/src/mongo/db/exec/multi_plan.cpp index c2c394cc21c..61fcc1cf1f5 100644 --- a/src/mongo/db/exec/multi_plan.cpp +++ b/src/mongo/db/exec/multi_plan.cpp @@ -400,7 +400,7 @@ namespace mongo { return Status::OK(); } - void MultiPlanStage::prepareToYield() { + void MultiPlanStage::saveState() { if (_failure) return; // this logic is from multi_plan_runner @@ -408,9 +408,9 @@ namespace mongo { // the _bestPlan if we've switched to the backup? if (bestPlanChosen()) { - _candidates[_bestPlanIdx].root->prepareToYield(); + _candidates[_bestPlanIdx].root->saveState(); if (hasBackupPlan()) { - _candidates[_backupPlanIdx].root->prepareToYield(); + _candidates[_backupPlanIdx].root->saveState(); } } else { @@ -418,7 +418,7 @@ namespace mongo { } } - void MultiPlanStage::recoverFromYield(OperationContext* opCtx) { + void MultiPlanStage::restoreState(OperationContext* opCtx) { if (_failure) return; // this logic is from multi_plan_runner @@ -426,9 +426,9 @@ namespace mongo { // the _bestPlan if we've switched to the backup? if (bestPlanChosen()) { - _candidates[_bestPlanIdx].root->recoverFromYield(opCtx); + _candidates[_bestPlanIdx].root->restoreState(opCtx); if (hasBackupPlan()) { - _candidates[_backupPlanIdx].root->recoverFromYield(opCtx); + _candidates[_backupPlanIdx].root->restoreState(opCtx); } } else { @@ -502,13 +502,13 @@ namespace mongo { void MultiPlanStage::allPlansSaveState() { for (size_t i = 0; i < _candidates.size(); ++i) { - _candidates[i].root->prepareToYield(); + _candidates[i].root->saveState(); } } void MultiPlanStage::allPlansRestoreState(OperationContext* opCtx) { for (size_t i = 0; i < _candidates.size(); ++i) { - _candidates[i].root->recoverFromYield(opCtx); + _candidates[i].root->restoreState(opCtx); } } diff --git a/src/mongo/db/exec/multi_plan.h b/src/mongo/db/exec/multi_plan.h index bb43873d843..af56d2c80c9 100644 --- a/src/mongo/db/exec/multi_plan.h +++ b/src/mongo/db/exec/multi_plan.h @@ -62,9 +62,9 @@ namespace mongo { virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); + virtual void saveState(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); diff --git a/src/mongo/db/exec/near.cpp b/src/mongo/db/exec/near.cpp index 32cfa6e7464..2eed9662b46 100644 --- a/src/mongo/db/exec/near.cpp +++ b/src/mongo/db/exec/near.cpp @@ -281,17 +281,17 @@ namespace mongo { return SearchState_Finished == _searchState; } - void NearStage::prepareToYield() { + void NearStage::saveState() { ++_stats->common.yields; if (_nextInterval) { - _nextInterval->covering->prepareToYield(); + _nextInterval->covering->saveState(); } } - void NearStage::recoverFromYield(OperationContext* opCtx) { + void NearStage::restoreState(OperationContext* opCtx) { ++_stats->common.unyields; if (_nextInterval) { - _nextInterval->covering->recoverFromYield(opCtx); + _nextInterval->covering->restoreState(opCtx); } } diff --git a/src/mongo/db/exec/near.h b/src/mongo/db/exec/near.h index 681d86f32a4..5271f552257 100644 --- a/src/mongo/db/exec/near.h +++ b/src/mongo/db/exec/near.h @@ -89,8 +89,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/oplogstart.cpp b/src/mongo/db/exec/oplogstart.cpp index e7624b5668b..7727946a5df 100644 --- a/src/mongo/db/exec/oplogstart.cpp +++ b/src/mongo/db/exec/oplogstart.cpp @@ -154,23 +154,23 @@ namespace mongo { } } - void OplogStart::prepareToYield() { + void OplogStart::saveState() { if (_cs) { - _cs->prepareToYield(); + _cs->saveState(); } for (size_t i = 0; i < _subIterators.size(); i++) { - _subIterators[i]->prepareToYield(); + _subIterators[i]->saveState(); } } - void OplogStart::recoverFromYield(OperationContext* opCtx) { + void OplogStart::restoreState(OperationContext* opCtx) { if (_cs) { - _cs->recoverFromYield(opCtx); + _cs->restoreState(opCtx); } for (size_t i = 0; i < _subIterators.size(); i++) { - if (!_subIterators[i]->recoverFromYield()) { + if (!_subIterators[i]->restoreState()) { _subIterators.erase(_subIterators.begin() + i); // need to hit same i on next pass through loop i--; diff --git a/src/mongo/db/exec/oplogstart.h b/src/mongo/db/exec/oplogstart.h index 7b0b8d17ecf..17ae3f1d02c 100644 --- a/src/mongo/db/exec/oplogstart.h +++ b/src/mongo/db/exec/oplogstart.h @@ -70,8 +70,8 @@ namespace mongo { virtual bool isEOF(); virtual void invalidate(const DiskLoc& dl, InvalidationType type); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/or.cpp b/src/mongo/db/exec/or.cpp index c82e75a2237..bbbbc0d8bd2 100644 --- a/src/mongo/db/exec/or.cpp +++ b/src/mongo/db/exec/or.cpp @@ -137,17 +137,17 @@ namespace mongo { } } - void OrStage::prepareToYield() { + void OrStage::saveState() { ++_commonStats.yields; for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->prepareToYield(); + _children[i]->saveState(); } } - void OrStage::recoverFromYield(OperationContext* opCtx) { + void OrStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; for (size_t i = 0; i < _children.size(); ++i) { - _children[i]->recoverFromYield(opCtx); + _children[i]->restoreState(opCtx); } } diff --git a/src/mongo/db/exec/or.h b/src/mongo/db/exec/or.h index 22ce3660dc0..8c15e8b04dc 100644 --- a/src/mongo/db/exec/or.h +++ b/src/mongo/db/exec/or.h @@ -54,8 +54,8 @@ namespace mongo { virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/plan_stage.h b/src/mongo/db/exec/plan_stage.h index bc5d701587d..6cfb91adf96 100644 --- a/src/mongo/db/exec/plan_stage.h +++ b/src/mongo/db/exec/plan_stage.h @@ -65,8 +65,8 @@ namespace mongo { * passed through the WorkingSet interface; see working_set.h for details. * * All synchronization is the responsibility of the caller. Queries must be told to yield with - * prepareToYield() if any underlying database state changes. If prepareToYield() is called, - * recoverFromYield() must be called again before any work() is done. + * saveState() if any underlying database state changes. If saveState() is called, + * restoreState() must be called again before any work() is done. * * Here is a very simple usage example: * @@ -93,9 +93,9 @@ namespace mongo { * * if (shouldYield) { * // Occasionally yield. - * stage->prepareToYield(); + * stage->saveState(); * // Do work that requires a yield here (execute other plans, insert, delete, etc.). - * stage->recoverFromYield(); + * stage->restoreState(); * } * } */ @@ -176,31 +176,27 @@ namespace mongo { /** * Notifies the stage that all locks are about to be released. The stage must save any - * state required to resume where it was before prepareToYield was called. - * - * XXX: rename to saveState() + * state required to resume where it was before saveState was called. */ - virtual void prepareToYield() = 0; + virtual void saveState() = 0; /** * Notifies the stage that any required locks have been reacquired. The stage must restore * any saved state and be ready to handle calls to work(). * - * Can only be called after prepareToYield. - * - * XXX: rename to restoreState() + * Can only be called after saveState. * * XXX: We may not need to pass down 'opCtx' if getMore'd queries use the same * OperationContext they were created with. */ - virtual void recoverFromYield(OperationContext* opCtx) = 0; + virtual void restoreState(OperationContext* opCtx) = 0; /** * Notifies a stage that a DiskLoc is going to be deleted (or in-place updated) so that the * stage can invalidate or modify any state required to continue processing without this * DiskLoc. * - * Can only be called after a prepareToYield but before a recoverFromYield. + * Can only be called after a saveState but before a restoreState. */ virtual void invalidate(const DiskLoc& dl, InvalidationType type) = 0; diff --git a/src/mongo/db/exec/projection.cpp b/src/mongo/db/exec/projection.cpp index b21bc14a985..244b68540d6 100644 --- a/src/mongo/db/exec/projection.cpp +++ b/src/mongo/db/exec/projection.cpp @@ -235,14 +235,14 @@ namespace mongo { return status; } - void ProjectionStage::prepareToYield() { + void ProjectionStage::saveState() { ++_commonStats.yields; - _child->prepareToYield(); + _child->saveState(); } - void ProjectionStage::recoverFromYield(OperationContext* opCtx) { + void ProjectionStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; - _child->recoverFromYield(opCtx); + _child->restoreState(opCtx); } void ProjectionStage::invalidate(const DiskLoc& dl, InvalidationType type) { diff --git a/src/mongo/db/exec/projection.h b/src/mongo/db/exec/projection.h index 03bb1839102..51037d1b3b1 100644 --- a/src/mongo/db/exec/projection.h +++ b/src/mongo/db/exec/projection.h @@ -83,8 +83,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/shard_filter.cpp b/src/mongo/db/exec/shard_filter.cpp index 831421aacd2..c03fb6b3e95 100644 --- a/src/mongo/db/exec/shard_filter.cpp +++ b/src/mongo/db/exec/shard_filter.cpp @@ -84,14 +84,14 @@ namespace mongo { } } - void ShardFilterStage::prepareToYield() { + void ShardFilterStage::saveState() { ++_commonStats.yields; - _child->prepareToYield(); + _child->saveState(); } - void ShardFilterStage::recoverFromYield(OperationContext* opCtx) { + void ShardFilterStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; - _child->recoverFromYield(opCtx); + _child->restoreState(opCtx); } void ShardFilterStage::invalidate(const DiskLoc& dl, InvalidationType type) { diff --git a/src/mongo/db/exec/shard_filter.h b/src/mongo/db/exec/shard_filter.h index f2374b5ddd7..2f40d149cd1 100644 --- a/src/mongo/db/exec/shard_filter.h +++ b/src/mongo/db/exec/shard_filter.h @@ -80,8 +80,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/skip.cpp b/src/mongo/db/exec/skip.cpp index e7e7b1710d1..6d0c1e6b657 100644 --- a/src/mongo/db/exec/skip.cpp +++ b/src/mongo/db/exec/skip.cpp @@ -87,14 +87,14 @@ namespace mongo { } } - void SkipStage::prepareToYield() { + void SkipStage::saveState() { ++_commonStats.yields; - _child->prepareToYield(); + _child->saveState(); } - void SkipStage::recoverFromYield(OperationContext* opCtx) { + void SkipStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; - _child->recoverFromYield(opCtx); + _child->restoreState(opCtx); } void SkipStage::invalidate(const DiskLoc& dl, InvalidationType type) { diff --git a/src/mongo/db/exec/skip.h b/src/mongo/db/exec/skip.h index fc8814e2699..41be7286e72 100644 --- a/src/mongo/db/exec/skip.h +++ b/src/mongo/db/exec/skip.h @@ -48,8 +48,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/sort.cpp b/src/mongo/db/exec/sort.cpp index 2816b9e4815..236103ee364 100644 --- a/src/mongo/db/exec/sort.cpp +++ b/src/mongo/db/exec/sort.cpp @@ -415,14 +415,14 @@ namespace mongo { return PlanStage::ADVANCED; } - void SortStage::prepareToYield() { + void SortStage::saveState() { ++_commonStats.yields; - _child->prepareToYield(); + _child->saveState(); } - void SortStage::recoverFromYield(OperationContext* opCtx) { + void SortStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; - _child->recoverFromYield(opCtx); + _child->restoreState(opCtx); } void SortStage::invalidate(const DiskLoc& dl, InvalidationType type) { diff --git a/src/mongo/db/exec/sort.h b/src/mongo/db/exec/sort.h index 119f4f59019..1ff6855aee2 100644 --- a/src/mongo/db/exec/sort.h +++ b/src/mongo/db/exec/sort.h @@ -149,8 +149,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/subplan.cpp b/src/mongo/db/exec/subplan.cpp index 7d2ca07d682..39aaa83a2ee 100644 --- a/src/mongo/db/exec/subplan.cpp +++ b/src/mongo/db/exec/subplan.cpp @@ -407,7 +407,7 @@ namespace mongo { return state; } - void SubplanStage::prepareToYield() { + void SubplanStage::saveState() { ++_commonStats.yields; if (_killed) { return; @@ -416,11 +416,11 @@ namespace mongo { // We're ranking a sub-plan via an MPR or we're streaming results from this stage. Either // way, pass on the request. if (NULL != _child.get()) { - _child->prepareToYield(); + _child->saveState(); } } - void SubplanStage::recoverFromYield(OperationContext* opCtx) { + void SubplanStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; if (_killed) { return; @@ -429,7 +429,7 @@ namespace mongo { // We're ranking a sub-plan via an MPR or we're streaming results from this stage. Either // way, pass on the request. if (NULL != _child.get()) { - _child->recoverFromYield(opCtx); + _child->restoreState(opCtx); } } diff --git a/src/mongo/db/exec/subplan.h b/src/mongo/db/exec/subplan.h index 3ff3da921c4..477d6853194 100644 --- a/src/mongo/db/exec/subplan.h +++ b/src/mongo/db/exec/subplan.h @@ -71,8 +71,8 @@ namespace mongo { virtual bool isEOF(); virtual StageState work(WorkingSetID* out); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/exec/text.cpp b/src/mongo/db/exec/text.cpp index 17fa93eff68..46800e96335 100644 --- a/src/mongo/db/exec/text.cpp +++ b/src/mongo/db/exec/text.cpp @@ -104,19 +104,19 @@ namespace mongo { return stageState; } - void TextStage::prepareToYield() { + void TextStage::saveState() { ++_commonStats.yields; for (size_t i = 0; i < _scanners.size(); ++i) { - _scanners.mutableVector()[i]->prepareToYield(); + _scanners.mutableVector()[i]->saveState(); } } - void TextStage::recoverFromYield(OperationContext* opCtx) { + void TextStage::restoreState(OperationContext* opCtx) { ++_commonStats.unyields; for (size_t i = 0; i < _scanners.size(); ++i) { - _scanners.mutableVector()[i]->recoverFromYield(opCtx); + _scanners.mutableVector()[i]->restoreState(opCtx); } } diff --git a/src/mongo/db/exec/text.h b/src/mongo/db/exec/text.h index 288c6e3d23d..f8b45b1a260 100644 --- a/src/mongo/db/exec/text.h +++ b/src/mongo/db/exec/text.h @@ -105,8 +105,8 @@ namespace mongo { virtual StageState work(WorkingSetID* out); virtual bool isEOF(); - virtual void prepareToYield(); - virtual void recoverFromYield(OperationContext* opCtx); + virtual void saveState(); + virtual void restoreState(OperationContext* opCtx); virtual void invalidate(const DiskLoc& dl, InvalidationType type); virtual std::vector<PlanStage*> getChildren() const; diff --git a/src/mongo/db/query/explain.cpp b/src/mongo/db/query/explain.cpp index b2021abde91..f1fb4a46378 100644 --- a/src/mongo/db/query/explain.cpp +++ b/src/mongo/db/query/explain.cpp @@ -433,7 +433,7 @@ namespace mongo { // // Inspect the tree to see if there is a MultiPlanStage. - MultiPlanStage* mps = getMultiPlanStage(exec->getStages()); + MultiPlanStage* mps = getMultiPlanStage(exec->getRootStage()); // The executionStats verbosity level requires that we run the winning plan // until if finishes. @@ -505,7 +505,7 @@ namespace mongo { void Explain::getSummaryStats(PlanExecutor* exec, PlanSummaryStats* statsOut) { invariant(NULL != statsOut); - PlanStage* root = exec->getStages(); + PlanStage* root = exec->getRootStage(); // We can get some of the fields we need from the common stats stored in the // root stage of the plan tree. diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp index 9df91a83b77..17b4f95a533 100644 --- a/src/mongo/db/query/plan_executor.cpp +++ b/src/mongo/db/query/plan_executor.cpp @@ -93,7 +93,7 @@ namespace mongo { return _workingSet.get(); } - PlanStage* PlanExecutor::getStages() const { + PlanStage* PlanExecutor::getRootStage() const { return _root.get(); } @@ -110,12 +110,12 @@ namespace mongo { } void PlanExecutor::saveState() { - if (!_killed) { _root->prepareToYield(); } + if (!_killed) { _root->saveState(); } } bool PlanExecutor::restoreState(OperationContext* opCtx) { if (!_killed) { - _root->recoverFromYield(opCtx); + _root->restoreState(opCtx); } return !_killed; } diff --git a/src/mongo/db/query/plan_executor.h b/src/mongo/db/query/plan_executor.h index 8a6104edf79..a0d80f28615 100644 --- a/src/mongo/db/query/plan_executor.h +++ b/src/mongo/db/query/plan_executor.h @@ -153,7 +153,7 @@ namespace mongo { /** * Get the stage tree wrapped by this executor, without transferring ownership. */ - PlanStage* getStages() const; + PlanStage* getRootStage() const; /** * Get the query that this executor is executing, without transferring ownership. diff --git a/src/mongo/db/storage/heap1/record_store_heap.cpp b/src/mongo/db/storage/heap1/record_store_heap.cpp index e0578dc5c71..24685d4bbc0 100644 --- a/src/mongo/db/storage/heap1/record_store_heap.cpp +++ b/src/mongo/db/storage/heap1/record_store_heap.cpp @@ -415,10 +415,10 @@ namespace mongo { ++_it; } - void HeapRecordIterator::prepareToYield() { + void HeapRecordIterator::saveState() { } - bool HeapRecordIterator::recoverFromYield() { + bool HeapRecordIterator::restoreState() { return !_killedByInvalidate; } @@ -480,10 +480,10 @@ namespace mongo { } } - void HeapRecordReverseIterator::prepareToYield() { + void HeapRecordReverseIterator::saveState() { } - bool HeapRecordReverseIterator::recoverFromYield() { + bool HeapRecordReverseIterator::restoreState() { return !_killedByInvalidate; } diff --git a/src/mongo/db/storage/heap1/record_store_heap.h b/src/mongo/db/storage/heap1/record_store_heap.h index f4810b04972..05180436023 100644 --- a/src/mongo/db/storage/heap1/record_store_heap.h +++ b/src/mongo/db/storage/heap1/record_store_heap.h @@ -191,9 +191,9 @@ namespace mongo { virtual void invalidate(const DiskLoc& dl); - virtual void prepareToYield(); + virtual void saveState(); - virtual bool recoverFromYield(); + virtual bool restoreState(); virtual RecordData dataFor( const DiskLoc& loc ) const; @@ -223,9 +223,9 @@ namespace mongo { virtual void invalidate(const DiskLoc& dl); - virtual void prepareToYield(); + virtual void saveState(); - virtual bool recoverFromYield(); + virtual bool restoreState(); virtual RecordData dataFor( const DiskLoc& loc ) const; diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.h b/src/mongo/db/storage/mmap_v1/record_store_v1_base.h index 72466c2b645..a71adc04a19 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.h +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.h @@ -286,9 +286,9 @@ namespace mongo { virtual void invalidate(const DiskLoc& dl); - virtual void prepareToYield() {} + virtual void saveState() {} - virtual bool recoverFromYield() { return true; } + virtual bool restoreState() { return true; } virtual RecordData dataFor( const DiskLoc& loc ) const { return _rs->dataFor(loc); } diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.cpp index 11f7894fe77..98557fa9193 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.cpp @@ -125,10 +125,10 @@ namespace mongo { } } - void CappedRecordStoreV1Iterator::prepareToYield() { + void CappedRecordStoreV1Iterator::saveState() { } - bool CappedRecordStoreV1Iterator::recoverFromYield() { + bool CappedRecordStoreV1Iterator::restoreState() { // If invalidate invalidated the DiskLoc we relied on, give up now. if (_killedByInvalidate) { _recordStore = NULL; diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.h b/src/mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.h index 501986d98fa..c82ae76d2c5 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.h +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.h @@ -60,8 +60,8 @@ namespace mongo { virtual DiskLoc curr(); virtual void invalidate(const DiskLoc& dl); - virtual void prepareToYield(); - virtual bool recoverFromYield(); + virtual void saveState(); + virtual bool restoreState(); virtual RecordData dataFor( const DiskLoc& loc ) const; private: diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h b/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h index c75c1c790c1..2b86fe20dfa 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h @@ -51,8 +51,8 @@ namespace mongo { virtual DiskLoc curr(); virtual void invalidate(const DiskLoc& dl); - virtual void prepareToYield() { } - virtual bool recoverFromYield() { + virtual void saveState() { } + virtual bool restoreState() { return true; } diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.cpp index 803b1494920..f6823bfb424 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.cpp +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.cpp @@ -115,10 +115,10 @@ namespace mongo { } } - void SimpleRecordStoreV1Iterator::prepareToYield() { + void SimpleRecordStoreV1Iterator::saveState() { } - bool SimpleRecordStoreV1Iterator::recoverFromYield() { + bool SimpleRecordStoreV1Iterator::restoreState() { // if the collection is dropped, then the cursor should be destroyed return true; } diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.h b/src/mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.h index ded30a3ee1d..7e50d05d96b 100644 --- a/src/mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.h +++ b/src/mongo/db/storage/mmap_v1/record_store_v1_simple_iterator.h @@ -53,8 +53,8 @@ namespace mongo { virtual DiskLoc curr(); virtual void invalidate(const DiskLoc& dl); - virtual void prepareToYield(); - virtual bool recoverFromYield(); + virtual void saveState(); + virtual bool restoreState(); virtual RecordData dataFor( const DiskLoc& loc ) const; diff --git a/src/mongo/db/storage/record_store.h b/src/mongo/db/storage/record_store.h index 8437046e5d6..ae053478f76 100644 --- a/src/mongo/db/storage/record_store.h +++ b/src/mongo/db/storage/record_store.h @@ -95,15 +95,15 @@ namespace mongo { // from the collection. Returns DiskLoc() if isEOF. virtual DiskLoc getNext() = 0; - // Can only be called after prepareToYield and before recoverFromYield. + // Can only be called after saveState and before restoreState. virtual void invalidate(const DiskLoc& dl) = 0; // Save any state required to resume operation (without crashing) after DiskLoc deletion or // a collection drop. - virtual void prepareToYield() = 0; + virtual void saveState() = 0; // Returns true if collection still exists, false otherwise. - virtual bool recoverFromYield() = 0; + virtual bool restoreState() = 0; // normally this will just go back to the RecordStore and convert // but this gives the iterator an oppurtnity to optimize diff --git a/src/mongo/db/storage/rocks/rocks_record_store.cpp b/src/mongo/db/storage/rocks/rocks_record_store.cpp index 664e643b760..a5dc79bdafc 100644 --- a/src/mongo/db/storage/rocks/rocks_record_store.cpp +++ b/src/mongo/db/storage/rocks/rocks_record_store.cpp @@ -298,11 +298,11 @@ namespace mongo { _iterator.reset( NULL ); } - void RocksRecordStore::Iterator::prepareToYield() { + void RocksRecordStore::Iterator::saveState() { // XXX: ??? } - bool RocksRecordStore::Iterator::recoverFromYield() { + bool RocksRecordStore::Iterator::restoreState() { // XXX: ??? return true; } diff --git a/src/mongo/db/storage/rocks/rocks_record_store.h b/src/mongo/db/storage/rocks/rocks_record_store.h index eeaf8df9882..e3551ed1dca 100644 --- a/src/mongo/db/storage/rocks/rocks_record_store.h +++ b/src/mongo/db/storage/rocks/rocks_record_store.h @@ -138,8 +138,8 @@ namespace mongo { virtual DiskLoc curr(); virtual DiskLoc getNext(); virtual void invalidate(const DiskLoc& dl); - virtual void prepareToYield(); - virtual bool recoverFromYield(); + virtual void saveState(); + virtual bool restoreState(); virtual RecordData dataFor( const DiskLoc& loc ) const; private: |