Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-4244: When coming back from session expiration we should not wait for the leader to see us in the down state if we are the node that must become the leader.

Mark Robert Millerffd693605a09
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 47d9d4be1ba..de413cff9d7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -408,6 +408,11 @@ Bug Fixes
* SOLR-4175:SearchComponent chain can't contain two components of the
same class and use debugQuery. (Tomás Fernández Löbbe via ehatcher)
+* SOLR-4244: When coming back from session expiration we should not wait for
+ the leader to see us in the down state if we are the node that must become
+ the leader. (Mark Miller)
+
+
Other Changes
----------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkController.java b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
index 315af33703d..661dd3275af 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -274,6 +274,32 @@ public final class ZkController {
continue;
}
}
+
+ // if it looks like we are going to be the leader, we don't
+ // want to wait for the following stuff
+ CloudDescriptor cloudDesc = descriptor.getCloudDescriptor();
+ String collection = cloudDesc.getCollectionName();
+ String slice = cloudDesc.getShardId();
+ try {
+
+ int children = zkStateReader
+ .getZkClient()
+ .getChildren(
+ ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection
+ + "/leader_elect/" + slice + "/election", null, true).size();
+ if (children == 0) {
+ return;
+ }
+
+ } catch (NoNodeException e) {
+ return;
+ } catch (InterruptedException e2) {
+ Thread.currentThread().interrupt();
+ } catch (KeeperException e) {
+ log.warn("", e);
+ Thread.currentThread().interrupt();
+ }
+
try {
waitForLeaderToSeeDownState(descriptor, coreZkNodeName);
} catch (Exception e) {