This is an automated email from the ASF dual-hosted git repository.
gerlowskija pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 3b22901c4ec SOLR-17764: Widen Cloud client's 503 response handling
(#5315)
3b22901c4ec is described below
commit 3b22901c4ece2c2dd7bc9e4d3c34f651371e095b
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.
---
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 fe24b43a9dd..2eb9a48d7d5 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
@@ -726,15 +726,11 @@ public abstract class CloudSolrClient extends SolrClient {
final boolean wasCommError = wasCommError(exc);
- 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) {