Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-9262: Connection and read timeouts are being ignored by UpdateShardHandler after SOLR-4509

Shalin Shekhar Mangar2b4420c4738b
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 0011c766c3d..7a4a86dab6e 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -37,7 +37,12 @@ Upgrading from Solr 6.x
* HttpSolrClient#setDefaultMaxConnectionsPerHost and
HttpSolrClient#setMaxTotalConnections have been removed. These now default very
high and can only be changed via param when creating an HttpClient instance.
-
+
+Bug Fixes
+----------------------
+* SOLR-9262: Connection and read timeouts are being ignored by UpdateShardHandler after SOLR-4509.
+ (Mark Miller, shalin)
+
Optimizations
----------------------
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
index 5cc77d2ecc9..30e31cac6b1 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
@@ -60,8 +60,19 @@ public class UpdateShardHandler {
}
ModifiableSolrParams clientParams = new ModifiableSolrParams();
- log.info("Creating UpdateShardHandler HTTP client with params: {}", clientParams);
+ if (cfg != null) {
+ clientParams.set(HttpClientUtil.PROP_SO_TIMEOUT, cfg.getDistributedSocketTimeout());
+ clientParams.set(HttpClientUtil.PROP_CONNECTION_TIMEOUT, cfg.getDistributedConnectionTimeout());
+ }
client = HttpClientUtil.createClient(clientParams, clientConnectionManager);
+
+ // following is done only for logging complete configuration.
+ // The maxConnections and maxConnectionsPerHost have already been specified on the connection manager
+ if (cfg != null) {
+ clientParams.set(HttpClientUtil.PROP_MAX_CONNECTIONS, cfg.getMaxUpdateConnections());
+ clientParams.set(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, cfg.getMaxUpdateConnectionsPerHost());
+ }
+ log.info("Created UpdateShardHandler HTTP client with params: {}", clientParams);
}
public HttpClient getHttpClient() {