You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by nk...@apache.org on 2016/02/08 23:36:24 UTC
[49/50] [abbrv] lucene-solr git commit: SOLR-8561: Add fallback to
ZkController.getLeaderProps for a mixed 5.4-pre-5.4 deployments
SOLR-8561: Add fallback to ZkController.getLeaderProps for a mixed 5.4-pre-5.4 deployments
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_5_4@1725212 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/a128bd36
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/a128bd36
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/a128bd36
Branch: refs/heads/branch_5_4
Commit: a128bd36b26457c7686be8209d985d2753969766
Parents: 340dc9c
Author: Shai Erera <sh...@apache.org>
Authored: Mon Jan 18 10:00:10 2016 +0000
Committer: Shai Erera <sh...@apache.org>
Committed: Mon Jan 18 10:00:10 2016 +0000
----------------------------------------------------------------------
solr/CHANGES.txt | 5 +++++
.../java/org/apache/solr/cloud/ZkController.java | 18 +++++++++++++-----
2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a128bd36/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 5e98349..452be4a 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -34,6 +34,11 @@ Bug Fixes
* SOLR-8418: Adapt to changes in LUCENE-6590 for use of boosts with MLTHandler and
Simple/CloudMLTQParser (Jens Wille, Ramkumar Aiyengar)
+
+* SOLR-8561: Doing a rolling upgrade to 5.4.0 fails because the new nodes cannot find the
+ shard leader properties where they expect. This bug was first introduced in 5.4.0 and a
+ fallback was added so that the leader properties are searched in both the old location
+ and the new one. (Shai Erera)
New Features
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/a128bd36/solr/core/src/java/org/apache/solr/cloud/ZkController.java
----------------------------------------------------------------------
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 d83cf81..1315279 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkController.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkController.java
@@ -1056,11 +1056,8 @@ public final class ZkController {
Exception exp = null;
while (iterCount-- > 0) {
try {
- byte[] data = zkClient.getData(
- ZkStateReader.getShardLeadersPath(collection, slice), null, null,
- true);
- ZkCoreNodeProps leaderProps = new ZkCoreNodeProps(
- ZkNodeProps.load(data));
+ byte[] data = getLeaderPropsWithFallback(collection, slice);
+ ZkCoreNodeProps leaderProps = new ZkCoreNodeProps(ZkNodeProps.load(data));
return leaderProps;
} catch (InterruptedException e) {
throw e;
@@ -1081,6 +1078,17 @@ public final class ZkController {
throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE, "Could not get leader props", exp);
}
+ private byte[] getLeaderPropsWithFallback(String collection, String slice) throws KeeperException, InterruptedException {
+ final String leaderPath = ZkStateReader.getShardLeadersPath(collection, slice);
+ try {
+ return zkClient.getData(leaderPath, null, null, true);
+ } catch (final KeeperException.NoNodeException e) {
+ // If the original leader node isn't found, fallback to a pre-5.4 format, where the leader props were set
+ // on the parent node (in case the current leader is a pre-5.4 Solr instance).
+ final String parentLeaderPath = new org.apache.hadoop.fs.Path(leaderPath).getParent().toString();
+ return zkClient.getData(parentLeaderPath, null, null, true);
+ }
+ }
private void joinElection(CoreDescriptor cd, boolean afterExpiration, boolean joinAtHead)
throws InterruptedException, KeeperException, IOException {