Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-56381

Investigate OpCtx & dispose() mechanism in $unionWith

      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.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: