lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject lucene-solr:jira/SOLR-10496: SOLR-10496: Fix ClassCastException because the SRC_NODE hint is a Set
Date Thu, 22 Jun 2017 13:21:09 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/jira/SOLR-10496 ebf298329 -> cb665a1b3


SOLR-10496: Fix ClassCastException because the SRC_NODE hint is a Set


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/cb665a1b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/cb665a1b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/cb665a1b

Branch: refs/heads/jira/SOLR-10496
Commit: cb665a1b35cbd1826c58f8d4ff8f20eb37bc5f8f
Parents: ebf2983
Author: Shalin Shekhar Mangar <shalin@apache.org>
Authored: Thu Jun 22 18:50:55 2017 +0530
Committer: Shalin Shekhar Mangar <shalin@apache.org>
Committed: Thu Jun 22 18:50:55 2017 +0530

----------------------------------------------------------------------
 .../src/java/org/apache/solr/cloud/autoscaling/Policy.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cb665a1b/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java b/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java
index 5efb996..e264b67 100644
--- a/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java
+++ b/solr/solrj/src/java/org/apache/solr/cloud/autoscaling/Policy.java
@@ -32,7 +32,6 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
-import java.util.function.Predicate;
 import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
@@ -379,9 +378,12 @@ public class Policy implements MapWriter {
             }
           }
         }
-        if(hints.get(Hint.SRC_NODE) != null && session.matrix.stream().noneMatch(row
-> row.node.equals(hints.get(Hint.SRC_NODE)))){
+        Set<String> srcNodes = (Set<String>) hints.get(Hint.SRC_NODE);
+        if (srcNodes != null && !srcNodes.isEmpty() && session.matrix.stream().noneMatch(row
-> srcNodes.contains(row.node))) {
           // the source node is dead so live nodes may not have it
-          session.matrix.add(new Row((String) hints.get(Hint.SRC_NODE), session.getPolicy().params,
session.dataProvider));
+          for (String srcNode : srcNodes) {
+            session.matrix.add(new Row(srcNode, session.getPolicy().params, session.dataProvider));
+          }
         }
         session.applyRules();
         originalViolations.addAll(session.getViolations());


Mime
View raw message