You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by an...@apache.org on 2016/04/22 02:19:20 UTC
[5/7] lucene-solr:branch_5_5: SOLR-8779: Fix missing
InterruptedException handling in ZkStateReader
SOLR-8779: Fix missing InterruptedException handling in ZkStateReader
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/6024572a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/6024572a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/6024572a
Branch: refs/heads/branch_5_5
Commit: 6024572a53fc3af8fbb2f3d0cf51cf46d7406350
Parents: 5601f83
Author: Varun Thacker <va...@gmail.com>
Authored: Fri Mar 4 18:08:53 2016 +0530
Committer: Anshum Gupta <an...@apache.org>
Committed: Thu Apr 21 16:57:10 2016 -0700
----------------------------------------------------------------------
solr/CHANGES.txt | 2 ++
.../apache/solr/common/cloud/ZkStateReader.java | 32 ++++++++++++--------
2 files changed, 22 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6024572a/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 1a972e4..0c29924 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -114,6 +114,8 @@ Bug Fixes
* SOLR-8728: ReplicaAssigner throws NPE when a partial list of nodes are only participating in replica
placement. splitshard should preassign nodes using rules, if rules are present (noble, Shai Erera)
+* SOLR-8779: Fix missing InterruptedException handling in ZkStateReader.java (Varun Thacker)
+
Other Changes
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/6024572a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 49b02a2..8fa3be9 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -165,12 +165,10 @@ public class ZkStateReader implements Closeable {
} else {
throw new ZooKeeperException(ErrorCode.INVALID_STATE, "No config data found at path: " + path);
}
- }
- catch (KeeperException e) {
+ } catch (KeeperException e) {
throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading config name for collection " + collection, e);
- }
- catch (InterruptedException e) {
- Thread.interrupted();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
throw new SolrException(ErrorCode.SERVER_ERROR, "Error loading config name for collection " + collection, e);
}
@@ -710,14 +708,17 @@ public class ZkStateReader implements Closeable {
this.aliases = ClusterState.load(data);
}
- public Map getClusterProps(){
+ public Map getClusterProps() {
try {
if (getZkClient().exists(ZkStateReader.CLUSTER_PROPS, true)) {
return (Map) Utils.fromJSON(getZkClient().getData(ZkStateReader.CLUSTER_PROPS, null, new Stat(), true)) ;
} else {
return new LinkedHashMap();
}
- } catch (Exception e) {
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Thread interrupted. Error reading cluster properties", e);
+ } catch (KeeperException e) {
throw new SolrException(ErrorCode.SERVER_ERROR, "Error reading cluster properties", e);
}
}
@@ -760,9 +761,13 @@ public class ZkStateReader implements Closeable {
LOG.warn("Race condition while trying to set a new cluster prop on current version [{}]", s.getVersion());
//race condition
continue;
- } catch (Exception ex) {
- LOG.error("Error updating path [{}]", CLUSTER_PROPS, ex);
- throw new SolrException(ErrorCode.SERVER_ERROR, "Error updating cluster property " + propertyName, ex);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ LOG.error("Thread Interrupted. Error updating path [{}]", CLUSTER_PROPS, e);
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Thread Interrupted. Error updating cluster property " + propertyName, e);
+ } catch (KeeperException e) {
+ LOG.error("Error updating path [{}]", CLUSTER_PROPS, e);
+ throw new SolrException(ErrorCode.SERVER_ERROR, "Error updating cluster property " + propertyName, e);
}
break;
}
@@ -785,8 +790,11 @@ public class ZkStateReader implements Closeable {
new ConfigData((Map<String, Object>) Utils.fromJSON(data), stat.getVersion()) :
null;
}
- } catch (KeeperException | InterruptedException e) {
- throw new SolrException(ErrorCode.SERVER_ERROR,"Error reading security properties",e) ;
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new SolrException(ErrorCode.SERVER_ERROR,"Error reading security properties", e) ;
+ } catch (KeeperException e) {
+ throw new SolrException(ErrorCode.SERVER_ERROR,"Error reading security properties", e) ;
}
return null;
}