diff options
Diffstat (limited to 'src/mongo/db/exec/delete.cpp')
-rw-r--r-- | src/mongo/db/exec/delete.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp index 4a9f6638c2d..90b87cce6bc 100644 --- a/src/mongo/db/exec/delete.cpp +++ b/src/mongo/db/exec/delete.cpp @@ -58,8 +58,7 @@ DeleteStage::DeleteStage(OperationContext* txn, WorkingSet* ws, Collection* collection, PlanStage* child) - : PlanStage(kStageType), - _txn(txn), + : PlanStage(kStageType, txn), _params(params), _ws(ws), _collection(collection), @@ -138,9 +137,9 @@ PlanStage::StageState DeleteStage::work(WorkingSetID* out) { // If the snapshot changed, then we have to make sure we have the latest copy of the // doc and that it still matches. std::unique_ptr<RecordCursor> cursor; - if (_txn->recoveryUnit()->getSnapshotId() != member->obj.snapshotId()) { - cursor = _collection->getCursor(_txn); - if (!WorkingSetCommon::fetch(_txn, _ws, id, cursor)) { + if (getOpCtx()->recoveryUnit()->getSnapshotId() != member->obj.snapshotId()) { + cursor = _collection->getCursor(getOpCtx()); + if (!WorkingSetCommon::fetch(getOpCtx(), _ws, id, cursor)) { // Doc is already deleted. Nothing more to do. ++_commonStats.needTime; return PlanStage::NEED_TIME; @@ -179,13 +178,13 @@ PlanStage::StageState DeleteStage::work(WorkingSetID* out) { // Do the write, unless this is an explain. if (!_params.isExplain) { - WriteUnitOfWork wunit(_txn); + WriteUnitOfWork wunit(getOpCtx()); const bool deleteCappedOK = false; const bool deleteNoWarn = false; BSONObj deletedId; - _collection->deleteDocument(_txn, + _collection->deleteDocument(getOpCtx(), rloc, deleteCappedOK, deleteNoWarn, @@ -265,10 +264,6 @@ void DeleteStage::doRestoreState() { repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(ns)); } -void DeleteStage::doReattachToOperationContext(OperationContext* opCtx) { - _txn = opCtx; -} - unique_ptr<PlanStageStats> DeleteStage::getStats() { _commonStats.isEOF = isEOF(); unique_ptr<PlanStageStats> ret = make_unique<PlanStageStats>(_commonStats, STAGE_DELETE); |