aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Marius Venstad <venstad@gmail.com>2018-05-20 16:24:43 +0200
committerJon Marius Venstad <venstad@gmail.com>2018-05-20 16:24:43 +0200
commit904a347a61df65ac186c64b1316e286c09ec6d5d (patch)
tree059369396ade3b4a1b2519e6b52fb86fb010962c /controller-server
parente8e944725066e936691ac029bc384c9cc5e013e8 (diff)
Split deploy and converged check, fix error
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java29
1 files changed, 16 insertions, 13 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java
index 79c77992291..25b501e94fa 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/SystemUpgrader.java
@@ -37,32 +37,35 @@ public class SystemUpgrader extends Maintainer {
if (!target.isPresent()) {
return;
}
- deploy(SystemApplication.all(), target.get());
+ converge(SystemApplication.all(), target.get());
}
- /** Deploy a list of system applications on given version */
- private void deploy(List<SystemApplication> applications, Version target) {
+ /** Deploy a list of system applications until they converge on the given version */
+ private void converge(List<SystemApplication> applications, Version target) {
for (List<ZoneId> zones : controller().zoneRegistry().upgradePolicy().asList()) {
- int done = 0;
- for (SystemApplication application : applications)
- if (application.prerequisites().stream().allMatch(prerequisite -> deploy(zones, prerequisite, target))
- && deploy(zones, application, target))
- done++;
- if (done < applications.size()) return;
+ boolean converged = true;
+ for (SystemApplication application : applications) {
+ if (application.prerequisites().stream().allMatch(prerequisite -> converged(zones, prerequisite, target))) {
+ deploy(zones, application, target);
+ }
+ converged &= converged(zones, application, target);
+ }
+ if (!converged) break;
}
}
/** Deploy application on given version. Returns true when all allocated nodes are on requested version */
- private boolean deploy(List<ZoneId> zones, SystemApplication application, Version target) {
- boolean completed = true;
+ private void deploy(List<ZoneId> zones, SystemApplication application, Version target) {
for (ZoneId zone : zones) {
if (!wantedVersion(zone, application.id(), target).equals(target)) {
log.info(String.format("Deploying %s version %s in %s", application.id(), target, zone));
controller().applications().deploy(application, zone, target);
}
- completed = completed && currentVersion(zone, application.id(), target).equals(target);
}
- return completed;
+ }
+
+ private boolean converged(List<ZoneId> zones, SystemApplication application, Version target) {
+ return zones.stream().allMatch(zone -> currentVersion(zone, application.id(), target).equals(target));
}
private Version wantedVersion(ZoneId zone, ApplicationId application, Version defaultVersion) {