summaryrefslogtreecommitdiff
path: root/src/mongo/db/exec/count_scan.cpp
diff options
context:
space:
mode:
authorQingyang Chen <qingyang.chen@10gen.com>2015-08-03 12:17:47 -0400
committerQingyang Chen <qingyang.chen@10gen.com>2015-08-04 16:12:30 -0400
commitbe8a683771004a2541c730a1ac0e35cd13e03a8b (patch)
tree20b31de1fea9f59011899b568771f069327f113f /src/mongo/db/exec/count_scan.cpp
parent84182ff1575cbe868a89e7209f12ca665f4bda19 (diff)
downloadmongo-be8a683771004a2541c730a1ac0e35cd13e03a8b.tar.gz
SERVER-19364 move query stage OperationContext pointer management into the base class
Diffstat (limited to 'src/mongo/db/exec/count_scan.cpp')
-rw-r--r--src/mongo/db/exec/count_scan.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/mongo/db/exec/count_scan.cpp b/src/mongo/db/exec/count_scan.cpp
index 6ba9d710f5d..56b7cf34eee 100644
--- a/src/mongo/db/exec/count_scan.cpp
+++ b/src/mongo/db/exec/count_scan.cpp
@@ -43,8 +43,7 @@ using stdx::make_unique;
const char* CountScan::kStageType = "COUNT_SCAN";
CountScan::CountScan(OperationContext* txn, const CountScanParams& params, WorkingSet* workingSet)
- : PlanStage(kStageType),
- _txn(txn),
+ : PlanStage(kStageType, txn),
_workingSet(workingSet),
_descriptor(params.descriptor),
_iam(params.descriptor->getIndexCatalog()->getIndex(params.descriptor)),
@@ -81,7 +80,7 @@ PlanStage::StageState CountScan::work(WorkingSetID* out) {
if (needInit) {
// First call to work(). Perform cursor init.
- _cursor = _iam->newCursor(_txn);
+ _cursor = _iam->newCursor(getOpCtx());
_cursor->setEndPosition(_params.endKey, _params.endKeyInclusive);
entry = _cursor->seek(_params.startKey, _params.startKeyInclusive, kWantLoc);
@@ -131,20 +130,17 @@ void CountScan::doRestoreState() {
// This can change during yielding.
// TODO this isn't sufficient. See SERVER-17678.
- _shouldDedup = _descriptor->isMultikey(_txn);
+ _shouldDedup = _descriptor->isMultikey(getOpCtx());
}
void CountScan::doDetachFromOperationContext() {
- _txn = NULL;
if (_cursor)
_cursor->detachFromOperationContext();
}
-void CountScan::doReattachToOperationContext(OperationContext* opCtx) {
- invariant(_txn == NULL);
- _txn = opCtx;
+void CountScan::doReattachToOperationContext() {
if (_cursor)
- _cursor->reattachToOperationContext(opCtx);
+ _cursor->reattachToOperationContext(getOpCtx());
}
void CountScan::doInvalidate(OperationContext* txn, const RecordId& dl, InvalidationType type) {