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

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


The following commit(s) were added to refs/heads/main by this push:
     new 3d02801a565 Remove useless Zookeeper checks (#1465)
3d02801a565 is described below

commit 3d02801a565c1083ad899c1cb4b7bcb21754fe04
Author: Pierre Salagnac <[email protected]>
AuthorDate: Tue Apr 11 06:48:20 2023 +0200

    Remove useless Zookeeper checks (#1465)
    
    Co-authored-by: Pierre Salagnac <[email protected]>
    SOLR-16705
---
 .../solr/cloud/ShardLeaderElectionContext.java     | 35 ----------------------
 1 file changed, 35 deletions(-)

diff --git 
a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java 
b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
index 898848887a4..c57a43980b1 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
@@ -146,8 +146,6 @@ final class ShardLeaderElectionContext extends 
ShardLeaderElectionContextBase {
 
       if (!weAreReplacement) {
         waitForReplicasToComeUp(leaderVoteWait);
-      } else {
-        areAllReplicasParticipating();
       }
 
       if (isClosed) {
@@ -494,39 +492,6 @@ final class ShardLeaderElectionContext extends 
ShardLeaderElectionContextBase {
     return false;
   }
 
-  // returns true if all replicas are found to be up, false if not
-  private boolean areAllReplicasParticipating() throws InterruptedException {
-    final String shardsElectZkPath = electionPath + 
LeaderElector.ELECTION_NODE;
-    final DocCollection docCollection =
-        zkController.getClusterState().getCollectionOrNull(collection);
-
-    if (docCollection != null && docCollection.getSlice(shardId) != null) {
-      final Slice slices = docCollection.getSlice(shardId);
-      int found = 0;
-      try {
-        found = zkClient.getChildren(shardsElectZkPath, null, true).size();
-      } catch (KeeperException e) {
-        if (e instanceof KeeperException.SessionExpiredException) {
-          // if the session has expired, then another election will be 
launched, so
-          // quit here
-          throw new SolrException(
-              ErrorCode.SERVER_ERROR,
-              "ZK session expired - cancelling election for " + collection + " 
" + shardId);
-        }
-        log.error("Error checking for the number of election participants", e);
-      }
-
-      if (found >= slices.getReplicasMap().size()) {
-        log.debug("All replicas are ready to participate in election.");
-        return true;
-      }
-    } else {
-      log.warn("Shard not found: {} for collection {}", shardId, collection);
-      return false;
-    }
-    return false;
-  }
-
   private void rejoinLeaderElection(SolrCore core) throws 
InterruptedException, KeeperException {
     // remove our ephemeral and re join the election
     if (cc.isShutDown()) {

Reply via email to