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

Add support for retries #60

Merged
merged 6 commits into from
Jan 20, 2022
Merged

Add support for retries #60

merged 6 commits into from
Jan 20, 2022

Conversation

mpenick
Copy link
Contributor

@mpenick mpenick commented Dec 17, 2021

This is the final issue that fixes: #3. Previous PRs added the ability to detect if requests are idempotent. With this information and a retry policy we can automatically handle a number of server-side failures that are usually handled by the driver, but would not be possible with driver though the proxy (because its view is a single node cluster).

Base automatically changed from idempotent-mutations to main January 10, 2022 19:59
@mpenick mpenick changed the title [WIP] Add support for retries Add support for retries Jan 11, 2022
{ // Error response (truncate), retry until succeeds or exhausts query plan
idempotentQuery,
&message.TruncateError{ErrorMessage: "Truncate"},
"cql error: ERROR UNAVAILABLE (code=ErrorCode Unavailable [0x00001000], msg=No more hosts available (exhausted query plan), cl=ConsistencyLevel ANY [0x0000], required=0, alive=0)",
Copy link
Contributor Author

@mpenick mpenick Jan 11, 2022

Choose a reason for hiding this comment

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

This should probably not verify against the exact error string. This is a bit fragile.

Copy link
Collaborator

@joao-r-reis joao-r-reis left a comment

Choose a reason for hiding this comment

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

Looks good to me, I added a couple of questions and a couple of tiny suggestions regarding the tests.

I always read tests first because I see them as a kind of documentation when I'm reading new code and it was pretty easy to follow the expected behavior of the code by following your tests 👍

proxy/proxy_retries_test.go Show resolved Hide resolved
proxy/proxy_retries_test.go Outdated Show resolved Hide resolved
proxy/proxy_retries_test.go Outdated Show resolved Hide resolved
proxy/proxy_retries_test.go Show resolved Hide resolved
proxy/request.go Show resolved Hide resolved
proxy/request.go Show resolved Hide resolved
proxy/request.go Outdated Show resolved Hide resolved
@mpenick mpenick merged commit 24c0b70 into main Jan 20, 2022
@mpenick mpenick deleted the retries branch January 20, 2022 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically retry queries when they're idempotent
3 participants