diff options
author | Jon Bratseth <bratseth@vespa.ai> | 2023-07-09 19:14:43 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@vespa.ai> | 2023-07-09 19:14:43 +0200 |
commit | c6a0d441b4493f4cdc8a8d3e8cb221f070dfc305 (patch) | |
tree | 7ff24788826b5a5a166b4c5c2759f764165a17f6 /config-provisioning | |
parent | 3168abdd33e16054275719f1c33f3fd474413eac (diff) |
Allocate all groups in one go
With many groups and dynamic allocation allocating group by
group is too slow.
Diffstat (limited to 'config-provisioning')
3 files changed, 10 insertions, 12 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java index 9e8388b6442..36f77a179ca 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java @@ -44,7 +44,7 @@ public class ClusterMembership { this.cluster = ClusterSpec.specification(ClusterSpec.Type.valueOf(components[0]), ClusterSpec.Id.from(components[1])) - .group(ClusterSpec.Group.from(Integer.parseInt(components[2]))) + .group(components[2].isEmpty() ? null : ClusterSpec.Group.from(Integer.parseInt(components[2]))) .vespaVersion(vespaVersion) .exclusive(exclusive) .combinedId(combinedId.map(ClusterSpec.Id::from)) @@ -67,7 +67,7 @@ public class ClusterMembership { protected String toStringValue() { return cluster.type().name() + "/" + cluster.id().value() + - (cluster.group().isPresent() ? "/" + cluster.group().get().index() : "") + + (cluster.group().isPresent() ? "/" + cluster.group().get().index() : "/") + "/" + index + ( cluster.isExclusive() ? "/exclusive" : "") + ( retired ? "/retired" : "") + diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java index ccc24e60edf..4a3045c9cdd 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java @@ -102,19 +102,18 @@ public final class ClusterSpec { /** Creates a ClusterSpec when requesting a cluster */ public static Builder request(Type type, Id id) { - return new Builder(type, id, false); + return new Builder(type, id); } /** Creates a ClusterSpec for an existing cluster, group id and Vespa version needs to be set */ public static Builder specification(Type type, Id id) { - return new Builder(type, id, true); + return new Builder(type, id); } public static class Builder { private final Type type; private final Id id; - private final boolean specification; private Optional<Group> groupId = Optional.empty(); private Optional<DockerImage> dockerImageRepo = Optional.empty(); @@ -124,19 +123,13 @@ public final class ClusterSpec { private ZoneEndpoint zoneEndpoint = ZoneEndpoint.defaultEndpoint; private boolean stateful; - private Builder(Type type, Id id, boolean specification) { + private Builder(Type type, Id id) { this.type = type; this.id = id; - this.specification = specification; this.stateful = type.isContent(); // Default to true for content clusters } public ClusterSpec build() { - if (specification) { - if (groupId.isEmpty()) throw new IllegalArgumentException("groupId is required to be set when creating a ClusterSpec with specification()"); - if (vespaVersion == null) throw new IllegalArgumentException("vespaVersion is required to be set when creating a ClusterSpec with specification()"); - } else - if (groupId.isPresent()) throw new IllegalArgumentException("groupId is not allowed to be set when creating a ClusterSpec with request()"); return new ClusterSpec(type, id, groupId, vespaVersion, exclusive, combinedId, dockerImageRepo, zoneEndpoint, stateful); } diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeAllocationException.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeAllocationException.java index 507d95c1d7b..64d028db7b0 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeAllocationException.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeAllocationException.java @@ -16,6 +16,11 @@ public class NodeAllocationException extends RuntimeException { this.retryable = retryable; } + public NodeAllocationException(String message, Throwable cause, boolean retryable) { + super(message, cause); + this.retryable = retryable; + } + public boolean retryable() { return retryable; } |