[SERVER-55328] Call Pipeline::dispose() on cleanup executor in resharding data replication components Created: 19/Mar/21  Updated: 29/Oct/23  Resolved: 30/Mar/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Janna Golden
Resolution: Fixed Votes: 0
Labels: PM-234-M3, PM-234-T-error-flow
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 2021-04-05
Participants:
Story Points: 2

 Description   

Task executors are allowed to refuse work and the .onCompletion() continuation won't run if the task executor has been shut down. This is especially problematic for the ReshardingCollectionCloner after the changes from SERVER-54959 because the noCursorTimeout cursor will be permanently leaked on stepdown. We should instead be using the RecipientStateMachine::getInstanceCleanupExecutor() to run the .onCompletion() continuation.

ReshardingCollectionCloner::run() and ReshardingTxnCloner::run() should be changed to additionally accept the cleanup task executor and should return a SemiFuture<void> so the caller must explicitly do .thenRunOn(**executor) to chain any further continuations.

.on(executor, cancelToken)
.thenRunOn(cleanupExecutor)
.onCompletion([chainCtx](Status status) {
    if (chainCtx->pipeline) {
        // Use a separate Client to make a better effort of calling dispose() even when the
        // CancelationToken has been canceled.
        auto serviceContext = cc().getServiceContext();
        auto clientStrand = ClientStrand::make(
            serviceContext->makeClient("ReshardingCollectionClonerCleanup"));
        auto clientGuard = clientStrand->bind();
 
        auto opCtx = clientGuard->makeOperationContext();
        chainCtx->pipeline->dispose(opCtx.get());
        chainCtx->pipeline.reset();
    }
 
    return status;
})
.semi();



 Comments   
Comment by Githook User [ 30/Mar/21 ]

Author:

{'name': 'jannaerin', 'email': 'golden.janna@gmail.com', 'username': 'jannaerin'}

Message: SERVER-55328 Call Pipeline::dispose() on cleanup executor in resharding data replication components
Branch: master
https://github.com/mongodb/mongo/commit/5d668442373207c8c485ce8e32d2627cea4bd926

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