Apache Lucene open-source search software
SOLR-11426: TestLazyCores fails too often, debugging
Erickab5fbad3d70f
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCores.java b/solr/core/src/java/org/apache/solr/core/SolrCores.javaindex 52b106380d9..546686e445a 100644--- a/solr/core/src/java/org/apache/solr/core/SolrCores.java+++ b/solr/core/src/java/org/apache/solr/core/SolrCores.java@@ -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@Overridepublic 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}}diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.javaindex d51c9702204..21a689640d1 100644--- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java+++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java@@ -813,7 +813,7 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState@Overridepublic void close() throws IOException {log.debug("closing " + this);-+commitTracker.close();softCommitTracker.close();diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xmlindex ecf1f1468fc..8f90d26273d 100644--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig.snippet.randomindexconfig.xml@@ -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>diff --git a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java b/solr/core/src/test/org/apache/solr/core/TestLazyCores.javaindex 6a5697a93f4..4c787d62d69 100644--- a/solr/core/src/test/org/apache/solr/core/TestLazyCores.java+++ b/solr/core/src/test/org/apache/solr/core/TestLazyCores.java@@ -786,6 +786,9 @@ public class TestLazyCores extends SolrTestCaseJ4 {// Cores 2, 3, 6, 7, 8, 9 are transient@Testpublic 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 {