Apache Solr open-source search software
Remove useless Zookeeper checks (#1465)
Pierre Salagnac3d02801a565c
diff --git a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.javaindex 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 electionif (cc.isShutDown()) {