Skip to content

Apache Lucene open-source search software

SOLR-4067: ZkStateReader#getLeaderProps should not return props for a leader that it does not think is live.

Mark Robert Miller267df1a190af
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 7598ccf3e35..15a8b8b3646 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -181,6 +181,9 @@ Other Changes
* SOLR-3856: New tests for SqlEntityProcessor/CachedSqlEntityProcessor
(James Dyer)
+* SOLR-4067: ZkStateReader#getLeaderProps should not return props for a leader
+ that it does not think is live. (Mark Miller)
+
================== 4.0.0 ==================
Versions of Major Components
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 e79893876b3..02c8b4f325c 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
@@ -408,7 +408,7 @@ public class ZkStateReader {
while (System.currentTimeMillis() < timeoutAt) {
if (clusterState != null) {
final ZkNodeProps nodeProps = clusterState.getLeader(collection, shard);
- if (nodeProps != null) {
+ if (nodeProps != null && getClusterState().liveNodesContain((String) nodeProps.get(ZkStateReader.NODE_NAME_PROP))) {
return nodeProps;
}
}