You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ho...@apache.org on 2023/06/28 17:01:15 UTC

[solr] branch branch_9x updated: SOLR-16848 : Fix flaky DeleteReplicaTest test (#1727)

This is an automated email from the ASF dual-hosted git repository.

houston pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9x by this push:
     new 4acb26efa22 SOLR-16848 : Fix flaky DeleteReplicaTest test (#1727)
4acb26efa22 is described below

commit 4acb26efa223cb739788aee1058793408ef30b20
Author: Alex <st...@apache.org>
AuthorDate: Wed Jun 28 09:52:58 2023 -0700

    SOLR-16848 : Fix flaky DeleteReplicaTest test (#1727)
    
    Specifically, DeleteReplicaTest.raceConditionOnDeleteAndRegisterReplica()
    ---------
    
    Co-authored-by: Paul McArthur <pm...@salesforce.com>
    (cherry picked from commit 75810c953e847d4f5552c5485a0613f3753cbcee)
---
 solr/CHANGES.txt                                          |  2 ++
 .../src/test/org/apache/solr/cloud/DeleteReplicaTest.java | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index ec30ffb9966..bb546459027 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -220,6 +220,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";