aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2023-01-09 10:11:17 +0100
committerGitHub <noreply@github.com>2023-01-09 10:11:17 +0100
commit5d8e9c2207b17718564ff8857d2ffed0bb825fab (patch)
treee45a26c887f543bb3edac9aa0d3f8d6d565f7c69
parent9fbd8f8cd4268ff92a29c91f42fa0e8ed5b656fc (diff)
parentcd42e7baa4bdeed028c1690c2371b0f05655fbe0 (diff)
Merge pull request #25446 from vespa-engine/hmusum/remove-minCount
minCount in SharedHost is not used anymore, simplify
-rw-r--r--flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java30
-rw-r--r--flags/src/test/java/com/yahoo/vespa/flags/PermanentFlagsTest.java3
-rw-r--r--flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java4
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java4
4 files changed, 6 insertions, 35 deletions
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java
index 2311c7cbf40..0d05eb1ae96 100644
--- a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java
+++ b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java
@@ -20,25 +20,20 @@ import java.util.Objects;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class SharedHost {
- private final int DEFAULT_MIN_COUNT = 0;
private final List<HostResources> resources;
- private final int minCount;
public static SharedHost createDisabled() {
- return new SharedHost(null, null);
+ return new SharedHost(null);
}
/**
* @param resourcesOrNull the resources of the shared host (or several to support e.g. tiers or
* fast/slow disks separately)
- * @param minCountOrNull the minimum number of shared hosts
*/
@JsonCreator
- public SharedHost(@JsonProperty("resources") List<HostResources> resourcesOrNull,
- @JsonProperty("min-count") Integer minCountOrNull) {
+ public SharedHost(@JsonProperty("resources") List<HostResources> resourcesOrNull) {
this.resources = resourcesOrNull == null ? List.of() : List.copyOf(resourcesOrNull);
- this.minCount = requireNonNegative(minCountOrNull, DEFAULT_MIN_COUNT, "min-count");
}
@JsonGetter("resources")
@@ -46,11 +41,6 @@ public class SharedHost {
return resources.isEmpty() ? null : resources;
}
- @JsonGetter("min-count")
- public Integer getMinCountOrNull() {
- return minCount == DEFAULT_MIN_COUNT ? null : minCount;
- }
-
@JsonIgnore
public boolean isEnabled(String clusterType) {
return resources.stream().anyMatch(hr -> hr.satisfiesClusterType(clusterType));
@@ -61,11 +51,6 @@ public class SharedHost {
return resources;
}
- @JsonIgnore
- public int getMinCount() {
- return minCount;
- }
-
@Override
public String toString() {
return resources.toString();
@@ -84,15 +69,4 @@ public class SharedHost {
return Objects.hash(resources);
}
- private int requireNonNegative(Integer integerOrNull, int defaultValue, String fieldName) {
- if (integerOrNull == null) {
- return defaultValue;
- }
-
- if (integerOrNull < 0) {
- throw new IllegalArgumentException(fieldName + " cannot be negative");
- }
-
- return integerOrNull;
- }
}
diff --git a/flags/src/test/java/com/yahoo/vespa/flags/PermanentFlagsTest.java b/flags/src/test/java/com/yahoo/vespa/flags/PermanentFlagsTest.java
index 8cac286be5e..903b0d899e2 100644
--- a/flags/src/test/java/com/yahoo/vespa/flags/PermanentFlagsTest.java
+++ b/flags/src/test/java/com/yahoo/vespa/flags/PermanentFlagsTest.java
@@ -17,8 +17,7 @@ class PermanentFlagsTest {
public void testSharedHostFlag() {
SharedHost sharedHost = new SharedHost(List.of(new HostResources(4.0, 16.0, 50.0, 0.3,
"fast", "local", "admin",
- 10, "x86_64")),
- null);
+ 10, "x86_64")));
testGeneric(PermanentFlags.SHARED_HOST, sharedHost);
}
diff --git a/flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java b/flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java
index 1c8fbc41d35..4726726e70e 100644
--- a/flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java
+++ b/flags/src/test/java/com/yahoo/vespa/flags/custom/SharedHostTest.java
@@ -14,10 +14,10 @@ public class SharedHostTest {
void serialization() throws IOException {
verifySerialization(new SharedHost(List.of(
new HostResources(1.0, 2.0, 3.0, 4.0, "fast", "remote",
- "container", 5, "x86_64")), 6));
+ "container", 5, "x86_64"))));
verifySerialization(new SharedHost(List.of(
new HostResources(1.0, 2.0, 3.0, 4.0, "fast", "remote",
- "admin", 5, "arm64")), null));
+ "admin", 5, "arm64"))));
}
private void verifySerialization(SharedHost sharedHost) throws IOException {
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java
index a43746db6d9..1e1e00a10db 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/Fixture.java
@@ -24,12 +24,10 @@ import com.yahoo.vespa.hosted.provision.applications.Cluster;
import com.yahoo.vespa.hosted.provision.autoscale.awsnodes.AwsHostResourcesCalculatorImpl;
import com.yahoo.vespa.hosted.provision.autoscale.awsnodes.AwsNodeTypes;
import com.yahoo.vespa.hosted.provision.provisioning.HostResourcesCalculator;
-
import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
-import java.util.stream.Collectors;
/**
* Fixture for autoscaling tests.
@@ -246,7 +244,7 @@ public class Fixture {
public Fixture.Builder hostSharingFlag() {
var resources = new HostResources(8.0, 32.0, 100.0, 10.0, "fast", "local", null, 6, "x86_64");
- flagSource.withJacksonFlag(PermanentFlags.SHARED_HOST.id(), new SharedHost(List.of(resources), null), SharedHost.class);
+ flagSource.withJacksonFlag(PermanentFlags.SHARED_HOST.id(), new SharedHost(List.of(resources)), SharedHost.class);
return this;
}