mirror of https://github.com/apache/lucene.git
SOLR-5384: randomlyEnableAutoSoftCommit in ChaosMonkeySafeLeaderTest is buggy.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1535204 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e0207e2f9a
commit
1c8595c86a
|
@ -25,9 +25,6 @@ import org.apache.solr.client.solrj.SolrQuery;
|
|||
import org.apache.solr.client.solrj.impl.CloudSolrServer;
|
||||
import org.apache.solr.common.SolrInputDocument;
|
||||
import org.apache.solr.core.Diagnostics;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.servlet.SolrDispatchFilter;
|
||||
import org.apache.solr.update.DirectUpdateHandler2;
|
||||
import org.apache.solr.update.SolrCmdDistributor;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
|
@ -89,7 +86,7 @@ public class ChaosMonkeySafeLeaderTest extends AbstractFullDistribZkTestBase {
|
|||
handle.put("QTime", SKIPVAL);
|
||||
handle.put("timestamp", SKIPVAL);
|
||||
|
||||
// randomly turn on 5 seconds 'soft' commit
|
||||
// randomly turn on 1 seconds 'soft' commit
|
||||
randomlyEnableAutoSoftCommit();
|
||||
|
||||
del("*:*");
|
||||
|
@ -164,17 +161,7 @@ public class ChaosMonkeySafeLeaderTest extends AbstractFullDistribZkTestBase {
|
|||
|
||||
private void randomlyEnableAutoSoftCommit() {
|
||||
if (r.nextBoolean()) {
|
||||
log.info("Turning on auto soft commit");
|
||||
for (CloudJettyRunner jetty : shardToJetty.get("shard1")) {
|
||||
SolrCore core = ((SolrDispatchFilter) jetty.jetty.getDispatchFilter()
|
||||
.getFilter()).getCores().getCore("collection1");
|
||||
try {
|
||||
((DirectUpdateHandler2) core.getUpdateHandler()).getCommitTracker()
|
||||
.setTimeUpperBound(5000);
|
||||
} finally {
|
||||
core.close();
|
||||
}
|
||||
}
|
||||
enableAutoSoftCommit(1000);
|
||||
} else {
|
||||
log.info("Not turning on auto soft commit");
|
||||
}
|
||||
|
|
|
@ -46,7 +46,11 @@ import org.apache.solr.common.params.CollectionParams.CollectionAction;
|
|||
import org.apache.solr.common.params.ModifiableSolrParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
import org.apache.solr.common.util.StrUtils;
|
||||
import org.apache.solr.core.CoreContainer;
|
||||
import org.apache.solr.core.SolrCore;
|
||||
import org.apache.solr.core.SolrResourceLoader;
|
||||
import org.apache.solr.servlet.SolrDispatchFilter;
|
||||
import org.apache.solr.update.DirectUpdateHandler2;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
|
@ -1056,6 +1060,20 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes
|
|||
}
|
||||
}
|
||||
|
||||
protected void enableAutoSoftCommit(int time) {
|
||||
log.info("Turning on auto soft commit: " + time);
|
||||
for (List<CloudJettyRunner> jettyList : shardToJetty.values()) {
|
||||
for (CloudJettyRunner jetty : jettyList) {
|
||||
CoreContainer cores = ((SolrDispatchFilter) jetty.jetty
|
||||
.getDispatchFilter().getFilter()).getCores();
|
||||
for (SolrCore core : cores.getCores()) {
|
||||
((DirectUpdateHandler2) core.getUpdateHandler())
|
||||
.getSoftCommitTracker().setTimeUpperBound(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String toStr(SolrDocumentList lst, int maxSz) {
|
||||
if (lst.size() <= maxSz) return lst.toString();
|
||||
|
||||
|
|
Loading…
Reference in New Issue