Skip to content

Apache Lucene open-source search software

TestReplicationHandler - fix testReplicateAfterWrite2Slave by retrying commit also

Yonik Seeley8bfc318bbf4f
diff --git a/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java
index 4be812a4ab8..dd97d946ec2 100644
--- a/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java
+++ b/solr/src/test/org/apache/solr/handler/TestReplicationHandler.java
@@ -448,6 +448,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
index(slaveClient, "id", 555, "name", "name = " + 555);
slaveClient.commit(true, true);
+
//this doc is added to slave so it should show an item w/ that result
SolrDocumentList slaveQueryResult = null;
NamedList slaveQueryRsp;
@@ -459,6 +460,10 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
break;
}
Thread.sleep(100);
+
+ // The last commit may have failed due to exceeding max warming searchers.
+ // We'll try again.
+ slaveClient.commit(true, true);
}
assertNotNull(slaveQueryResult);
assertEquals(1, slaveQueryResult.getNumFound());