You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2019/06/02 08:45:30 UTC

[lucene-solr] 02/02: This reverts commit 11e19d3ab23e4acb297b1d7224384c2f51908bed.

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

noble pushed a commit to branch jira/SOLR-13504
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 4380d39bdb00a2b05e76c6c117f59ccb649bc7b7
Author: noble <no...@apache.org>
AuthorDate: Sun Jun 2 18:44:55 2019 +1000

    This reverts commit 11e19d3ab23e4acb297b1d7224384c2f51908bed.
---
 .../org/apache/solr/client/solrj/cloud/autoscaling/Clause.java |  7 +++++--
 .../solr/client/solrj/cloud/autoscaling/VariableBase.java      | 10 ----------
 .../apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java |  9 +--------
 .../solr/client/solrj/cloud/autoscaling/TestPolicy2.java       |  2 +-
 4 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java
index a753e02..d4ae968 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java
@@ -57,13 +57,13 @@ import static org.apache.solr.common.util.Utils.toJSONString;
  */
 public class Clause implements MapWriter, Comparable<Clause> {
   public static final String NODESET = "nodeset";
-  static final Set<String> IGNORE_TAGS = new HashSet<>(Arrays.asList(REPLICA, COLLECTION, SHARD, "strict", "type", "put", NODESET));
+  private static final Set<String> IGNORE_TAGS = new HashSet<>(Arrays.asList(REPLICA, COLLECTION, SHARD, "strict", "type", "put", NODESET));
 
   private final int hashCode;
   final boolean hasComputedValue;
   final Map<String, Object> original;
   final Clause derivedFrom;
-  boolean nodeSetPresent = false;
+  private boolean nodeSetPresent = false;
   Condition collection, shard, replica, tag, globalTag;
   final Replica.Type type;
   boolean strict;
@@ -568,6 +568,9 @@ public class Clause implements MapWriter, Comparable<Clause> {
 
   public List<Violation> test(Policy.Session session, double[] deviations) {
     if (isPerCollectiontag()) {
+      if(nodeSetPresent) {
+
+      }
 
       return tag.varType == Type.NODE ||
           (tag.varType.meta.isNodeSpecificVal() && replica.computedType == null) ?
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java
index 5809eff..aaa874d 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/VariableBase.java
@@ -45,16 +45,6 @@ public class VariableBase implements Variable {
     }
   }
 
-
-  @Override
-  public String postValidate(Condition condition) {
-    if(Clause.IGNORE_TAGS.contains(condition.getName())) return null;
-    if(condition.getOperand() == Operand.WILDCARD && condition.clause.nodeSetPresent){
-      return "#EACH not supported in tags in nodeset";
-    }
-    return null;
-  }
-
   static Object getOperandAdjustedValue(Object val, Object original) {
     if (original instanceof Condition) {
       Condition condition = (Condition) original;
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
index 199489c..9abbc54 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
@@ -656,13 +656,6 @@ public class TestPolicy extends SolrTestCaseJ4 {
     expectThrows(IllegalArgumentException.class,
         () -> Clause.create("{replica: '#EQUAL' , shard: '#EACH' , sysprop.zone:[east]}"));
 
-
-    expectThrows(IllegalArgumentException.class,
-        () -> Clause.create("{replica:1, nodeset : {sysprop.zone : '#EACH'}}"));
-
-    expectThrows(IllegalArgumentException.class,
-        () -> Clause.create("{replica:1, nodeset : {host : '#EACH'}}"));
-
     clause = Clause.create("{cores: '#EQUAL' , node:'#ANY'}");
     assertEquals(ComputedType.EQUAL, clause.globalTag.computedType);
     expectThrows(IllegalArgumentException.class,
@@ -1919,7 +1912,7 @@ public class TestPolicy extends SolrTestCaseJ4 {
           "{replica:0, nodeset:{'nodeRole':'overseer'},'strict':false}," +
           "{'replica':'<1','node':'node3'}," +
           "{'replica':'<2','node':'#ANY','shard':'#EACH'}," +
-          "{'replica':'<3','shard':'#EACH', nodeset : { 'sysprop.rack':[rack1 , rack2 , rack3 , rack4]}}" +
+          "{'replica':'<3','shard':'#EACH', nodeset : { 'sysprop.rack':'#EACH'}}" +
           "]" +
           "}" +
           "}";
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
index 6c06335..6ec31cd 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy2.java
@@ -87,7 +87,7 @@ public class TestPolicy2 extends SolrTestCaseJ4 {
         "  'cluster-preferences':[{ minimize : cores},{maximize : freedisk, precision : 50}]}";
     if(useNodeset){
       autoScalingjson = "{cluster-policy:[" +
-          "    { replica : '<3' , shard : '#EACH', nodeset:{sysprop.zone: [east, west]} } ]," +
+          "    { replica : '<3' , shard : '#EACH', nodeset:{sysprop.zone: '#EACH'} } ]," +
           "  'cluster-preferences':[{ minimize : cores},{maximize : freedisk, precision : 50}]}";
     }
     policy = new Policy((Map<String, Object>) Utils.fromJSONString(autoScalingjson));