@@ -60,8 +60,7 @@ CachedPlanStage::CachedPlanStage(OperationContext* txn,
6060 const QueryPlannerParams& params,
6161 size_t decisionWorks,
6262 PlanStage* root)
63- : PlanStage(kStageType ),
64- _txn (txn),
63+ : PlanStage(kStageType , txn),
6564 _collection (collection),
6665 _ws(ws),
6766 _canonicalQuery(cq),
@@ -228,15 +227,16 @@ Status CachedPlanStage::replan(PlanYieldPolicy* yieldPolicy, bool shouldCache) {
228227
229228 PlanStage* newRoot;
230229 // Only one possible plan. Build the stages from the solution.
231- verify (StageBuilder::build (_txn , _collection, *solutions[0 ], _ws, &newRoot));
230+ verify (StageBuilder::build (getOpCtx () , _collection, *solutions[0 ], _ws, &newRoot));
232231 _children.emplace_back (newRoot);
233232 _replannedQs.reset (solutions.popAndReleaseBack ());
234233 return Status::OK ();
235234 }
236235
237236 // Many solutions. Create a MultiPlanStage to pick the best, update the cache,
238237 // and so on. The working set will be shared by all candidate plans.
239- _children.emplace_back (new MultiPlanStage (_txn, _collection, _canonicalQuery, shouldCache));
238+ _children.emplace_back (
239+ new MultiPlanStage (getOpCtx (), _collection, _canonicalQuery, shouldCache));
240240 MultiPlanStage* multiPlanStage = static_cast <MultiPlanStage*>(child ().get ());
241241
242242 for (size_t ix = 0 ; ix < solutions.size (); ++ix) {
@@ -245,7 +245,7 @@ Status CachedPlanStage::replan(PlanYieldPolicy* yieldPolicy, bool shouldCache) {
245245 }
246246
247247 PlanStage* nextPlanRoot;
248- verify (StageBuilder::build (_txn , _collection, *solutions[ix], _ws, &nextPlanRoot));
248+ verify (StageBuilder::build (getOpCtx () , _collection, *solutions[ix], _ws, &nextPlanRoot));
249249
250250 // Takes ownership of 'solutions[ix]' and 'nextPlanRoot'.
251251 multiPlanStage->addPlan (solutions.releaseAt (ix), nextPlanRoot, _ws);
@@ -291,11 +291,6 @@ PlanStage::StageState CachedPlanStage::work(WorkingSetID* out) {
291291 return childStatus;
292292}
293293
294-
295- void CachedPlanStage::doReattachToOperationContext (OperationContext* opCtx) {
296- _txn = opCtx;
297- }
298-
299294void CachedPlanStage::doInvalidate (OperationContext* txn,
300295 const RecordId& dl,
301296 InvalidationType type) {
0 commit comments