SOLR-12313: Make the test finish quicker by lower down intervals

This commit is contained in:
Cao Manh Dat 2018-11-06 11:19:13 +00:00
parent be65b95e80
commit 13a83564bb
2 changed files with 11 additions and 4 deletions

View File

@ -66,6 +66,9 @@ public class ReplicateFromLeader {
}
SolrConfig.UpdateHandlerInfo uinfo = core.getSolrConfig().getUpdateHandlerInfo();
String pollIntervalStr = "00:00:03";
if (System.getProperty("jetty.testMode") != null) {
pollIntervalStr = "00:00:01";
}
if (uinfo.autoCommmitMaxTime != -1) {
pollIntervalStr = toPollIntervalStr(uinfo.autoCommmitMaxTime/2);
} else if (uinfo.autoSoftCommmitMaxTime != -1) {

View File

@ -42,6 +42,7 @@ import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.Pair;
import org.apache.solr.common.util.SuppressForbidden;
import org.apache.solr.common.util.TimeSource;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.ReplicationHandler;
@ -439,7 +440,9 @@ public class TestInjection {
boolean enabled = pair.first();
if (!enabled) return true;
long t = System.currentTimeMillis() - 200;
for (int i = 0; i < pair.second(); i++) {
int i = 0;
TimeOut timeOut = new TimeOut(pair.second(), TimeUnit.SECONDS, TimeSource.NANO_TIME);
while (!timeOut.hasTimedOut()) {
try {
if (core.isClosed()) return true;
Replica leaderReplica = zkController.getZkStateReader().getLeaderRetry(
@ -460,7 +463,7 @@ public class TestInjection {
return true;
} else {
log.debug("Tlog replica not in sync with leader yet. Attempt: {}. Local Version={}, leader Version={}", i, localVersion, leaderVersion);
Thread.sleep(500);
Thread.sleep(250);
}
}
@ -473,6 +476,7 @@ public class TestInjection {
if (core.isClosed()) return true;
log.error("Exception when wait for replicas in sync with master. Will retry until timeout.", e);
}
i++;
}
return false;
}