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:28 UTC

[lucene-solr] branch jira/SOLR-13504 updated (11e19d3 -> 4380d39)

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

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


    from 11e19d3  SOLR-13504: more tests
     new eca2f27  SOLR-13504: more tests
     new 4380d39  This reverts commit 11e19d3ab23e4acb297b1d7224384c2f51908bed.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/solr/client/solrj/cloud/autoscaling/Clause.java | 10 +++++-----
 .../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(+), 24 deletions(-)


[lucene-solr] 01/02: SOLR-13504: more tests

Posted by no...@apache.org.
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 eca2f277ac392744bfdd68bb4175aa853446b959
Author: noble <no...@apache.org>
AuthorDate: Sun Jun 2 18:32:58 2019 +1000

    SOLR-13504: more tests
---
 .../org/apache/solr/client/solrj/cloud/autoscaling/Clause.java     | 7 ++-----
 1 file changed, 2 insertions(+), 5 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 2f6b28e..a753e02 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
@@ -84,7 +84,7 @@ public class Clause implements MapWriter, Comparable<Clause> {
   }
 
   // internal use only
-  Clause(Map<String, Object> original, Condition tag, Condition globalTag, boolean isStrict, boolean nodeSetPresent) {
+  Clause(Map<String, Object> original, Condition tag, Condition globalTag, boolean isStrict,  boolean nodeSetPresent) {
     this.hashCode = original.hashCode();
     this.original = original;
     this.tag = tag;
@@ -233,7 +233,7 @@ public class Clause implements MapWriter, Comparable<Clause> {
     if (tag != null) {
       throwExp(m, "Only one tag other than collection, shard, replica is possible");
     }
-    tag = parse(s, o instanceof Map ? (Map<String, Object>) o : singletonMap(s, o));
+    tag = parse(s, o instanceof Map? (Map<String, Object>) o : singletonMap(s, o));
   }
 
   private int compareTypes(Replica.Type t1, Replica.Type t2) {
@@ -568,9 +568,6 @@ 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) ?


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

Posted by no...@apache.org.
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));