aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2023-02-19 16:23:56 +0100
committerJon Bratseth <bratseth@gmail.com>2023-02-19 16:23:56 +0100
commit90714a0c0b5758c545e36a689c6eed75e1b4ae15 (patch)
tree8afe2348f491542db087ac53990278dec2fb950f
parent5a45774d4fd321c59f854cc958d3375355eaff91 (diff)
Avoid retired nodes where appropriate
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java4
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java4
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java5
3 files changed, 6 insertions, 7 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java
index 410a4fcb773..4020166a132 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/Autoscaler.java
@@ -57,7 +57,7 @@ public class Autoscaler {
private Autoscaling autoscale(Application application, Cluster cluster, NodeList clusterNodes, Limits limits) {
ClusterModel clusterModel = new ClusterModel(nodeRepository.zone(),
application,
- clusterNodes.clusterSpec(),
+ clusterNodes.not().retired().clusterSpec(),
cluster,
clusterNodes,
nodeRepository.metricsDb(),
@@ -70,7 +70,7 @@ public class Autoscaler {
if ( ! clusterModel.isStable(nodeRepository))
return Autoscaling.dontScale(Status.waiting, "Cluster change in progress", clusterModel);
- var currentAllocation = new AllocatableClusterResources(clusterNodes, nodeRepository);
+ var currentAllocation = new AllocatableClusterResources(clusterNodes.not().retired(), nodeRepository);
Optional<AllocatableClusterResources> bestAllocation =
allocationOptimizer.findBestAllocation(clusterModel.loadAdjustment(), currentAllocation, clusterModel, limits);
if (bestAllocation.isEmpty())
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java
index d122f719eff..6cc9c48883b 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/autoscale/ClusterModel.java
@@ -270,14 +270,14 @@ public class ClusterModel {
/** The number of nodes this cluster has, or will have if not deployed yet. */
// TODO: Make this the deployed, not current count
private int nodeCount() {
- if ( ! nodes.isEmpty()) return (int)nodes.stream().count();
+ if ( ! nodes.isEmpty()) return (int)nodes.not().retired().stream().count();
return cluster.minResources().nodes();
}
/** The number of groups this cluster has, or will have if not deployed yet. */
// TODO: Make this the deployed, not current count
private int groupCount() {
- if ( ! nodes.isEmpty()) return (int)nodes.stream().mapToInt(node -> node.allocation().get().membership().cluster().group().get().index()).distinct().count();
+ if ( ! nodes.isEmpty()) return (int)nodes.not().retired().stream().mapToInt(node -> node.allocation().get().membership().cluster().group().get().index()).distinct().count();
return cluster.minResources().groups();
}
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
index f792c511adb..613097a71a7 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/AutoscalingMaintainer.java
@@ -75,18 +75,17 @@ public class AutoscalingMaintainer extends NodeRepositoryMaintainer {
var autoscaling = autoscaler.autoscale(application.get(), updatedCluster, clusterNodes);
// 1. Update cluster info
- updatedCluster = updateCompletion(cluster.get(), clusterNodes);
if ( ! autoscaling.isEmpty()) // Ignore empties we'll get from servers recently started
updatedCluster = updatedCluster.withTarget(autoscaling);
applications().put(application.get().with(updatedCluster), lock);
- var current = new AllocatableClusterResources(clusterNodes, nodeRepository()).advertisedResources();
+ var current = new AllocatableClusterResources(clusterNodes.not().retired(), nodeRepository()).advertisedResources();
if (autoscaling.resources().isPresent() && !current.equals(autoscaling.resources().get())) {
// 2. Also autoscale
try (MaintenanceDeployment deployment = new MaintenanceDeployment(applicationId, deployer, metric, nodeRepository())) {
if (deployment.isValid()) {
deployment.activate();
- logAutoscaling(current, autoscaling.resources().get(), applicationId, clusterNodes);
+ logAutoscaling(current, autoscaling.resources().get(), applicationId, clusterNodes.not().retired());
}
}
}