The ReshardingOplogApplier receives a ReshardingDonorOplogIterator which receives a ReshardingOplogFetcher*. The ReshardingOplogFetchers in ReshardingDataReplication must therefore outlive the ReshardingOplogAppliers. This requirement is already guaranteed by resharding::cancelWhenAnyErrorThenQuiesce() because ReshardingOplogAppliers will have stopped using their corresponding ReshardingOplogFetcher by the time the ReshardingDataReplication instance is destroyed.
This comment and the member order in ReshardingDataReplication state the opposite and should be updated now that cancellation tokens are being used.
const std::vector<std::unique_ptr<ReshardingOplogApplier>> _oplogAppliers; // The ReshardingOplogFetcher must be destructed before the corresponding ReshardingOplogApplier // to ensure the future returned by awaitInsert() is always eventually readied. const std::vector<std::unique_ptr<ReshardingOplogFetcher>> _oplogFetchers; const std::shared_ptr<executor::TaskExecutor> _oplogFetcherExecutor;