Apache Lucene open-source search software
SOLR-12201: TestReplicationHandler.doTestIndexFetchOnMasterRestart(): handle unexpected replication failures
Steve Rowefe0da9e8d5d9
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex c9c486616e1..9cefce2c5f2 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -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----------------------diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.javaindex e4b7fa32a72..8c247547d11 100644--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java@@ -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();