Skip to content
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

Conversation

original-brownbear
Copy link
Member

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.

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.
@elasticmachine elasticmachine added the Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. label May 3, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Contributor

@DaveCTurner DaveCTurner left a 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));
Copy link
Contributor

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?

Copy link
Member Author

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?

Copy link
Contributor

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.

@original-brownbear
Copy link
Member Author

@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)

@original-brownbear
Copy link
Member Author

original-brownbear commented May 4, 2021

@DaveCTurner all good here otherwise ? :)

@DaveCTurner
Copy link
Contributor

Yes, otherwise all good. Is fixing the RestToXContentListener onerous? I'd rather do that first if possible.

@original-brownbear
Copy link
Member Author

Thanks @DaveCTurner fixed the listener now :)

Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@original-brownbear
Copy link
Member Author

Thanks David!

@original-brownbear original-brownbear merged commit 70f1e8c into elastic:master May 4, 2021
@original-brownbear original-brownbear deleted the make-get-snapshots-cancellable branch May 4, 2021 16:05
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Jun 7, 2021
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.
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Jun 7, 2021
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.
original-brownbear added a commit that referenced this pull request Jun 7, 2021
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.
original-brownbear added a commit that referenced this pull request Jun 7, 2021
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.
original-brownbear added a commit to original-brownbear/elasticsearch that referenced this pull request Jun 7, 2021
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.
original-brownbear added a commit that referenced this pull request Jun 7, 2021
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.
@original-brownbear original-brownbear restored the make-get-snapshots-cancellable branch April 18, 2023 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement Team:Distributed (Obsolete) Meta label for distributed team (obsolete). Replaced by Distributed Indexing/Coordination. v7.14.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants