lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [lucene-solr] branch branch_8x updated: SOLR-13975: Make sure the stall time is adjusted up when an unusually long poll time is configured.
Date Thu, 12 Dec 2019 18:07:45 GMT
This is an automated email from the ASF dual-hosted git repository.

ab pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new 640e6fc  SOLR-13975: Make sure the stall time is adjusted up when an unusually long
poll time is configured.
640e6fc is described below

commit 640e6fc3c02617bf3f461ab3bbb908ae8421b47f
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 7ab0f8b..c20d0d6 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) {
@@ -668,7 +670,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) {


Mime
View raw message