SOLR-12201: TestReplicationHandler.doTestIndexFetchOnMasterRestart(): handle unexpected replication failures

This commit is contained in:
Steve Rowe 2018-04-10 22:15:31 -04:00
parent b93e24cb83
commit fe0da9e8d5
2 changed files with 11 additions and 6 deletions

View File

@ -131,6 +131,9 @@ Bug Fixes
(ab, Dawid Weiss, Mikhail Khludnev)
* SOLR-12155: Exception from UnInvertedField constructor puts threads to infinite wait. (Mikhail Khludnev)
* SOLR-12201: TestReplicationHandler.doTestIndexFetchOnMasterRestart(): handle unexpected replication failures
(Steve Rowe)
Optimizations
----------------------

View File

@ -626,9 +626,6 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
* the index hasn't changed. See SOLR-9036
*/
@Test
//Commented out 24-Feb 2018. JIRA marked as fixed.
// Still fails 26-Feb on master.
@BadApple(bugUrl = "https://issues.apache.org/jira/browse/SOLR-9036")
public void doTestIndexFetchOnMasterRestart() throws Exception {
useFactory(null);
try {
@ -663,9 +660,14 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
assertEquals(null, cmp);
assertEquals(1, Integer.parseInt(getSlaveDetails("timesIndexReplicated")));
int timesReplicated = Integer.parseInt(getSlaveDetails("timesIndexReplicated"));
String timesFailed = getSlaveDetails("timesFailed");
assertEquals(0, Integer.parseInt(timesFailed != null ? timesFailed : "0"));
if (null == timesFailed) {
timesFailed = "0";
}
int previousTimesFailed = Integer.parseInt(timesFailed);
// Sometimes replication will fail because master's core is still loading; make sure there was one success
assertEquals(1, timesReplicated - previousTimesFailed);
masterJetty.stop();
@ -683,7 +685,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
assertEquals(nDocs, numFound(slaveQueryRsp));
int failed = Integer.parseInt(getSlaveDetails("timesFailed"));
assertTrue(failed > 0);
assertTrue(failed > previousTimesFailed);
assertEquals(1, Integer.parseInt(getSlaveDetails("timesIndexReplicated")) - failed);
} finally {
resetFactory();