You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2017/04/14 06:30:22 UTC
lucene-solr:branch_6x: SOLR-9936: Allow configuration for
recoveryExecutor thread pool size.
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 8681dafd5 -> 5116968ba
SOLR-9936: Allow configuration for recoveryExecutor thread pool size.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/5116968b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/5116968b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/5116968b
Branch: refs/heads/branch_6x
Commit: 5116968babb9ea1cd283574beff3e3e83c397c97
Parents: 8681daf
Author: markrmiller <ma...@apache.org>
Authored: Fri Apr 14 01:33:19 2017 -0400
Committer: markrmiller <ma...@apache.org>
Committed: Fri Apr 14 02:30:15 2017 -0400
----------------------------------------------------------------------
solr/CHANGES.txt | 2 ++
.../src/java/org/apache/solr/core/SolrXmlConfig.java | 9 ++++++++-
.../org/apache/solr/update/UpdateShardHandler.java | 12 ++++++++++--
.../apache/solr/update/UpdateShardHandlerConfig.java | 14 ++++++++++++--
.../src/java/org/apache/solr/util/TestHarness.java | 2 +-
5 files changed, 33 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5116968b/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c6f843f..19d1ad2 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -61,6 +61,8 @@ New Features
* SOLR-10239: MOVEREPLICA API (Cao Manh Dat, Noble Paul, shalin)
+* SOLR-9936: Allow configuration for recoveryExecutor thread pool size. (Tim Owen via Mark Miller)
+
Optimizations
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5116968b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
index c6a2c7a..2db5be2 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java
@@ -286,6 +286,7 @@ public class SolrXmlConfig {
int updateConnectionsEvictorSleepDelay = UpdateShardHandlerConfig.DEFAULT_UPDATECONNECTIONSEVICTORSLEEPDELAY;
int maxUpdateConnectionIdleTime = UpdateShardHandlerConfig.DEFAULT_MAXUPDATECONNECTIONIDLETIME;
String metricNameStrategy = UpdateShardHandlerConfig.DEFAULT_METRICNAMESTRATEGY;
+ int maxRecoveryThreads = UpdateShardHandlerConfig.DEFAULT_MAXRECOVERYTHREADS;
Object muc = nl.remove("maxUpdateConnections");
if (muc != null) {
@@ -329,11 +330,17 @@ public class SolrXmlConfig {
defined = true;
}
+ Object mrt = nl.remove("maxRecoveryThreads");
+ if (mrt != null) {
+ maxRecoveryThreads = parseInt("maxRecoveryThreads", mrt.toString());
+ defined = true;
+ }
+
if (!defined && !alwaysDefine)
return null;
return new UpdateShardHandlerConfig(maxUpdateConnections, maxUpdateConnectionsPerHost, distributedSocketTimeout,
- distributedConnectionTimeout, updateConnectionsEvictorSleepDelay, maxUpdateConnectionIdleTime, metricNameStrategy);
+ distributedConnectionTimeout, updateConnectionsEvictorSleepDelay, maxUpdateConnectionIdleTime, metricNameStrategy, maxRecoveryThreads);
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5116968b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
----------------------------------------------------------------------
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 4e52248..a536934 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateShardHandler.java
@@ -63,8 +63,7 @@ public class UpdateShardHandler implements SolrMetricProducer, SolrInfoMBean {
private ExecutorService updateExecutor = ExecutorUtil.newMDCAwareCachedThreadPool(
new SolrjNamedThreadFactory("updateExecutor"));
- private ExecutorService recoveryExecutor = ExecutorUtil.newMDCAwareCachedThreadPool(
- new SolrjNamedThreadFactory("recoveryExecutor"));
+ private ExecutorService recoveryExecutor;
private final CloseableHttpClient client;
@@ -102,6 +101,15 @@ public class UpdateShardHandler implements SolrMetricProducer, SolrInfoMBean {
idleConnectionsEvictor.start();
}
log.trace("Created UpdateShardHandler HTTP client with params: {}", clientParams);
+
+ ThreadFactory recoveryThreadFactory = new SolrjNamedThreadFactory("recoveryExecutor");
+ if (cfg != null && cfg.getMaxRecoveryThreads() > 0) {
+ log.debug("Creating recoveryExecutor with pool size {}", cfg.getMaxRecoveryThreads());
+ recoveryExecutor = ExecutorUtil.newMDCAwareFixedThreadPool(cfg.getMaxRecoveryThreads(), recoveryThreadFactory);
+ } else {
+ log.debug("Creating recoveryExecutor with unbounded pool");
+ recoveryExecutor = ExecutorUtil.newMDCAwareCachedThreadPool(recoveryThreadFactory);
+ }
}
protected ModifiableSolrParams getClientParams() {
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5116968b/solr/core/src/java/org/apache/solr/update/UpdateShardHandlerConfig.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/update/UpdateShardHandlerConfig.java b/solr/core/src/java/org/apache/solr/update/UpdateShardHandlerConfig.java
index 180c0c1..4cad91d 100644
--- a/solr/core/src/java/org/apache/solr/update/UpdateShardHandlerConfig.java
+++ b/solr/core/src/java/org/apache/solr/update/UpdateShardHandlerConfig.java
@@ -25,12 +25,13 @@ public class UpdateShardHandlerConfig {
public static final int DEFAULT_UPDATECONNECTIONSEVICTORSLEEPDELAY = 5000;
public static final int DEFAULT_MAXUPDATECONNECTIONIDLETIME = 40000;
public static final String DEFAULT_METRICNAMESTRATEGY = "queryLessURLAndMethod";
+ public static final int DEFAULT_MAXRECOVERYTHREADS = -1;
public static final UpdateShardHandlerConfig DEFAULT
= new UpdateShardHandlerConfig(DEFAULT_MAXUPDATECONNECTIONS, DEFAULT_MAXUPDATECONNECTIONSPERHOST,
DEFAULT_DISTRIBUPDATESOTIMEOUT, DEFAULT_DISTRIBUPDATECONNTIMEOUT,
DEFAULT_UPDATECONNECTIONSEVICTORSLEEPDELAY, DEFAULT_MAXUPDATECONNECTIONIDLETIME,
- DEFAULT_METRICNAMESTRATEGY);
+ DEFAULT_METRICNAMESTRATEGY, DEFAULT_MAXRECOVERYTHREADS);
private final int maxUpdateConnections;
@@ -46,7 +47,11 @@ public class UpdateShardHandlerConfig {
private final int maxUpdateConnectionIdleTime;
- public UpdateShardHandlerConfig(int maxUpdateConnections, int maxUpdateConnectionsPerHost, int distributedSocketTimeout, int distributedConnectionTimeout, int updateConnectionsEvictorSleepDelay, int maxUpdateConnectionIdleTime, String metricNameStrategy) {
+ private final int maxRecoveryThreads;
+
+ public UpdateShardHandlerConfig(int maxUpdateConnections, int maxUpdateConnectionsPerHost,
+ int distributedSocketTimeout, int distributedConnectionTimeout, int updateConnectionsEvictorSleepDelay,
+ int maxUpdateConnectionIdleTime, String metricNameStrategy, int maxRecoveryThreads) {
this.maxUpdateConnections = maxUpdateConnections;
this.maxUpdateConnectionsPerHost = maxUpdateConnectionsPerHost;
this.distributedSocketTimeout = distributedSocketTimeout;
@@ -54,6 +59,7 @@ public class UpdateShardHandlerConfig {
this.metricNameStrategy = metricNameStrategy;
this.updateConnectionsEvictorSleepDelay = updateConnectionsEvictorSleepDelay;
this.maxUpdateConnectionIdleTime = maxUpdateConnectionIdleTime;
+ this.maxRecoveryThreads = maxRecoveryThreads;
}
public int getMaxUpdateConnectionsPerHost() {
@@ -83,4 +89,8 @@ public class UpdateShardHandlerConfig {
public int getMaxUpdateConnectionIdleTime() {
return maxUpdateConnectionIdleTime;
}
+
+ public int getMaxRecoveryThreads() {
+ return maxRecoveryThreads;
+ }
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5116968b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
----------------------------------------------------------------------
diff --git a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
index ec4386a..4f63a1d 100644
--- a/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
+++ b/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
@@ -191,7 +191,7 @@ public class TestHarness extends BaseTestHarness {
= new UpdateShardHandlerConfig(UpdateShardHandlerConfig.DEFAULT_MAXUPDATECONNECTIONS,
UpdateShardHandlerConfig.DEFAULT_MAXUPDATECONNECTIONSPERHOST,
30000, 30000, 5000, 50000,
- UpdateShardHandlerConfig.DEFAULT_METRICNAMESTRATEGY);
+ UpdateShardHandlerConfig.DEFAULT_METRICNAMESTRATEGY, UpdateShardHandlerConfig.DEFAULT_MAXRECOVERYTHREADS);
// universal default metric reporter
Map<String,String> attributes = new HashMap<>();
attributes.put("name", "default");