summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerij Fredriksen <freva@users.noreply.github.com>2019-08-14 10:26:26 +0200
committerGitHub <noreply@github.com>2019-08-14 10:26:26 +0200
commit16fbeca959c5952fe0644a675b36f84fc59bfcbe (patch)
tree79df8fe7f7520cb9a510b89ef98e8aff81a81b73
parentecae41755ba21e3c275bcb2811eada31e7753f5b (diff)
parent5bb8a2070aa8b228815e260c3109674be4fcc41c (diff)
Merge pull request #10266 from vespa-engine/hmusum/fix-issue-with-deployment-after-operator-node-changes
Do not try to deploy after operator changes on all config servers
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java
index ab7a565688e..0a8556530e0 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/OperatorChangeApplicationMaintainer.java
@@ -10,9 +10,11 @@ import com.yahoo.vespa.hosted.provision.node.Agent;
import com.yahoo.vespa.hosted.provision.node.History;
import java.time.Duration;
+import java.time.Instant;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -40,11 +42,7 @@ public class OperatorChangeApplicationMaintainer extends ApplicationMaintainer {
.collect(Collectors.groupingBy(node -> node.allocation().get().owner(), Collectors.toList()));
return nodesByApplication.entrySet().stream()
- .filter(entry -> entry.getValue().stream()
- .flatMap(node -> node.history().events().stream())
- .filter(event -> event.agent() == Agent.operator)
- .map(History.Event::at)
- .anyMatch(getLastDeployTime(entry.getKey())::isBefore))
+ .filter(entry -> hasNodesWithChanges(entry.getKey(), entry.getValue()))
.map(Map.Entry::getKey)
.collect(Collectors.toCollection(LinkedHashSet::new));
}
@@ -60,4 +58,15 @@ public class OperatorChangeApplicationMaintainer extends ApplicationMaintainer {
" as a manual change was made to its nodes");
}
+ private boolean hasNodesWithChanges(ApplicationId applicationId, List<Node> nodes) {
+ Optional<Instant> lastDeployTime = deployer().lastDeployTime(applicationId);
+ if (lastDeployTime.isEmpty()) return false;
+
+ return nodes.stream()
+ .flatMap(node -> node.history().events().stream())
+ .filter(event -> event.agent() == Agent.operator)
+ .map(History.Event::at)
+ .anyMatch(e -> lastDeployTime.get().isBefore(e));
+ }
+
}