-
Notifications
You must be signed in to change notification settings - Fork 45
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
Enable HTTP Sink request retries #120
base: main
Are you sure you want to change the base?
Conversation
.collect(Collectors.toList()); | ||
} | ||
|
||
public List<HttpRequest> getFailedRequests() { |
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.
I did a google and found. https://stackoverflow.com/questions/47680711/which-http-errors-should-never-trigger-an-automatic-retry . It seems to be that you should only retry if the status code is retriable. Maybe group into successful, retriable and failed (no retry).
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.
Thanks! Good point. I may refactor the code so that there are 3 statuses as you suggested. The change may also affect lookup, not only sink. So as a "side-effect" I may introduce lookup retry feature :)
// See com.getindata.connectors.http.internal.sink.httpclient. | ||
// JavaNetSinkHttpClient#putRequests where requests are submitted sequentially and | ||
// then their futures are joined sequentially too. | ||
List<HttpSinkRequestEntry> failedRequestEntries = new ArrayList<>(); |
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.
Can we have multiple values for the same key in one list of requestEntries
? It seems to me that by introducing retry mechanism we can interfere with final entries ordering. That may be the case, when latest key entry is saved successfully and then older is retried, effectively overwriting latest value. Do I read that correctly?
Description
Currently HTTP Sink does not retry failed requests which make it impossible to use in many scenarios.
This PR allows to define expected behaviour by setting
sink.delivery-guarantee
: eithernone
(no retries, this is effectively the same as at-most-once) orat-least-once
.exactly-once
is not supported.Implemented based on aws connectors using
AsyncSinkBase
, for example: https://github.com/apache/flink-connector-aws/blob/main/flink-connector-aws/flink-connector-aws-kinesis-streams/src/main/java/org/apache/flink/connector/kinesis/sink/KinesisStreamsSinkWriter.java#L213-L223PR Checklist