mirror of https://github.com/apache/lucene.git
SOLR-9262: Connection and read timeouts are being ignored by UpdateShardHandler after SOLR-4509
This commit is contained in:
parent
6674969a89
commit
51fde1cbf9
|
@ -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
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -221,10 +221,6 @@ public class HttpClientUtil {
|
|||
logger.debug("Creating new http client, config:" + config);
|
||||
}
|
||||
|
||||
if (params.get(PROP_SO_TIMEOUT) != null || params.get(PROP_CONNECTION_TIMEOUT) != null) {
|
||||
throw new SolrException(ErrorCode.SERVER_ERROR, "The socket connect and read timeout cannot be set here and must be set");
|
||||
}
|
||||
|
||||
cm.setMaxTotal(params.getInt(HttpClientUtil.PROP_MAX_CONNECTIONS, 10000));
|
||||
cm.setDefaultMaxPerRoute(params.getInt(HttpClientUtil.PROP_MAX_CONNECTIONS_PER_HOST, 10000));
|
||||
cm.setValidateAfterInactivity(Integer.getInteger(VALIDATE_AFTER_INACTIVITY, VALIDATE_AFTER_INACTIVITY_DEFAULT));
|
||||
|
@ -261,7 +257,7 @@ public class HttpClientUtil {
|
|||
newHttpClientBuilder = newHttpClientBuilder.setKeepAliveStrategy(keepAliveStrat)
|
||||
.evictIdleConnections((long) Integer.getInteger(EVICT_IDLE_CONNECTIONS, EVICT_IDLE_CONNECTIONS_DEFAULT), TimeUnit.MILLISECONDS);
|
||||
|
||||
HttpClientBuilder builder = setupBuilder(newHttpClientBuilder, params == null ? new ModifiableSolrParams() : params);
|
||||
HttpClientBuilder builder = setupBuilder(newHttpClientBuilder, params);
|
||||
|
||||
HttpClient httpClient = builder.setConnectionManager(cm).build();
|
||||
|
||||
|
|
Loading…
Reference in New Issue