Skip to content

Apache Lucene open-source search software

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

Noble Paul98a4dd29ef61
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2fc228edded..9cdb8bd52c3 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.
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 a4eed4bc640..c2f9d247e64 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) {
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 5fe9058a423..c331c73befe 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));
}
});
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 aedc0d52d0c..6d14910d8ee 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}}}";