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 2020/10/01 23:47:03 UTC

[lucene-solr] 22/26: @904 Try to throttle with retries.

This is an automated email from the ASF dual-hosted git repository.

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

commit 3f0d83c42191374cc23caf549302d9a4acb6bf37
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Oct 1 16:37:12 2020 -0500

    @904 Try to throttle with retries.
---
 .../src/java/org/apache/solr/update/SolrCmdDistributor.java  | 12 +++++++++++-
 .../java/org/apache/solr/client/solrj/impl/LBSolrClient.java |  3 ---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
index 000e216..6dab674 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -27,6 +27,7 @@ import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Phaser;
+import java.util.concurrent.RejectedExecutionException;
 
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.BinaryResponseParser;
@@ -62,6 +63,7 @@ public class SolrCmdDistributor implements Closeable {
   private final Set<Error> allErrors = ConcurrentHashMap.newKeySet();
   
   private final Http2SolrClient solrClient;
+  private volatile boolean closed;
 
   public SolrCmdDistributor(UpdateShardHandler updateShardHandler) {
     assert ObjectReleaseTracker.track(this);
@@ -76,6 +78,7 @@ public class SolrCmdDistributor implements Closeable {
   }
   
   public void close() {
+    this.closed = true;
     solrClient.close();
     assert ObjectReleaseTracker.release(this);
   }
@@ -247,11 +250,18 @@ public class SolrCmdDistributor implements Closeable {
           }
 
           boolean retry = false;
-          if (checkRetry(error)) {
+          if (t instanceof RejectedExecutionException || checkRetry(error)) {
             retry = true;
           }
 
           if (retry) {
+            if (t instanceof RejectedExecutionException) {
+              try {
+                Thread.sleep(1000);
+              } catch (InterruptedException e) {
+                ParWork.propagateInterrupt(e);
+              }
+            }
             log.info("Retrying distrib update on error: {}", t.getMessage());
             submit(req);
             return;
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
index cbdf0b9..fbe6448 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBSolrClient.java
@@ -749,9 +749,6 @@ public abstract class LBSolrClient extends SolrClient {
   @Override
   public void close() {
     this.closed = true;
-    if (aliveCheckExecutor != null) {
-      aliveCheckExecutor.shutdownNow();
-    }
     ExecutorUtil.shutdownAndAwaitTermination(aliveCheckExecutor);
     assert ObjectReleaseTracker.release(this);
   }