You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/11/11 00:48:19 UTC

[lucene-solr] 03/03: @1154 Only set active leader in Slice.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 763f3eabdfdf7168450c33b4ba558c0e8f3db8de
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Nov 10 18:42:32 2020 -0600

    @1154 Only set active leader in Slice.
---
 solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java b/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
index 1d171d8..6edc0b2 100644
--- a/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
+++ b/solr/solrj/src/java/org/apache/solr/common/cloud/Slice.java
@@ -209,7 +209,8 @@ public class Slice extends ZkNodeProps implements Iterable<Replica> {
 
   private Replica findLeader() {
     for (Replica replica : replicas.values()) {
-      if (replica.getStr(LEADER) != null) {
+      String leaderStr = replica.getStr(LEADER);
+      if (leaderStr != null && leaderStr.equals("true") && replica.getState() == Replica.State.ACTIVE) {
         return replica;
       }
     }