lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [01/18] lucene-solr:jira/solr-12438: SOLR-12444: Updating a cluster policy fails
Date Thu, 07 Jun 2018 12:18:19 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/jira/solr-12438 2fa260c14 -> 53d9d081b


SOLR-12444: Updating a cluster policy fails


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

Branch: refs/heads/jira/solr-12438
Commit: add77d272582e909e9a7cf008d35ea72c3914230
Parents: 6624773
Author: Noble Paul <noble@apache.org>
Authored: Tue Jun 5 22:29:06 2018 +1000
Committer: Noble Paul <noble@apache.org>
Committed: Tue Jun 5 22:29:06 2018 +1000

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../autoscaling/AutoScalingHandlerTest.java     | 21 ++++++++++++++++++++
 .../client/solrj/cloud/autoscaling/Clause.java  |  2 +-
 3 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/add77d27/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index c88de10..1b454a0 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -1312,6 +1312,8 @@ Bug Fixes
 * SOLR-11477: Disallow resolving of external entities in the XML query parser (defType=xmlparser).
   (Michael Stepankin, Olga Barinova, Uwe Schindler, Christine Poerschke)
 
+* SOLR-12444: Updating a cluster policy fails (noble)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/add77d27/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
index 483b60c..cf11953 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.solr.cloud.autoscaling;
 
+import java.io.IOException;
 import java.lang.invoke.MethodHandles;
 import java.util.List;
 import java.util.Map;
@@ -26,6 +27,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrResponse;
+import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.cloud.autoscaling.Policy;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
@@ -1011,6 +1013,25 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
     assertEquals(5L, properties.get(AutoScalingParams.ACTION_THROTTLE_PERIOD_SECONDS));
   }
 
+  public void testUpdatePolicy() throws IOException, SolrServerException {
+    CloudSolrClient solrClient = cluster.getSolrClient();
+    String setPropertiesCommand = "{'set-cluster-policy': [" +
+        "{'cores': '<4','node': '#ANY'}]}";
+    solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
+    SolrRequest req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
+    NamedList<Object> response = solrClient.request(req);
+    assertEquals("<4", Utils.getObjectByPath(response,false,"cluster-policy[0]/cores"));
+    assertEquals("#ANY", Utils.getObjectByPath(response,false,"cluster-policy[0]/node"));
+    setPropertiesCommand = "{'set-cluster-policy': [" +
+        "{'cores': '<3','node': '#ANY'}]}";
+    solrClient.request(createAutoScalingRequest(SolrRequest.METHOD.POST, setPropertiesCommand));
+    req = createAutoScalingRequest(SolrRequest.METHOD.GET, null);
+    response = solrClient.request(req);
+    System.out.println(response);
+
+
+  }
+
   static class AutoScalingRequest extends SolrRequest {
     protected final String message;
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/add77d27/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Clause.java
----------------------------------------------------------------------
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 c739588..8f198bd 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
@@ -140,7 +140,7 @@ public class Clause implements MapWriter, Comparable<Clause> {
     if (this == o) return true;
     if (o == null || getClass() != o.getClass()) return false;
     Clause that = (Clause)o;
-    return compareTo(that) == 0;
+    return  Objects.equals(this.original, that.original);
   }
 
   void addTags(Collection<String> params) {


Mime
View raw message