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 2022/10/26 17:10:04 UTC

[solr] branch branch_9_1 updated: SOLR-16416: Fix testDesignatedOverseerRestarts

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

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


The following commit(s) were added to refs/heads/branch_9_1 by this push:
     new a21e8bc4f3c SOLR-16416: Fix testDesignatedOverseerRestarts
a21e8bc4f3c is described below

commit a21e8bc4f3c3efcc94bb5a3d6bf76a4a562d3dd0
Author: Houston Putman <ho...@apache.org>
AuthorDate: Wed Oct 26 12:51:03 2022 -0400

    SOLR-16416: Fix testDesignatedOverseerRestarts
    
    Remove roles for all nodes in reverse election order.
    This will make sure no elections take place at the beginning of the
    test, which can cause problems later on in the test.
    
    (cherry picked from commit b01ae1783946b7fee43cd2faace0b721f7f7d29f)
---
 .../src/test/org/apache/solr/cloud/OverseerRolesTest.java   | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
index 0ba30acfff3..21211623e18 100644
--- a/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
@@ -187,8 +187,13 @@ public class OverseerRolesTest extends SolrCloudTestCase {
     }
     logOverseerState();
     // Remove the OVERSEER role, in case it was already assigned by another test in this suite
-    for (String node :
-        OverseerCollectionConfigSetProcessor.getSortedOverseerNodeNames(zkClient())) {
+    List<String> nodes =
+        OverseerCollectionConfigSetProcessor.getSortedOverseerNodeNames(zkClient());
+    // We want to remove from the last (in election order) to the first.
+    // This way the current overseer will have its role removed last,
+    // so there will not be any elections.
+    Collections.reverse(nodes);
+    for (String node : nodes) {
       CollectionAdminRequest.removeRole(node, "overseer").process(cluster.getSolrClient());
     }
     String overseer1 = OverseerCollectionConfigSetProcessor.getLeaderNode(zkClient());
@@ -203,10 +208,6 @@ public class OverseerRolesTest extends SolrCloudTestCase {
     waitForNewOverseer(15, overseer1, false);
     JettySolrRunner leaderJetty = getOverseerJetty();
 
-    List<String> nodes =
-        OverseerCollectionConfigSetProcessor.getSortedOverseerNodeNames(zkClient());
-    nodes.remove(overseer1); // remove the designated overseer
-
     logOverseerState();
     // kill the current overseer, and check that the next node in the election queue assumes
     // leadership