-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Sharding
-
Fully Compatible
-
Sharding 2021-03-22
-
2
In resharding state machines, we would like to rely on one source of truth – the cancelation token, in order to know to stop work. As it stands, many of the systems that resharding calls into are only interruptible by the OperationContext. To solve this problem, we should create the type CancelableOperationContext.
CancelableOperationContext is a class that will contain an OperationContext pointer and a cancelation token. When the token is canceled, if the OperationContext still exists, it will be interrupted.
The aim is to use CancelableOperationContext everywhere in resharding code instead of a regular OperationContext, so that we can easily translate canceling a token to interrupting work.
Some concurrency constraints that must be considered when creating this:
- We need to prevent the cancellation token from calling killOperation() on a freed OperationContext
- We need to prevent the OperationContext from being freed while the cancelation token is interacting with it
A mutex on the CancelableOperationContext may be the best way to solve the above.
- related to
-
SERVER-55306 Integrate CancelableOperationContext into ReshardingCollectionCloner
- Closed