You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by tf...@apache.org on 2018/09/13 21:10:54 UTC

[1/2] lucene-solr:branch_7_5: SOLR-12766: Improve backoff for internal retries

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7_5 6c9a274c9 -> f5b00707a


SOLR-12766: Improve backoff for internal retries

When retrying internal update requests, backoff only once for the full batch of retries
instead of for every request.
Make backoff linear with the number of retries


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2ce0f527
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2ce0f527
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2ce0f527

Branch: refs/heads/branch_7_5
Commit: 2ce0f527efd49adf1700cd6d1d15d3d6a741b633
Parents: 6c9a274
Author: Tomas Fernandez Lobbe <tf...@apache.org>
Authored: Wed Sep 12 16:29:17 2018 -0700
Committer: Tomas Fernandez Lobbe <tf...@apache.org>
Committed: Thu Sep 13 14:09:12 2018 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../apache/solr/update/SolrCmdDistributor.java  | 21 +++++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2ce0f527/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 6300f2d..8f93607 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -308,6 +308,8 @@ Optimizations
 
 * SOLR-12723: Reduce object creation in HashBasedRouter. (ab)
 
+* SOLR-12766: When retrying internal requests, backoff only once for the full batch of retries (Tomás Fernández Löbbe)
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2ce0f527/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
----------------------------------------------------------------------
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 d5aafec..3a65f17 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -79,7 +79,8 @@ public class SolrCmdDistributor implements Closeable {
     this.completionService = new ExecutorCompletionService<>(updateShardHandler.getUpdateExecutor());
   }
   
-  public SolrCmdDistributor(StreamingSolrClients clients, int retryPause) {
+  /* For tests only */
+  SolrCmdDistributor(StreamingSolrClients clients, int retryPause) {
     this.clients = clients;
     this.retryPause = retryPause;
     completionService = new ExecutorCompletionService<>(clients.getUpdateExecutor());
@@ -156,12 +157,6 @@ public class SolrCmdDistributor implements Closeable {
                 + err.req.cmd.toString() + " params:"
                 + err.req.uReq.getParams() + " rsp:" + err.statusCode, err.e);
           }
-          try {
-            Thread.sleep(retryPause); //TODO: Do we want this wait for every error?
-          } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-            log.warn(null, e);
-          }
           resubmitList.add(err);
         } else {
           allErrors.add(err);
@@ -172,6 +167,18 @@ public class SolrCmdDistributor implements Closeable {
       }
     }
     
+    if (resubmitList.size() > 0) {
+      // Only backoff once for the full batch
+      try {
+        int backoffTime = retryPause * resubmitList.get(0).req.retries;
+        log.debug("Sleeping {}ms before re-submitting {} requests", backoffTime, resubmitList.size());
+        Thread.sleep(backoffTime);
+      } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+        log.warn(null, e);
+      }
+    }
+    
     clients.clearErrors();
     this.errors.clear();
     for (Error err : resubmitList) {


[2/2] lucene-solr:branch_7_5: SOLR-12766: Backoff time for internal requests is never more than 2 seconds

Posted by tf...@apache.org.
SOLR-12766: Backoff time for internal requests is never more than 2 seconds


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f5b00707
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f5b00707
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f5b00707

Branch: refs/heads/branch_7_5
Commit: f5b00707a6064a34af013b2e18c322d613926319
Parents: 2ce0f52
Author: Tomas Fernandez Lobbe <tf...@apache.org>
Authored: Thu Sep 13 08:43:10 2018 -0700
Committer: Tomas Fernandez Lobbe <tf...@apache.org>
Committed: Thu Sep 13 14:09:17 2018 -0700

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f5b00707/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
----------------------------------------------------------------------
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 3a65f17..d7388f0 100644
--- a/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
+++ b/solr/core/src/java/org/apache/solr/update/SolrCmdDistributor.java
@@ -170,7 +170,7 @@ public class SolrCmdDistributor implements Closeable {
     if (resubmitList.size() > 0) {
       // Only backoff once for the full batch
       try {
-        int backoffTime = retryPause * resubmitList.get(0).req.retries;
+        int backoffTime = Math.min(retryPause * resubmitList.get(0).req.retries, 2000);
         log.debug("Sleeping {}ms before re-submitting {} requests", backoffTime, resubmitList.size());
         Thread.sleep(backoffTime);
       } catch (InterruptedException e) {