Call Pipeline::dispose() if Pipeline::getNext() throws in ReshardingCollectionCloner

XMLWordPrintableJSON

    • Fully Compatible
    • v5.0
    • Sharding 2021-07-12
    • 1
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      We should add a guard around the call to resharding::data_copy::fillBatchForInsert() to call Pipeline::dispose() if Pipeline::getNext() throws.

      auto guard = makeGuard([&] { pipeline->dispose(opCtx); pipeline.reset() });
      pipeline->reattachToOperationContext(opCtx);
      auto doc = pipeline->getNext();
      pipeline->detachFromOperationContext();
      guard.dismiss();
      

      Note that this other call to Pipeline::getNext() doesn't an explicit guard to call Pipeline::dispose() because PipelineDeleter::dismissDisposal() hasn't been called yet.

              Assignee:
              Luis Osta (Inactive)
              Reporter:
              Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: