-
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
Make GetSnapshotsAction Cancellable #72644
Make GetSnapshotsAction Cancellable #72644
Conversation
If this runs needlessly for large repositories (especially in timeout/retry situations) it's a significant memory+cpu hit => made it cancellable like we recently did for many other endpoints.
Pinging @elastic/es-distributed (Team:Distributed) |
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.
Yes, good call. I left one optional request.
getSnapshotsRequest, | ||
// no need to fork here, this will be called on the generic pool anyway if its a large response for more than the | ||
// currently running snapshots | ||
new DispatchingRestToXContentListener<>(EsExecutors.DIRECT_EXECUTOR_SERVICE, channel, request)); |
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.
Dispatching to EsExecutors.DIRECT_EXECUTOR_SERVICE
seems a bit weird. Is this because RestToXContentListener
doesn't check for cancellation before calling toXContent()
? If so, can we address that in RestToXContentListener
instead?
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.
Yea that was because we didn't have that check in the general listener. Should we maybe make that move in a separate PR? Even though it seems like "nothing could go wrong" by doing that, might be better having it in isolation?
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.
Sure, sounds like a good plan.
@DaveCTurner thanks for taking a look. ++ to the request in general :) (maybe note I'm currently looking into refactoring the x-content building logic around this a little anyway to deal with the crazy way we manage resources so that would fit in nicely with that line of effort anyway) |
@DaveCTurner all good here otherwise ? :) |
Yes, otherwise all good. Is fixing the |
Thanks @DaveCTurner fixed the listener now :) |
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
Thanks David! |
Same as elastic#72644. This is a much longer running action than normal get snapshots even so it should definitely be cancellable. Parallelization for this action will be introduced in a separate PR.
If this runs needlessly for large repositories (especially in timeout/retry situations) it's a significant memory+cpu hit => made it cancellable like we recently did for many other endpoints.
Same as #72644. This is a much longer running action than normal get snapshots even so it should definitely be cancellable. Parallelization for this action will be introduced in a separate PR.
Same as elastic#72644. This is a much longer running action than normal get snapshots even so it should definitely be cancellable. Parallelization for this action will be introduced in a separate PR.
If this runs needlessly for large repositories (especially in timeout/retry situations)
it's a significant memory+cpu hit => made it cancellable like we recently did for many
other endpoints.