From ffd693605a09cc5998cba53e2375150824f7a30e Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Sun, 30 Dec 2012 05:54:59 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1426892 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 5 ++++ .../org/apache/solr/cloud/ZkController.java | 26 +++++++++++++++++++ 2 files changed, 31 insertions(+) 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) {