[SERVER-56381] Investigate OpCtx & dispose() mechanism in $unionWith Created: 27/Apr/21  Updated: 27/Oct/23  Resolved: 08/Sep/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Question Priority: Trivial - P5
Reporter: Charlie Swanson Assignee: Charlie Swanson
Resolution: Gone away Votes: 0
Labels: query-director-triage, quick-tech-debt
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

I was chatting with max.hirschhorn today about how to properly use a Pipeline across different OperationContexts to ensure that the Pipeline is destroyed before the OperationContext. I noticed that $lookup and $unionWith have different handling for how they do this - which led me to question which one is superior or if there's a good reason for the difference.

In $lookup, we manually take control over the sub-pipeline disposal, as you can see here. In $unionWith, we don't do that, but we do have a similar cleanup block in doDispose(), just like $lookup. It seems like maybe we should dismissDisposal for $unionWith, and that this might simplify some of the code which is trying to preserve information like the explain plan?

I think it might be worth an investigation if no one has an easy answer about this.



 Comments   
Comment by Charlie Swanson [ 08/Sep/21 ]

This turned out to be an issue and is being worked on as part of SERVER-57168. The summary is that it looks like $unionWith should be updated to take control of disposal.

Generated at Thu Feb 08 05:39:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.