Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16848 : Fix flaky DeleteReplicaTest test (#1727)

Alex75810c953e84
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e472e4b7cf2..0e2ced23f83 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -250,6 +250,8 @@ Bug Fixes
* SOLR-16831: Fixed bin/solr healthcheck command returning cluster status details. Removed SolrCloudTool class that is no longer used. (Eric Pugh)
+* SOLR-16848: Flaky DeleteReplicaTest.raceConditionOnDeleteAndRegisterReplica (Alex Deparvu, Paul McArthur)
+
Dependency Upgrades
---------------------
* PR#1494: Upgrade forbiddenapis to 3.5 (Uwe Schindler)
diff --git a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
index 25de5f98279..686a0a2554a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DeleteReplicaTest.java
@@ -346,6 +346,7 @@ public class DeleteReplicaTest extends SolrCloudTestCase {
log.info("Running delete core {}", cd);
try {
+ waitForJettyInit(replica1Jetty, replica1JettyNodeName);
ZkController replica1ZkController =
replica1Jetty.getCoreContainer().getZkController();
ZkNodeProps m =
@@ -495,6 +496,20 @@ public class DeleteReplicaTest extends SolrCloudTestCase {
}
}
+ /**
+ * see SOLR-16848 working around a timing issue where the callback will be faster than the
+ * dispatchFilter's init
+ */
+ private void waitForJettyInit(JettySolrRunner replica1Jetty, String replica1JettyNodeName)
+ throws InterruptedException {
+ TimeOut timeOut = new TimeOut(5, TimeUnit.SECONDS, TimeSource.NANO_TIME);
+ while (!replica1Jetty.isRunning()) {
+ Thread.sleep(100);
+ if (timeOut.hasTimedOut())
+ fail("Wait for " + replica1JettyNodeName + " replica to init failed!");
+ }
+ }
+
@Test
public void deleteReplicaOnIndexing() throws Exception {
final String collectionName = "deleteReplicaOnIndexing";