Support hierarchical task cancellation#54757
Conversation
|
Pinging @elastic/es-distributed (:Distributed/Task Management) |
| holder.cancel(reason); | ||
| } | ||
| } | ||
| return cancellableTasks.values().stream() |
There was a problem hiding this comment.
I wonder if we need to eventually optimize this, in case there might be a very large list of cancellable tasks. Also, this does not have proper happens-before, as iterating a concurrent map after an element has been added is not guaranteed to yield the element (it's eventually consistent).
++ This is on the plan. This optimization can be useful for CSS with minimize_round_trip disabled.
I see your point. We don't need to cancel children of tasks that are registered after we placed the ban because they do not have any child (they are canceled and unregistered before starting). Anyway, this logic is quite subtle. I will look into this in a follow-up. I will merge this PR to unblock Igor's work. Thank you for reviews, Yannick! |
With this change, when a task is canceled, the task manager will cancel not only its direct child tasks but all also its descendant tasks. Closes #50990
This change allows the submit async search task to cancel children and removes the manual indirection that cancels the search task when the submit task is cancelled. This is now handled by the task cancellation, which can cancel grand-children since elastic#54757.
) This change allows the submit async search task to cancel children and removes the manual indirection that cancels the search task when the submit task is cancelled. This is now handled by the task cancellation, which can cancel grand-children since #54757.
) This change allows the submit async search task to cancel children and removes the manual indirection that cancels the search task when the submit task is cancelled. This is now handled by the task cancellation, which can cancel grand-children since #54757.
With this change, when a task is canceled, the task manager will cancel not only its direct child tasks but all its descendant tasks.
Closes #50990