[SERVER-55306] Integrate CancelableOperationContext into ReshardingCollectionCloner Created: 18/Mar/21  Updated: 29/Oct/23  Resolved: 25/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: PM Bot Assignee: Janna Golden
Resolution: Fixed Votes: 0
Labels: PM-234-M3, PM-234-T-error-flow, autogen-todo
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-55102 [resharding] Create a CancelableOpera... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2021-04-05
Participants:
Story Points: 1

 Description   

The ReshardingCollectionCloner::_withTemporaryOperationContext() method and its lengthy doc comment can be removed. Consider introducing a slim CancelableOperationContextFactory class to avoid the repetition with constructing the CancelableOperationContext by enabling callers to write auto opCtx = factory.makeOperationContext(&cc()); instead.

class CancelableOperationContextFactory {
public:
    CancelableOperationContextFactory(CancelationToken cancelToken, ExecutorPtr executor)
        : _cancelToken{std::move(cancelToken)}, _executor{std::move(executor)} {}
 
    CancelableOperationContext makeOperationContext(Client* client) const {
        return CancelableOperationContext{client->makeOperationContext(), _cancelToken, _executor};
    }
 
private:
    const CancelationToken _cancelToken;
    const ExecutorPtr _executor;
};


There is a TODO in the codebase referencing a resolved ticket which is assigned to you.

Please follow this link to see the lines of code referencing this resolved ticket:
https://github.com/mongodb/mongo/search?q=SERVER-55102&type=Code

The next steps for this ticket are to either remove the outdated TODO or follow the steps in the TODO if it is correct. If the latter, please update the summary and description of this ticket to represent the work you're actually doing.



 Comments   
Comment by Githook User [ 02/Apr/21 ]

Author:

{'name': 'Alex Taskov', 'email': 'alex.taskov@mongodb.com', 'username': 'alextaskov'}

Message: SERVER-55306 Integrate CancelableOperationContext into ReshardingCoordinator
Branch: master
https://github.com/mongodb/mongo/commit/d7413e1de2cfcf71de7c33af791ffaa6940fbdf8

Comment by Githook User [ 25/Mar/21 ]

Author:

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

Message: SERVER-55306 Integrate CancelableOperationContext into ReshardingCollectionCloner
Branch: master
https://github.com/mongodb/mongo/commit/d5ec2876050089857832308a5f72ea23dbb49715

Comment by Max Hirschhorn [ 19/Mar/21 ]

I think we should add a std::shared_ptr<ThreadPool> _markKilledExecutor member to RecipientStateMachine and initialize it as a thread pool of at most size 1. We need a separate thread to always be available to run the markKilled() continuation that is chained onto CancelationToken::onCancel() by CancelableOperationContext. In particular, we cannot use the scoped task executor because it may not have any threads available to run a new task when the CancelationToken is canceled.

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