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/text_or.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/text_or.cpp')
-rw-r--r-- | src/mongo/db/exec/text_or.cpp | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/src/mongo/db/exec/text_or.cpp b/src/mongo/db/exec/text_or.cpp index be600e3639d..d1e57871593 100644 --- a/src/mongo/db/exec/text_or.cpp +++ b/src/mongo/db/exec/text_or.cpp @@ -59,10 +59,10 @@ TextOrStage::TextOrStage(OperationContext* txn, WorkingSet* ws, const MatchExpression* filter, IndexDescriptor* index) - : _ftsSpec(ftsSpec), + : PlanStage(kStageType), + _ftsSpec(ftsSpec), _ws(ws), _scoreIterator(_scores.end()), - _commonStats(kStageType), _filter(filter), _txn(txn), _idRetrying(WorkingSet::INVALID_ID), @@ -78,41 +78,22 @@ bool TextOrStage::isEOF() { return _internalState == State::kDone; } -void TextOrStage::saveState() { +void TextOrStage::doSaveState() { _txn = NULL; - ++_commonStats.yields; - - for (auto& child : _children) { - child->saveState(); - } - if (_recordCursor) { _recordCursor->saveUnpositioned(); } } -void TextOrStage::restoreState(OperationContext* opCtx) { +void TextOrStage::doRestoreState(OperationContext* opCtx) { invariant(_txn == NULL); _txn = opCtx; - ++_commonStats.unyields; - - for (auto& child : _children) { - child->restoreState(opCtx); - } - if (_recordCursor) { invariant(_recordCursor->restore(opCtx)); } } -void TextOrStage::invalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) { - ++_commonStats.invalidates; - - // Propagate invalidate to children. - for (auto& child : _children) { - child->invalidate(txn, dl, type); - } - +void TextOrStage::doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) { // Remove the RecordID from the ScoreMap. ScoreMap::iterator scoreIt = _scores.find(dl); if (scoreIt != _scores.end()) { @@ -123,14 +104,6 @@ void TextOrStage::invalidate(OperationContext* txn, const RecordId& dl, Invalida } } -vector<PlanStage*> TextOrStage::getChildren() const { - std::vector<PlanStage*> vec; - for (auto& child : _children) { - vec.push_back(child.get()); - } - return vec; -} - std::unique_ptr<PlanStageStats> TextOrStage::getStats() { _commonStats.isEOF = isEOF(); @@ -150,10 +123,6 @@ std::unique_ptr<PlanStageStats> TextOrStage::getStats() { return ret; } -const CommonStats* TextOrStage::getCommonStats() const { - return &_commonStats; -} - const SpecificStats* TextOrStage::getSpecificStats() const { return &_specificStats; } |