SOLR-5815: add some test logging to try and figure out WTF

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1574273 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris M. Hostetter 2014-03-05 01:01:18 +00:00
parent b670831559
commit 96bcbefdd4
1 changed files with 15 additions and 5 deletions

View File

@ -30,8 +30,12 @@ import org.apache.solr.util.RefCounted;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TestNonNRTOpen extends SolrTestCaseJ4 {
private static final Logger log = LoggerFactory.getLogger(TestNonNRTOpen.class);
@BeforeClass
public static void beforeClass() throws Exception {
// use a filesystem, because we need to create an index, then "start up solr"
@ -80,6 +84,7 @@ public class TestNonNRTOpen extends SolrTestCaseJ4 {
// core reload
String core = h.getCore().getName();
log.info("Reloading core: " + h.getCore().toString());
h.getCoreContainer().reload(core);
assertNotNRT(1);
@ -90,6 +95,7 @@ public class TestNonNRTOpen extends SolrTestCaseJ4 {
// add a doc and core reload
assertU(adoc("bazz", "doc2"));
log.info("Reloading core: " + h.getCore().toString());
h.getCoreContainer().reload(core);
assertNotNRT(3);
}
@ -127,11 +133,15 @@ public class TestNonNRTOpen extends SolrTestCaseJ4 {
}
static void assertNotNRT(int maxDoc) {
RefCounted<SolrIndexSearcher> searcher = h.getCore().getSearcher();
SolrCore core = h.getCore();
log.info("Checking notNRT & maxDoc=" + maxDoc + " of core=" + core.toString());
RefCounted<SolrIndexSearcher> searcher = core.getSearcher();
try {
DirectoryReader ir = searcher.get().getIndexReader();
assertEquals(maxDoc, ir.maxDoc());
assertFalse("expected non-NRT reader, got: " + ir, ir.toString().contains(":nrt"));
SolrIndexSearcher s = searcher.get();
DirectoryReader ir = s.getIndexReader();
assertEquals("SOLR-5815? : wrong maxDoc: core=" + core.toString() +" searcher=" + s.toString(),
maxDoc, ir.maxDoc());
assertFalse("SOLR-5815? : expected non-NRT reader, got: " + ir, ir.toString().contains(":nrt"));
} finally {
searcher.decref();
}