lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject lucene-solr:master: SOLR-12208: Renamed the autoscaling variable 'INDEX.sizeInBytes' to 'INDEX.sizeInGB'
Date Tue, 12 Jun 2018 03:47:26 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master ead05a10b -> 98a4dd29e


SOLR-12208: Renamed the autoscaling variable 'INDEX.sizeInBytes' to 'INDEX.sizeInGB'


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

Branch: refs/heads/master
Commit: 98a4dd29ef615897656f01ebac40957ca5fce432
Parents: ead05a1
Author: Noble Paul <noble@apache.org>
Authored: Tue Jun 12 13:47:12 2018 +1000
Committer: Noble Paul <noble@apache.org>
Committed: Tue Jun 12 13:47:12 2018 +1000

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  1 +
 .../solrj/cloud/autoscaling/Suggestion.java     | 22 +++++++++++---------
 .../solrj/impl/SolrClientNodeStateProvider.java |  8 ++++++-
 .../solrj/cloud/autoscaling/TestPolicy.java     |  8 +++----
 4 files changed, 24 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/98a4dd29/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2fc228e..9cdb8bd 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -95,6 +95,7 @@ Other Changes
   This is an internal change not yet plumbed into /update formats.
   AddUpdateCommand and it's relationship with DirectUpdateHandler2 was reworked substantially.
(Moshe Bla, David Smiley)
 
+* SOLR-12208: Renamed the autoscaling variable 'INDEX.sizeInBytes' to 'INDEX.sizeInGB' (noble)
 ==================  7.4.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/98a4dd29/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
