summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2023-08-31 13:46:04 +0200
committerjonmv <venstad@gmail.com>2023-08-31 13:46:04 +0200
commit862909b5a15767c633f9aebee24e8eb224d6e18b (patch)
tree5e386b8d00ed26c1e458ac6c1ae66143360f6118
parent7590df35a54d0f7d2375be68efe5c82dbe71214d (diff)
Reduce threshold from 1 to 0.95, and make deletion race less likely
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentInfoMaintainer.java12
-rw-r--r--vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java2
2 files changed, 9 insertions, 5 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentInfoMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentInfoMaintainer.java
index d8d89177a9e..8ce0cd9f31c 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentInfoMaintainer.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentInfoMaintainer.java
@@ -1,5 +1,6 @@
package com.yahoo.vespa.hosted.controller.maintenance;
+import com.yahoo.vespa.hosted.controller.Application;
import com.yahoo.vespa.hosted.controller.Controller;
import com.yahoo.vespa.hosted.controller.Instance;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
@@ -9,6 +10,7 @@ import com.yahoo.yolean.Exceptions;
import java.time.Duration;
import java.util.Collection;
+import java.util.Map;
/**
* This pulls application deployment information from the node repo on all config servers,
@@ -21,7 +23,7 @@ public class DeploymentInfoMaintainer extends ControllerMaintainer {
private final NodeRepository nodeRepository;
public DeploymentInfoMaintainer(Controller controller, Duration duration) {
- super(controller, duration);
+ super(controller, duration, 0.95);
this.nodeRepository = controller.serviceRegistry().configServer().nodeRepository();
}
@@ -29,9 +31,11 @@ public class DeploymentInfoMaintainer extends ControllerMaintainer {
protected double maintain() {
int attempts = 0;
int failures = 0;
- for (var application : controller().applications().asList()) {
- for (var instance : application.instances().values()) {
+ outer:
+ for (var application : controller().applications().idList()) {
+ for (var instance : controller().applications().getApplication(application).map(Application::instances).orElse(Map.of()).values()) {
for (var deployment : instanceDeployments(instance)) {
+ if (shuttingDown()) break outer;
attempts++;
if ( ! updateDeploymentInfo(deployment))
failures++;
@@ -43,7 +47,7 @@ public class DeploymentInfoMaintainer extends ControllerMaintainer {
private Collection<DeploymentId> instanceDeployments(Instance instance) {
return instance.deployments().keySet().stream()
- .filter(zoneId -> !zoneId.environment().isTest())
+ .filter(zoneId -> ! zoneId.environment().isTest())
.map(zoneId -> new DeploymentId(instance.id(), zoneId))
.toList();
}
diff --git a/vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java b/vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java
index 7fa591a88ba..cdd0e0c4ff7 100644
--- a/vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java
+++ b/vespajlib/src/main/java/com/yahoo/concurrent/maintenance/Maintainer.java
@@ -108,7 +108,7 @@ public abstract class Maintainer implements Runnable {
/** Convenience methods to convert attempts and failures into a success factor deviation from the baseline, and return */
protected final double asSuccessFactorDeviation(int attempts, int failures) {
- double factor = attempts == 0 ? 1.0 : 1 - (double)failures / attempts;
+ double factor = attempts == 0 ? 1.0 : 1 - (double) failures / attempts;
return new BigDecimal(factor - successFactorBaseline).setScale(2, RoundingMode.HALF_UP).doubleValue();
}