SOLR-11426: TestLazyCores fails too often. Adding debugging code MASTER ONLY since I can't get it to fail locally

This commit is contained in:
Erick Erickson 2017-10-06 09:54:32 -07:00
parent c5f9a6f221
commit 37fb60d0f1
1 changed files with 86 additions and 48 deletions

View File

@ -172,6 +172,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {
, "//result[@numFound='0']"
);
}
@Test
public void testLazySearch() throws Exception {
CoreContainer cc = init();
@ -314,6 +315,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {
}
}
}
@Test
public void testCreateSame() throws Exception {
final CoreContainer cc = init();
@ -418,8 +420,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {
}
Thread.sleep(sleep_millis);
}
}
catch (InterruptedException ie) {
} catch (InterruptedException ie) {
if (VERBOSE) {
System.out.println("TestLazyCores.testCreateTransientFromAdmin Thread.run caught " + ie + " whilst sleeping for " + sleep_millis + " ms");
}
@ -431,7 +432,8 @@ public class TestLazyCores extends SolrTestCaseJ4 {
c4.close();
c5.close();
}
};
}
;
// with SOLR-6279 UNLOAD will wait for the core's reference count to have reached zero
// hence cN.close() need to proceed or run in parallel with unloadViaAdmin(...)
@ -503,7 +505,8 @@ public class TestLazyCores extends SolrTestCaseJ4 {
cc.reload("badConfig2");
cc.reload("badSchema1");
cc.reload("badSchema2");
SolrCore bc1 = cc.getCore("badConfig1");;
SolrCore bc1 = cc.getCore("badConfig1");
;
SolrCore bc2 = cc.getCore("badConfig2");
SolrCore bs1 = cc.getCore("badSchema1");
SolrCore bs2 = cc.getCore("badSchema2");
@ -648,6 +651,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {
public static void checkNotInCores(CoreContainer cc, List<String> nameCheck) {
checkNotInCores(cc, nameCheck, Collections.emptyList());
}
public static void checkNotInCores(CoreContainer cc, List<String> nameCheck, List<String> namesBad) {
Collection<String> loadedNames = cc.getLoadedCoreNames();
for (String name : nameCheck) {
@ -750,8 +754,7 @@ public class TestLazyCores extends SolrTestCaseJ4 {
}
Thread.sleep(sleep_millis);
}
}
catch (InterruptedException ie) {
} catch (InterruptedException ie) {
if (VERBOSE) {
System.out.println("TestLazyCores.testMidUseUnload Thread.run caught " + ie + " whilst sleeping for " + sleep_millis + " ms");
}
@ -760,7 +763,8 @@ public class TestLazyCores extends SolrTestCaseJ4 {
assertFalse(core_to_use.isClosed()); // not closed since we are still using it and hold a reference
core_to_use.close(); // now give up our reference to the core
}
};
}
;
CoreContainer cc = init();
@ -843,7 +847,41 @@ public class TestLazyCores extends SolrTestCaseJ4 {
}
private void check10(SolrCore core) {
// Just get a couple of searches to work!
// DEBUGGING ONLY since I can't get this to fail locally (Erick Erickson)
// Wondering if this is the problem with multiple searchers being opened on load, in which case
// looping for a bit should help.
boolean failIt = false;
try {
for (int idx = 0; idx < 10; ++idx) {
LocalSolrQueryRequest lsrg = makeReq(core, "q", "*:*", "wt", "xml");
String resp = h.query(lsrg);
if (resp.contains("numFound=\"10\"")) {
if (failIt) {
fail("***********EOE found 10 docs after failing to find 10 docs the first time, Implicates SOLR-11035 ???");
}
break;
}
failIt = true;
System.out.println("********EOE AT LEAST ONE LOOP FAILED TO FIND 10 DOCS. resp: " + resp);
Thread.sleep(1000);
}
if (failIt) {
System.out.println("********EOE Test failed, what happens if we add a doc now? Will there be 11 docs? ");
addLazy(core, "id", "1000EOE");
SolrQueryRequest req = makeReq(core);
CommitUpdateCommand cmtCmd = new CommitUpdateCommand(req, false);
core.getUpdateHandler().commit(cmtCmd);
assertQ("test closing core without committing after adding 11th document",
makeReq(core, "q", "*:*")
, "//result[@numFound='11']"
);
fail("*************EOE added 11th doc and then found 11! Implicates SOLR-11035 ??? ");
}
} catch (Exception e) {
fail(e.getMessage());
}
// Just get a simple search to work!
assertQ("test closing core without committing",
makeReq(core, "q", "*:*")
, "//result[@numFound='10']"