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

Enable HTTP Sink request retries #120

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

grzegorz8
Copy link
Member

@grzegorz8 grzegorz8 commented Aug 28, 2024

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: either none (no retries, this is effectively the same as at-most-once) or at-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-L223

PR Checklist

.collect(Collectors.toList());
}

public List<HttpRequest> getFailedRequests() {
Copy link
Contributor

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

Copy link
Member Author

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<>();
Copy link
Contributor

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?

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.

3 participants