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

[15/30] lucene-solr:jira/http2: SOLR-12648: Use the information whether custom preferences were specified in the CloudUtil.usePolicyFramework method instead of comparing directly against default preferences. Comparing against default preferences was wron

SOLR-12648: Use the information whether custom preferences were specified in the CloudUtil.usePolicyFramework method instead of comparing directly against default preferences. Comparing against default preferences was wrong because it ignores the case where the user explicitly added the same preferences as the default ones.


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

Branch: refs/heads/jira/http2
Commit: 05949a32c9a1a20cce1623e6b76bc8397c4bc325
Parents: 554ac64
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Wed Oct 3 16:58:45 2018 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Thu Oct 4 13:26:51 2018 +0530

----------------------------------------------------------------------
 solr/core/src/java/org/apache/solr/cloud/CloudUtil.java       | 3 +--
 .../apache/solr/client/solrj/cloud/autoscaling/Policy.java    | 7 +++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/05949a32/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
index 26ba1b8..14bebef 100644
--- a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
+++ b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
@@ -29,7 +29,6 @@ import java.util.Optional;
 import org.apache.commons.io.FileUtils;
 import org.apache.solr.client.solrj.cloud.SolrCloudManager;
 import org.apache.solr.client.solrj.cloud.autoscaling.AutoScalingConfig;
-import org.apache.solr.client.solrj.cloud.autoscaling.Policy;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.cloud.ClusterState;
@@ -174,7 +173,7 @@ public class CloudUtil {
     // if no autoscaling configuration exists then obviously we cannot use the policy framework
     if (autoScalingConfig.getPolicy().isEmpty()) return false;
     // do custom preferences exist
-    if (!autoScalingConfig.getPolicy().getClusterPreferences().equals(Policy.DEFAULT_PREFERENCES)) return true;
+    if (!autoScalingConfig.getPolicy().isEmptyPreferences()) return true;
     // does a cluster policy exist
     if (!autoScalingConfig.getPolicy().getClusterPolicy().isEmpty()) return true;
     // finally we check if the current collection has a policy

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/05949a32/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
index 78043df..cfe9455 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Policy.java
@@ -478,6 +478,13 @@ public class Policy implements MapWriter {
     return empty;
   }
 
+  /**
+   * @return true if no preferences were specified by the user, false otherwise
+   */
+  public boolean isEmptyPreferences() {
+    return emptyPreferences;
+  }
+
   /*This stores the logical state of the system, given a policy and
    * a cluster state.
    *