diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2024-02-28 09:27:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-28 09:27:30 +0100 |
commit | 6a749a1a167dced0c8450ccd891ccdac30407401 (patch) | |
tree | 5f90458d82b539b79435fb1b981071279265e6a5 /node-repository | |
parent | 4934b11a34f356da18d5c2b272811469b988f470 (diff) | |
parent | 37e96c23409cee652cca0ffec21f39950dd28d6e (diff) |
Merge pull request #30426 from vespa-engine/jonmv/random-simplification
Random simplification in nodes check
Diffstat (limited to 'node-repository')
-rw-r--r-- | node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java index 9bf7d928138..2ebc2350542 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/Activator.java @@ -20,7 +20,6 @@ import com.yahoo.vespa.hosted.provision.node.Allocation; import java.time.Instant; import java.util.ArrayList; import java.util.Collection; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; @@ -77,11 +76,11 @@ class Activator { NodeList oldActive = applicationNodes.state(Node.State.active); // All nodes active now NodeList continuedActive = oldActive.matching(node -> hostnames.contains(node.hostname())); NodeList newActive = withHostInfo(continuedActive, hosts, activationTime).and(reserved); // All nodes that will be active when this is committed - if ( ! containsAll(hostnames, newActive)) + if ( ! newActive.hostnames().containsAll(hostnames)) throw new RuntimeException("Activation of " + application + " failed, could not find all requested hosts." + - "\nRequested: " + hosts + - "\nReserved: " + reserved.hostnames() + - "\nActive: " + oldActive.hostnames()); + "\nRequested: " + hosts + + "\nReserved: " + reserved.hostnames() + + "\nActive: " + oldActive.hostnames()); validateParentHosts(application, allNodes, reserved); @@ -195,13 +194,6 @@ class Activator { } } - private boolean containsAll(Set<String> hosts, NodeList nodes) { - Set<String> notFoundHosts = new HashSet<>(hosts); - for (Node node : nodes) - notFoundHosts.remove(node.hostname()); - return notFoundHosts.isEmpty(); - } - /** Returns the input nodes with the changes resulting from applying the settings in hosts to the given list of nodes. */ private NodeList withHostInfo(NodeList nodes, Collection<HostSpec> hosts, Instant at) { List<Node> updated = new ArrayList<>(); |