-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support hierarchical task cancellation #54757
Conversation
Pinging @elastic/es-distributed (:Distributed/Task Management) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
holder.cancel(reason); | ||
} | ||
} | ||
return cancellableTasks.values().stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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