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

Backport support for cancelling requests #46592

Closed

Conversation

javanna
Copy link
Member

@javanna javanna commented Sep 11, 2019

This is a cumulative backport PR that includes:

javanna and others added 4 commits September 11, 2019 13:49
…lastic#45379)

The low-level REST client exposes a `performRequestAsync` method that
allows to send async requests, but today it does not expose the ability
to cancel such requests. That is something that the underlying apache
async http client supports, and it makes sense for us to expose.

This commit adds a return value to the `performRequestAsync` method,
which is backwards compatible. A `Cancellable` object gets returned,
which exposes a `cancel` public method. When calling `cancel`, the
on-going request associated with the returned `Cancellable` instance
will be cancelled by calling its `abort` method. This works throughout
multiple retries, though some special care was needed for the case where
`cancel` is called between different attempts (when one attempt has
failed and the consecutive one has not been sent yet).

Note that cancelling a request on the client side does not automatically 
translate to cancelling the server side execution of it. That needs to be 
specifically implemented, which is on the work for the search API (see elastic#43332).

Relates to elastic#44802
…elastic#45688)

This commits makes all the async methods in the high level client return the `Cancellable` object that the low level client now exposes.

Relates to elastic#45379 
Closes elastic#44802
)

Add a section to both the low level and high level client documentation on asynchronous usage and `Cancellable` added for elastic#44802 

Co-Authored-By: Lee Hinman <[email protected]>
This test verifies automatic cancellation of search requests on connection close.
It was previously not present in 7.x as the http client was subject do a bug which
made testing cancellation of requests impossible. Now that the bug is fixed upstream,
we can also backport this test
@javanna javanna force-pushed the backport/low_level_client_cancellation branch from ddfb8ad to 2858816 Compare September 11, 2019 13:59
@javanna
Copy link
Member Author

javanna commented Sep 12, 2019

Merged from command line.

@javanna javanna closed this Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants