Move child task cancellation to TaskManager #44573
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Today TransportCancelTasksAction takes care of eventually cancelling
children tasks when needed, by banning any new task from being started
using the id of the cancelled task as parent task id. Also, any ongoing
task with the parent task id set to the id of the cancelled task is
cancelled.
This change moves this logic, without modifying any behaviour, to from
TransportCancelTasksAction to TaskManager. This will allow to support
recursive cancellation of tasks as a folow-up, as currently only
children tasks are cancelled but for instance grand-children don't. Once
TaskManager is able to send ban request autonomously, it can support
cancelling grand-children tasks too.
Relates to #44494, as adding an integration tests showed that cancelling
msearch will only cancel its corresponding sub-searches, but not the
shard level requests that have the sub-search tasks as parent tasks.