mirror of https://github.com/apache/lucene.git
SOLR-12313: Make the test finish quicker by lower down intervals
This commit is contained in:
parent
be65b95e80
commit
13a83564bb
|
@ -66,6 +66,9 @@ public class ReplicateFromLeader {
|
||||||
}
|
}
|
||||||
SolrConfig.UpdateHandlerInfo uinfo = core.getSolrConfig().getUpdateHandlerInfo();
|
SolrConfig.UpdateHandlerInfo uinfo = core.getSolrConfig().getUpdateHandlerInfo();
|
||||||
String pollIntervalStr = "00:00:03";
|
String pollIntervalStr = "00:00:03";
|
||||||
|
if (System.getProperty("jetty.testMode") != null) {
|
||||||
|
pollIntervalStr = "00:00:01";
|
||||||
|
}
|
||||||
if (uinfo.autoCommmitMaxTime != -1) {
|
if (uinfo.autoCommmitMaxTime != -1) {
|
||||||
pollIntervalStr = toPollIntervalStr(uinfo.autoCommmitMaxTime/2);
|
pollIntervalStr = toPollIntervalStr(uinfo.autoCommmitMaxTime/2);
|
||||||
} else if (uinfo.autoSoftCommmitMaxTime != -1) {
|
} else if (uinfo.autoSoftCommmitMaxTime != -1) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.apache.solr.common.params.ModifiableSolrParams;
|
||||||
import org.apache.solr.common.util.NamedList;
|
import org.apache.solr.common.util.NamedList;
|
||||||
import org.apache.solr.common.util.Pair;
|
import org.apache.solr.common.util.Pair;
|
||||||
import org.apache.solr.common.util.SuppressForbidden;
|
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.CoreContainer;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.handler.ReplicationHandler;
|
import org.apache.solr.handler.ReplicationHandler;
|
||||||
|
@ -439,7 +440,9 @@ public class TestInjection {
|
||||||
boolean enabled = pair.first();
|
boolean enabled = pair.first();
|
||||||
if (!enabled) return true;
|
if (!enabled) return true;
|
||||||
long t = System.currentTimeMillis() - 200;
|
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 {
|
try {
|
||||||
if (core.isClosed()) return true;
|
if (core.isClosed()) return true;
|
||||||
Replica leaderReplica = zkController.getZkStateReader().getLeaderRetry(
|
Replica leaderReplica = zkController.getZkStateReader().getLeaderRetry(
|
||||||
|
@ -448,7 +451,7 @@ public class TestInjection {
|
||||||
ModifiableSolrParams params = new ModifiableSolrParams();
|
ModifiableSolrParams params = new ModifiableSolrParams();
|
||||||
params.set(CommonParams.QT, ReplicationHandler.PATH);
|
params.set(CommonParams.QT, ReplicationHandler.PATH);
|
||||||
params.set(COMMAND, CMD_DETAILS);
|
params.set(COMMAND, CMD_DETAILS);
|
||||||
|
|
||||||
NamedList<Object> response = leaderClient.request(new QueryRequest(params));
|
NamedList<Object> response = leaderClient.request(new QueryRequest(params));
|
||||||
long leaderVersion = (long) ((NamedList)response.get("details")).get("indexVersion");
|
long leaderVersion = (long) ((NamedList)response.get("details")).get("indexVersion");
|
||||||
String localVersion = core.withSearcher(searcher ->
|
String localVersion = core.withSearcher(searcher ->
|
||||||
|
@ -460,9 +463,9 @@ public class TestInjection {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
log.debug("Tlog replica not in sync with leader yet. Attempt: {}. Local Version={}, leader Version={}", i, localVersion, leaderVersion);
|
log.debug("Tlog replica not in sync with leader yet. Attempt: {}. Local Version={}, leader Version={}", i, localVersion, leaderVersion);
|
||||||
Thread.sleep(500);
|
Thread.sleep(250);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
|
@ -473,6 +476,7 @@ public class TestInjection {
|
||||||
if (core.isClosed()) return true;
|
if (core.isClosed()) return true;
|
||||||
log.error("Exception when wait for replicas in sync with master. Will retry until timeout.", e);
|
log.error("Exception when wait for replicas in sync with master. Will retry until timeout.", e);
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue