You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ab...@apache.org on 2019/12/12 20:46:36 UTC
[lucene-solr] branch master updated: SOLR-13975: Make sure the
stall time is adjusted up when an unusually long poll time is configured.
This is an automated email from the ASF dual-hosted git repository.
ab pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new e155649 SOLR-13975: Make sure the stall time is adjusted up when an unusually long poll time is configured.
e155649 is described below
commit e155649026a62e684667e657175d0f722601c05b
Author: Andrzej Bialecki <ab...@apache.org>
AuthorDate: Thu Dec 12 19:04:23 2019 +0100
SOLR-13975: Make sure the stall time is adjusted up when an unusually long
poll time is configured.
---
.../client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java | 11 +++++++++--
.../solr/client/solrj/impl/ConcurrentUpdateSolrClient.java | 10 +++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
index bb0c582..0e224a1 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateHttp2SolrClient.java
@@ -152,6 +152,9 @@ public class ConcurrentUpdateHttp2SolrClient extends SolrClient {
this.streamDeletes = builder.streamDeletes;
this.basePath = builder.baseSolrUrl;
this.stallTime = Integer.getInteger("solr.cloud.client.stallTime", 15000);
+ if (stallTime < pollQueueTime * 2) {
+ throw new RuntimeException("Invalid stallTime: " + stallTime + "ms, must be 2x > pollQueueTime " + pollQueueTime);
+ }
if (builder.executorService != null) {
this.scheduler = builder.executorService;
@@ -214,7 +217,6 @@ public class ConcurrentUpdateHttp2SolrClient extends SolrClient {
try {
Update update;
notifyQueueAndRunnersIfEmptyQueue();
- //log.info("-- polling 1");
update = queue.poll(pollQueueTime, TimeUnit.MILLISECONDS);
if (update == null) {
@@ -662,7 +664,12 @@ public class ConcurrentUpdateHttp2SolrClient extends SolrClient {
*/
public void setPollQueueTime(int pollQueueTime) {
this.pollQueueTime = pollQueueTime;
- this.stallTime = this.pollQueueTime * 3 / 2;
+ // make sure the stall time is larger than the polling time
+ // to give a chance for the queue to change
+ int minimalStallTime = pollQueueTime * 2;
+ if (minimalStallTime > this.stallTime) {
+ this.stallTime = minimalStallTime;
+ }
}
/**
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
index d921cb2..edc8270 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.java
@@ -134,7 +134,9 @@ public class ConcurrentUpdateSolrClient extends SolrClient {
this.connectionTimeout = builder.connectionTimeoutMillis;
this.soTimeout = builder.socketTimeoutMillis;
this.stallTime = Integer.getInteger("solr.cloud.client.stallTime", 15000);
-
+ if (stallTime < pollQueueTime * 2) {
+ throw new RuntimeException("Invalid stallTime: " + stallTime + "ms, must be 2x > pollQueueTime " + pollQueueTime);
+ }
if (builder.executorService != null) {
this.scheduler = builder.executorService;
@@ -827,6 +829,12 @@ public class ConcurrentUpdateSolrClient extends SolrClient {
*/
public void setPollQueueTime(int pollQueueTime) {
this.pollQueueTime = pollQueueTime;
+ // make sure the stall time is larger than the polling time
+ // to give a chance for the queue to change
+ int minimalStallTime = pollQueueTime * 2;
+ if (minimalStallTime > this.stallTime) {
+ this.stallTime = minimalStallTime;
+ }
}
public void setRequestWriter(RequestWriter requestWriter) {