Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

be a little less aggressive in how fast we retry failed recoveries

Mark Robert Millere3af5988e7bc
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 8928e1206d3..dada8a41d2a 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
@@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory;
public class RecoveryStrategy extends Thread implements SafeStopThread {
private static final int MAX_RETRIES = 500;
private static final int INTERRUPTED = MAX_RETRIES + 1;
- private static final int START_TIMEOUT = 100;
+ private static final int STARTING_RECOVERY_DELAY = 1000;
private static final String REPLICATION_HANDLER = "/replication";
@@ -409,10 +409,11 @@ public class RecoveryStrategy extends Thread implements SafeStopThread {
}
try {
- // if (!isClosed()) Thread.sleep(Math.min(START_TIMEOUT * retries, 60000));
- for (int i = 0; i<Math.min(retries, 600); i++) {
+ // start at 1 sec and work up to a couple min
+ double loopCount = Math.min(Math.pow(2, retries), 600);
+ for (int i = 0; i < loopCount; i++) {
if (isClosed()) break; // check if someone closed us
- Thread.sleep(START_TIMEOUT);
+ Thread.sleep(STARTING_RECOVERY_DELAY);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();