Debugging code for Jenkins failures

This commit is contained in:
Erick 2017-11-21 09:57:19 -08:00
commit 57b1912cea
4 changed files with 25 additions and 18 deletions

View File

@ -19,17 +19,12 @@ package org.apache.solr.core;
import com.google.common.collect.Lists;
import org.apache.http.annotation.Experimental;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.logging.MDCLoggingContext;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.update.CommitUpdateCommand;
import org.apache.solr.util.DefaultSolrThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.ArrayList;
import java.util.Collection;
@ -539,21 +534,22 @@ class SolrCores implements Observer {
return false;
}
// Let transient cache implementation tell us when it ages out a corel
// Let transient cache implementation tell us when it ages out a core
@Override
public void update(Observable o, Object arg) {
synchronized (modifyLock) {
SolrCore core = (SolrCore) arg;
SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams());
CommitUpdateCommand cmd = new CommitUpdateCommand(req, false);
cmd.openSearcher = false;
cmd.waitSearcher = false;
try {
core.getUpdateHandler().commit(cmd);
} catch (IOException e) {
log.warn("Caught exception trying to close a transient core, ignoring as it should be benign");
}
pendingCloses.add(core); // Essentially just queue this core up for closing.
// Erick Erickson debugging TestLazyCores. With this un-commented, we get no testLazyCores failures.
// SolrCore core = (SolrCore) arg;
// SolrQueryRequest req = new LocalSolrQueryRequest(core, new ModifiableSolrParams());
// CommitUpdateCommand cmd = new CommitUpdateCommand(req, false);
// cmd.openSearcher = false;
// cmd.waitSearcher = false;
// try {
// core.getUpdateHandler().commit(cmd);
// } catch (IOException e) {
// log.warn("Caught exception trying to close a transient core, ignoring as it should be benign");
// }
pendingCloses.add((SolrCore) arg); // Essentially just queue this core up for closing.
modifyLock.notifyAll(); // Wakes up closer thread too
}
}

View File

@ -813,7 +813,7 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
@Override
public void close() throws IOException {
log.debug("closing " + this);
commitTracker.close();
softCommitTracker.close();

View File

@ -43,4 +43,7 @@ A solrconfig.xml snippet containing indexConfig settings for randomized testing.
to vary the lockType canset it as needed.
-->
<lockType>${solr.tests.lockType:single}</lockType>
<infoStream>${solr.tests.infostream:false}</infoStream>
</indexConfig>

View File

@ -786,6 +786,9 @@ public class TestLazyCores extends SolrTestCaseJ4 {
// Cores 2, 3, 6, 7, 8, 9 are transient
@Test
public void testNoCommit() throws Exception {
String infoStream = System.getProperty("solr.tests.infostream");
System.setProperty("solr.tests.infostream","true");
CoreContainer cc = init();
String[] coreList = new String[]{
"collection2",
@ -832,6 +835,11 @@ public class TestLazyCores extends SolrTestCaseJ4 {
} finally {
cc.shutdown();
}
if (infoStream != null) {
System.setProperty("solr.tests.infostream", infoStream);
} else {
System.clearProperty("solr.tests.infostream");
}
}
private void add10(SolrCore core) throws IOException {