nick-boss-tech opened a new pull request, #5297: URL: https://github.com/apache/solr/pull/5297
🤖 *AI text below* 🤖 *(reviewed by Nick Shanin)* Jira: [SOLR-18613](https://issues.apache.org/jira/browse/SOLR-18613) Context: this is PR 1 of the three-part plan proposed in the dev-list thread "Limiting LBSolrClient retries (inside CloudSolrClient & HttpShardHandler)", started by Chris Hostetter on October 26 and endorsed by Jason Gerlowski on November 2. This PR covers consistent LB enforcement only; CloudSolrClient controls (PR 2) and shard-request controls (PR 3) follow separately. ## What happens today **The request attempt limit configured on the load-balanced SolrJ clients is not enforced consistently, and hitting it is indistinguishable from an ordinary failure.** Attempts spent on live endpoints and attempts spent on the zombie-endpoint fallback are not counted together, so a request can exceed its configured limit; a live endpoint whose attempts are exhausted can be selected again; and when failover does stop, the caller receives the last endpoint failure with no indication that the attempt limit was the reason. ## What this change does **Both load-balanced clients enforce one attempt count per request, stop cleanly at the limit, and report exhaustion as its own exception.** [`LBSolrClient`](https://github.com/nick-boss-tech/solr/blob/2399d0312fa320563773ea87884ee4f534594974/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java) and `LBAsyncSolrClient` now count every attempt a request makes, across live endpoints and the zombie fallback alike, and do not retry a live endpoint whose attempts are exhausted. When the limit stops failover, the request fails with a new `AttemptLimitExceededException` carrying the attempts made, the configured limit, and the last failure as its cause, in both the synchronous and asynchronous clients. New tests cover the counting, the zombie fallback, and the exhaustion signal for both clients. ## Proof **The new attempt-limit suites and the existing load-balanced client suites all pass at the PR head.** Gate at `2399d0312f` (the branch rebased onto current `main`): tidy clean, Error Prone compile passes, `LBSolrClientAttemptLimitTest` passes 12 of 12, `LBAsyncSolrClientAttemptLimitTest` passes 12 of 12, and the pre-existing suites pass unchanged (`LBSolrClientTest` 8 of 8, `LBAsyncSolrClientTest` 4 of 4, `LB2SolrClientTest` 7 of 7, `LBSolrClientRetryUnsentTest` 3 of 3); `:solr:solrj:check -x test` passes. An earlier gate round at the pre-rebase head was also green and is recorded on the ticket's board receipt. ## Limits **Only the load-balanced clients' failover accounting changes.** The attempt limit's meaning is unchanged (it counts the initial attempt, as the new exception's javadoc states); what changes is that the count is now shared across the live and zombie paths and enforced in the async client as well. Endpoint health marking, zombie revival timing, and retry-on-unsent-request behavior are untouched, as the unchanged pre-existing suites show. *Nick Shanin directed the work and takes responsibility for this contribution.* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
