-
Notifications
You must be signed in to change notification settings - Fork 284
Add configurable single node retry #1120
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
Conversation
Enabling single node retryTo enable single node retry, use the Rest5Client client = Rest5Client.builder(HttpHost.create("http://gateway.example.com:9200"))
.setEnableSingleNodeRetry(true)
.build();Setting maximum retry attemptsYou can configure the maximum number of retry attempts using Rest5Client client = Rest5Client.builder(HttpHost.create("http://gateway.example.com:9200"))
.setEnableSingleNodeRetry(true)
.setMaxSingleNodeRetryAttempts(3)
.build();The default value is |
|
@l-trotta hi, could you please help me take a look at this? |
|
hey @ban-xiu, thanks for contributing! I took a quick look, and I'm not sure this is how we want this implemented: we already had plans for a generic retry mechanism (see this PR) which would work regardless of the number of nodes, also the idea would be to make the feature independent from the rest client implementation (since the rest5client is only the default implementation we provide), and to reuse the BackoffPolicy logic that is currently only used in the bulk ingester. I'll give this some thought and update soon. |
|
@l-trotta The focus of these two PRs is different: the logic for node retries already exists by default, but there is a lack of retry logic specifically for gateway nodes. |
|
Architecturally, rest5client and the planned new client are independent of each other. There is no subordinate relationship between them, and they do not conflict with one another. They represent two separate sets of solutions that can be used either independently or concurrently. |
|
Hello @ban-xiu, after a lot of thinking I'm confirming my initial decision not to accept these changes. It's not a refusal to implement a retry mechanism, I agree that the client is missing one, since currently it only works if there are multiple nodes, and there's no way to configure the dead node marking behavior, but my goal is to have something flexible that will work regardless of the number of nodes, and regardless of the http client implementation. To clarify on the architecture: This is the reason why I'd like the retry mechanism not to be strictly tied to As for what you need right now, I'd suggest reusing the code you wrote to create a custom transport that suits your case: without having to fork the client you can simply copy your implementation of YourRest5Client restClient = YourRest5Client
.builder(...).build();
ElasticsearchTransport transport = new YourRest5ClientTransport(
restClient, new JacksonJsonpMapper(), options);
ElasticsearchClient esClient = new ElasticsearchClient(transport);If you'd like to follow this route I'd be happy to help, we could also have this implementation added to Thanks again for your time contributing to the client, I'm closing this for now, but feel free to reply below or open a new issue if you need further clarification. |
Add configurable single node retry mechanism to improve reliability in single-node deployments (e.g., gateway forwarding architectures).
Changes:
This feature is particularly useful in gateway forwarding architectures where the client can only connect to a single gateway node, improving reliability by automatically retrying transient failures.
Backward compatible: disabled by default, no breaking changes.
I hope this feature will bring tangible improvements to the project's stability. The code is ready, and I welcome any suggestions for improvement. Looking forward to merging it soon!