You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2018/08/16 09:30:57 UTC

lucene-solr:master: SOLR-12670: RecoveryStrategy logs wrong wait time when retrying recovery

Repository: lucene-solr
Updated Branches:
  refs/heads/master 100b1511d -> 887055d89


SOLR-12670: RecoveryStrategy logs wrong wait time when retrying recovery


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

Branch: refs/heads/master
Commit: 887055d892e67a61bdad61daf8075094762f0f39
Parents: 100b151
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Thu Aug 16 15:00:49 2018 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Thu Aug 16 15:00:49 2018 +0530

----------------------------------------------------------------------
 solr/CHANGES.txt                                             | 2 ++
 .../src/java/org/apache/solr/cloud/RecoveryStrategy.java     | 8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/887055d8/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 82f8453..3460bc7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -239,6 +239,8 @@ Bug Fixes
 
 * SOLR-12649: CloudSolrClient retries requests unnecessarily exception from server (noble, shalin)
 
+* SOLR-12670: RecoveryStrategy logs wrong wait time when retrying recovery. (shalin)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/887055d8/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
index 5de9581..f361324 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
@@ -24,6 +24,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.lucene.search.MatchAllDocsQuery;
@@ -422,11 +423,12 @@ public class RecoveryStrategy implements Runnable, Closeable {
 
       try {
         // Wait an exponential interval between retries, start at 5 seconds and work up to a minute.
-        // If we're at attempt >= 4, there's no point computing pow(2, retries) because the result 
+        // If we're at attempt >= 4, there's no point computing pow(2, retries) because the result
         // will always be the minimum of the two (12). Since we sleep at 5 seconds sub-intervals in
         // order to check if we were closed, 12 is chosen as the maximum loopCount (5s * 12 = 1m).
-        double loopCount = retries < 4 ? Math.min(Math.pow(2, retries), 12) : 12;
-        LOG.info("Wait [{}] seconds before trying to recover again (attempt={})", loopCount, retries);
+        int loopCount = retries < 4 ? (int) Math.min(Math.pow(2, retries), 12) : 12;
+        LOG.info("Wait [{}] seconds before trying to recover again (attempt={})",
+            TimeUnit.MILLISECONDS.toSeconds(loopCount * startingRecoveryDelayMilliSeconds), retries);
         for (int i = 0; i < loopCount; i++) {
           if (isClosed()) {
             LOG.info("Recovery for core {} has been closed", core.getName());