diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-07-14 18:35:57 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-07-14 18:35:57 +0200 |
commit | 72392e22810a7be8f90e92088d73b5284f0e8c22 (patch) | |
tree | ef8dcfc7c97b15f938f1783d5a2ab5bd7696935b /node-repository | |
parent | 65e56054312a04c8d5cd47f8055e7f953b671d08 (diff) |
No functional changes
Diffstat (limited to 'node-repository')
5 files changed, 17 insertions, 8 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java index 41fa9499353..7fa369da9c6 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/AllocationOptimizer.java @@ -67,6 +67,7 @@ public class AllocationOptimizer { limits, target, current, clusterModel)); var allocatableResources = AllocatableClusterResources.from(next, current.clusterSpec(), limits, hosts, nodeRepository); + if (allocatableResources.isEmpty()) continue; if (bestAllocation.isEmpty() || allocatableResources.get().preferableTo(bestAllocation.get())) bestAllocation = allocatableResources; diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java index d750a3ef737..41a23ac21ff 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Nodes.java @@ -212,12 +212,12 @@ public class Nodes { return setReady(List.of(nodeToReady), agent, reason).get(0); } - /** Reserve nodes. This method does <b>not</b> lock the node repository */ + /** Reserve nodes. This method does <b>not</b> lock the node repository. */ public List<Node> reserve(List<Node> nodes) { return db.writeTo(Node.State.reserved, nodes, Agent.application, Optional.empty()); } - /** Activate nodes. This method does <b>not</b> lock the node repository */ + /** Activate nodes. This method does <b>not</b> lock the node repository. */ public List<Node> activate(List<Node> nodes, NestedTransaction transaction) { return db.writeTo(Node.State.active, nodes, Agent.application, Optional.empty(), transaction); } diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java index 4140588d1c8..d3142b3cc7f 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTest.java @@ -87,8 +87,6 @@ public class AutoscalingTest { tester.assertResources("Scaling down to minimum since usage has gone down significantly", 7, 1, 1.0, 66.7, 66.7, tester.autoscale(application1, cluster1, capacity)); - - var events = tester.nodeRepository().applications().get(application1).get().cluster(cluster1.id()).get().scalingEvents(); } /** We prefer fewer nodes for container clusters as (we assume) they all use the same disk and memory */ diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java index 94b938fc886..f860b3e5d81 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/autoscale/AutoscalingTester.java @@ -61,9 +61,17 @@ class AutoscalingTester { this(zone, hostResources, null); } + public AutoscalingTester(Zone zone, NodeResources hostResources, int hostCount) { + this(zone, hostResources, null, hostCount); + } + public AutoscalingTester(Zone zone, NodeResources hostResources, HostResourcesCalculator resourcesCalculator) { + this(zone, hostResources, resourcesCalculator, 20); + } + + private AutoscalingTester(Zone zone, NodeResources hostResources, HostResourcesCalculator resourcesCalculator, int hostCount) { this(zone, List.of(new Flavor("hostFlavor", hostResources)), resourcesCalculator); - provisioningTester.makeReadyNodes(20, "hostFlavor", NodeType.host, 8); + provisioningTester.makeReadyNodes(hostCount, "hostFlavor", NodeType.host, 8); provisioningTester.activateTenantHosts(); } @@ -71,8 +79,7 @@ class AutoscalingTester { this(zone, flavors, new MockHostResourcesCalculator(zone)); } - private AutoscalingTester(Zone zone, List<Flavor> flavors, - HostResourcesCalculator resourcesCalculator) { + private AutoscalingTester(Zone zone, List<Flavor> flavors, HostResourcesCalculator resourcesCalculator) { provisioningTester = new ProvisioningTester.Builder().zone(zone) .flavors(flavors) .resourcesCalculator(resourcesCalculator) @@ -377,7 +384,7 @@ class AutoscalingTester { public MetricsDb nodeMetricsDb() { return nodeRepository().metricsDb(); } - private static class MockHostResourcesCalculator implements HostResourcesCalculator { + public static class MockHostResourcesCalculator implements HostResourcesCalculator { private final Zone zone; diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java index 5529f63211d..cee80459176 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainerTest.java @@ -178,6 +178,9 @@ public class AutoscalingMaintainerTest { } assertEquals(Cluster.maxScalingEvents, tester.cluster(app1, cluster1).scalingEvents().size()); + assertEquals("The latest rescaling is the last event stored", + tester.clock().instant(), + tester.cluster(app1, cluster1).scalingEvents().get(Cluster.maxScalingEvents - 1).at()); } @Test |