index a4eed4b..c2f9d24 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/cloud/autoscaling/Suggestion.java
@@ -41,7 +41,7 @@ import static org.apache.solr.client.solrj.cloud.autoscaling.Policy.ANY;
 import static org.apache.solr.common.params.CollectionParams.CollectionAction.MOVEREPLICA;
 
 public class Suggestion {
-  public static final String coreidxsize = "INDEX.sizeInBytes";
+  public static final String coreidxsize = "INDEX.sizeInGB";
 
   static final Map<String, ConditionType> validatetypes = new HashMap<>();
 
@@ -121,7 +121,7 @@ public class Suggestion {
     IP_2("ip_2", Long.class, null, 0L, 255L),
     IP_3("ip_3", Long.class, null, 0L, 255L),
     IP_4("ip_4", Long.class, null, 0L, 255L),
-    FREEDISK(ImplicitSnitch.DISK, Double.class, null, 0d, Double.MAX_VALUE, coreidxsize,
Boolean.TRUE) {
+    FREEDISK(ImplicitSnitch.DISK, Double.class, null, 0d, Double.MAX_VALUE, coreidxsize,
Boolean.TRUE,null) {
       @Override
       public Object convertVal(Object val) {
         Number value = (Number) super.validate(ImplicitSnitch.DISK, val, false);
@@ -206,14 +206,14 @@ public class Suggestion {
         cell.val = currFreeDisk + idxSize;
       }
     },
-    CORE_IDX(coreidxsize, Double.class, null, 0d, Double.MAX_VALUE) {
+    CORE_IDX(coreidxsize, Double.class, null, 0d, Double.MAX_VALUE,null, false,"INDEX.sizeInBytes"
) {
       @Override
       public Object convertVal(Object val) {
         return FREEDISK.convertVal(val);
       }
     },
     NODE_ROLE(ImplicitSnitch.NODEROLE, String.class, Collections.singleton("overseer"), null,
null),
-    CORES(ImplicitSnitch.CORES, Long.class, null, 0L, Long.MAX_VALUE, null, Boolean.TRUE)
{
+    CORES(ImplicitSnitch.CORES, Long.class, null, 0L, Long.MAX_VALUE) {
       @Override
       public void addViolatingReplicas(ViolationCtx ctx) {
         for (Row r : ctx.allRows) {
@@ -247,9 +247,9 @@ public class Suggestion {
         cell.val = cell.val == null ? 0 : ((Number) cell.val).longValue() - 1;
       }
     },
-    SYSLOADAVG(ImplicitSnitch.SYSLOADAVG, Double.class, null, 0d, 100d, null, Boolean.TRUE),
-    HEAPUSAGE(ImplicitSnitch.HEAPUSAGE, Double.class, null, 0d, null, null, Boolean.TRUE),
-    NUMBER("NUMBER", Long.class, null, 0L, Long.MAX_VALUE, null, Boolean.TRUE),
+    SYSLOADAVG(ImplicitSnitch.SYSLOADAVG, Double.class, null, 0d, 100d),
+    HEAPUSAGE(ImplicitSnitch.HEAPUSAGE, Double.class, null, 0d, null),
+    NUMBER("NUMBER", Long.class, null, 0L, Long.MAX_VALUE),
 
     STRING("STRING", String.class, null, null, null),
     NODE("node", String.class, null, null, null) {
@@ -280,7 +280,7 @@ public class Suggestion {
       }
     },
     DISKTYPE(ImplicitSnitch.DISKTYPE, String.class,
-        unmodifiableSet(new HashSet(Arrays.asList("ssd", "rotational"))), null, null, null,
null) {
+        unmodifiableSet(new HashSet(Arrays.asList("ssd", "rotational"))), null, null) {
       @Override
       public void getSuggestions(SuggestionCtx ctx) {
         perNodeSuggestions(ctx);
@@ -294,14 +294,15 @@ public class Suggestion {
     final Boolean additive;
     public final String tagName;
     public final String perReplicaValue;
+    public final String metricsAttribute;
 
     ConditionType(String tagName, Class type, Set<String> vals, Number min, Number
max) {
-      this(tagName, type, vals, min, max, null, null);
+      this(tagName, type, vals, min, max, null, Boolean.TRUE, null);
 
     }
 
     ConditionType(String tagName, Class type, Set<String> vals, Number min, Number
max, String perReplicaValue,
-                  Boolean additive) {
+                  Boolean additive, String metricsAttribute) {
       this.tagName = tagName;
       this.type = type;
       this.vals = vals;
@@ -309,6 +310,7 @@ public class Suggestion {
       this.max = max;
       this.perReplicaValue = perReplicaValue;
       this.additive = additive;
+      this.metricsAttribute = metricsAttribute;
     }
 
     public void getSuggestions(SuggestionCtx ctx) {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/98a4dd29/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
index 5fe9058..c331c73 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrClientNodeStateProvider.java
@@ -122,7 +122,13 @@ public class SolrClientNodeStateProvider implements NodeStateProvider,
MapWriter
       Row.forEachReplica(result, r -> {
         for (String key : keys) {
           if (r.getVariables().containsKey(key)) continue;
-          keyVsReplica.put("solr.core." + r.getCollection() + "." + r.getShard() + "." +
Utils.parseMetricsReplicaName(r.getCollection(), r.getCore()) + ":" + key, new Pair<>(key,
r));
+          String perReplicaAttrKeyPrefix = "solr.core." + r.getCollection() + "." + r.getShard()
+ "." + Utils.parseMetricsReplicaName(r.getCollection(), r.getCore()) + ":";
+          Suggestion.ConditionType tagType = Suggestion.getTagType(key);
+          if(tagType == null) continue;
+          String perReplicaValue = tagType.metricsAttribute;
+          perReplicaValue = perReplicaValue == null ? key : perReplicaValue;
+          perReplicaAttrKeyPrefix += perReplicaValue;
+          keyVsReplica.put(perReplicaAttrKeyPrefix, new Pair<>(key, r));
         }
       });
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/98a4dd29/solr/solrj/src/test/org/apache/solr/client/solrj/cloud/autoscaling/TestPolicy.java
----------------------------------------------------------------------
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 aedc0d5..6d14910 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
@@ -1524,10 +1524,10 @@ public class TestPolicy extends SolrTestCaseJ4 {
         "  replicaInfo : {" +
         "    node1:{}," +
         "    node2:{mycoll1:{" +
-        "        shard1:[{r1:{type:NRT, INDEX.sizeInBytes:900}}]," +
-        "        shard2:[{r2:{type:NRT, INDEX.sizeInBytes:300}}]," +
-        "        shard3:[{r3:{type:NRT, INDEX.sizeInBytes:200}}]," +
-        "        shard4:[{r4:{type:NRT, INDEX.sizeInBytes:100}}]}}}" +
+        "        shard1:[{r1:{type:NRT, INDEX.sizeInGB:900}}]," +
+        "        shard2:[{r2:{type:NRT, INDEX.sizeInGB:300}}]," +
+        "        shard3:[{r3:{type:NRT, INDEX.sizeInGB:200}}]," +
+        "        shard4:[{r4:{type:NRT, INDEX.sizeInGB:100}}]}}}" +
         "    nodeValues : {" +
         "    node1: { node : node1 , cores:0 , freedisk : 2000}," +
         "    node2: { node : node2 , cores:4 , freedisk : 500}}}";


Mime
View raw message