Skip to content

#357 Retry all REST requests on 409 errors#359

Merged
gunnarmorling merged 1 commit into
kcctl:mainfrom
C0urante:gh-357
Jul 29, 2023
Merged

#357 Retry all REST requests on 409 errors#359
gunnarmorling merged 1 commit into
kcctl:mainfrom
C0urante:gh-357

Conversation

@C0urante

@C0urante C0urante commented Jul 29, 2023

Copy link
Copy Markdown
Contributor

Fixes #357

This uses a different approach than what was proposed in the issue, but the effect should be mostly the same. I drafted up the retrying(() -> kafkaConnectApi.getConnectorConfig(conectorToPatch)) patch but realized that this would still have to be manually applied to all REST calls that could result in a 409 response, which seemed fairly brittle.

I did some research and it looks like we can get retry logic with our auto-generated REST client for free by bringing in a small extra dependency: https://quarkus.io/guides/smallrye-fault-tolerance

Since the API for describing retriable requests with this library is based on exception class, I added custom subclasses to the KafkaConnectException to help us distinguish between retriable and non-retriable operations. We could theoretically create a RetriableKafkaConnectException umbrella class for those, but that feels a little premature, especially since some exceptions may be retriable for only a subset of requests that throw them.

I was able to get 10 consecutive green integration test runs locally with this patch.

@gunnarmorling

Copy link
Copy Markdown
Collaborator

Oooh, that's lovely! Much more elegant indeed, great find, and great improvement 🥳 !

@gunnarmorling gunnarmorling merged commit 971e866 into kcctl:main Jul 29, 2023
@C0urante C0urante deleted the gh-357 branch July 30, 2023 05:52
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.

Make PatchConnectorCommand more robust againt concurrent config changes

2 participants