This is an automated email from the ASF dual-hosted git repository. dsmiley pushed a commit to branch branch_9x in repository https://gitbox.apache.org/repos/asf/solr.git
commit be1df5d2b8b9f413b30fafee8855a7986ac361b8 Author: Jason Gerlowski <[email protected]> AuthorDate: Thu Nov 12 11:47:49 2026 -0500 SOLR-17764: Widen Cloud client's 503 response handling (#5315) Prior to this commit CloudSolrClient invalidated its cached clusterstate and retried on only a subset of 503 responses. This narrow handling gave us incomplete coverage for the node-shutdown case: comm or IO errors caused by a shutdown would be retried, but 503s from "graceful" Jetty shutdown were not retried and caused errors. This commit widens the existing 503 handling to include the sort of 503s typically seen on node-shutdown. It makes SOLR_JETTY_GRACEFUL a more viable option for CloudSolrClient users. (cherry picked from commit 3b22901c4ece2c2dd7bc9e4d3c34f651371e095b) (cherry picked from commit 408560a2dafb085d0db5b082c5db6833250e3529) --- changelog/unreleased/SOLR-17764-tweak-csc-503-handling.yml | 8 ++++++++ .../org/apache/solr/client/solrj/impl/CloudSolrClient.java | 14 +++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/changelog/unreleased/SOLR-17764-tweak-csc-503-handling.yml b/changelog/unreleased/SOLR-17764-tweak-csc-503-handling.yml new file mode 100644 index 00000000000..f1f840366c4 --- /dev/null +++ b/changelog/unreleased/SOLR-17764-tweak-csc-503-handling.yml @@ -0,0 +1,8 @@ +title: > + In order to work better with "graceful" Jetty shutdown, CloudSolrClient now invalidates cached clusterstate on all 503 responses. +type: fixed +authors: + - name: Jason Gerlowski +links: + - name: SOLR-17764 + url: https://issues.apache.org/jira/browse/SOLR-17764 diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java index 37e4ac3c6bc..3e6c0fd1e0c 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrClient.java @@ -1010,15 +1010,11 @@ public abstract class CloudSolrClient extends SolrClient { final boolean wasCommError = wasCommError(rootCause); - if (wasCommError - || (exc instanceof RouteException - && (errorCode == 503)) // 404 because the core does not exist 503 service unavailable - // TODO there are other reasons for 404. We need to change the solr response format from HTML - // to structured data to know that - ) { - // it was a communication error. it is likely that - // the node to which the request to be sent is down . So , expire the state - // so that the next attempt would fetch the fresh state + // 503 emitted on node shutdown and by shard-handler when no replicas available + if (wasCommError || errorCode == 503) { + // if it was a communication error it is likely that + // the node to which the request to be sent is down . So expire the state + // so that the next attempt will fetch the fresh state // just re-read state for all of them, if it has not been retried // in retryExpiryTime time if (requestedCollections != null) {
