diff options
author | Mathias Stearn <mathias@10gen.com> | 2015-07-08 12:40:15 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2015-07-16 14:37:02 -0400 |
commit | c832bc753c29f91597b75fa02c0d9019c3c20b0f (patch) | |
tree | 5324f665212988a354ff6ba254b239dc594d2c7d /src/mongo/db/exec/index_scan.cpp | |
parent | f64b6c596f9dcd1bae7011a3230b517386baa255 (diff) | |
download | mongo-c832bc753c29f91597b75fa02c0d9019c3c20b0f.tar.gz |
SERVER-17364 Unify handling of child stages into PlanStage base class
This is prep for adding more methods that need to propagate to children.
Diffstat (limited to 'src/mongo/db/exec/index_scan.cpp')
-rw-r--r-- | src/mongo/db/exec/index_scan.cpp | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp index e994404960a..34f93786b6f 100644 --- a/src/mongo/db/exec/index_scan.cpp +++ b/src/mongo/db/exec/index_scan.cpp @@ -62,7 +62,8 @@ IndexScan::IndexScan(OperationContext* txn, const IndexScanParams& params, WorkingSet* workingSet, const MatchExpression* filter) - : _txn(txn), + : PlanStage(kStageType), + _txn(txn), _workingSet(workingSet), _iam(params.descriptor->getIndexCatalog()->getIndex(params.descriptor)), _keyPattern(params.descriptor->keyPattern().getOwned()), @@ -71,7 +72,6 @@ IndexScan::IndexScan(OperationContext* txn, _shouldDedup(true), _forward(params.direction == 1), _params(params), - _commonStats(kStageType), _endKeyInclusive(false) { // We can't always access the descriptor in the call to getStats() so we pull // any info we need for stats reporting out here. @@ -233,14 +233,13 @@ bool IndexScan::isEOF() { return _commonStats.isEOF; } -void IndexScan::saveState() { +void IndexScan::doSaveState() { if (!_txn) { // We were already saved. Nothing to do. return; } - _txn = NULL; - ++_commonStats.yields; + if (!_indexCursor) return; @@ -252,18 +251,14 @@ void IndexScan::saveState() { _indexCursor->savePositioned(); } -void IndexScan::restoreState(OperationContext* opCtx) { +void IndexScan::doRestoreState(OperationContext* opCtx) { invariant(_txn == NULL); _txn = opCtx; - ++_commonStats.unyields; - if (_indexCursor) _indexCursor->restore(opCtx); } -void IndexScan::invalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) { - ++_commonStats.invalidates; - +void IndexScan::doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) { // The only state we're responsible for holding is what RecordIds to drop. If a document // mutates the underlying index cursor will deal with it. if (INVALIDATION_MUTATION == type) { @@ -279,10 +274,6 @@ void IndexScan::invalidate(OperationContext* txn, const RecordId& dl, Invalidati } } -std::vector<PlanStage*> IndexScan::getChildren() const { - return {}; -} - std::unique_ptr<PlanStageStats> IndexScan::getStats() { // WARNING: this could be called even if the collection was dropped. Do not access any // catalog information here. @@ -309,10 +300,6 @@ std::unique_ptr<PlanStageStats> IndexScan::getStats() { return ret; } -const CommonStats* IndexScan::getCommonStats() const { - return &_commonStats; -} - const SpecificStats* IndexScan::getSpecificStats() const { return &_specificStats; } |