diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-11-12 11:23:22 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-11-12 11:23:22 +0100 |
commit | d6d498325eb6b5334ce3b6b10f23f9c91c8d0636 (patch) | |
tree | d14573db83c4178cca1af72b75344e90c55753bc | |
parent | aab4eda79533ac020fc73b4d167601fb4a3bcbc6 (diff) |
Allow removing half of the cluster controllers
4 files changed, 14 insertions, 8 deletions
diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApi.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApi.java index 025d21316ef..e9bb4984c2e 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApi.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApi.java @@ -7,6 +7,7 @@ import com.yahoo.vespa.applicationmodel.ServiceType; import java.util.Optional; public interface ClusterApi { + ApplicationApi getApplication(); NodeGroup getNodeGroup(); @@ -27,4 +28,5 @@ public interface ClusterApi { String servicesDownAndNotInGroupDescription(); String nodesAllowedToBeDownNotInGroupDescription(); + } diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java index eb69f1a94a9..7b72b4e970d 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/model/ClusterApiImpl.java @@ -1,14 +1,12 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.orchestrator.model; -import com.yahoo.vespa.applicationmodel.ApplicationInstanceId; import com.yahoo.vespa.applicationmodel.ClusterId; import com.yahoo.vespa.applicationmodel.HostName; import com.yahoo.vespa.applicationmodel.ServiceCluster; import com.yahoo.vespa.applicationmodel.ServiceInstance; import com.yahoo.vespa.applicationmodel.ServiceStatus; import com.yahoo.vespa.applicationmodel.ServiceType; -import com.yahoo.vespa.applicationmodel.TenantId; import com.yahoo.vespa.orchestrator.controller.ClusterControllerClientFactory; import com.yahoo.vespa.orchestrator.status.HostStatus; @@ -22,6 +20,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; class ClusterApiImpl implements ClusterApi { + private final ApplicationApi applicationApi; private final ServiceCluster serviceCluster; private final NodeGroup nodeGroup; @@ -144,8 +143,7 @@ class ClusterApiImpl implements ClusterApi { .toString(); } - private Optional<StorageNode> storageNodeInGroup( - Predicate<ServiceInstance> storageServicePredicate) { + private Optional<StorageNode> storageNodeInGroup(Predicate<ServiceInstance> storageServicePredicate) { if (!VespaModelUtil.isStorage(serviceCluster)) { return Optional.empty(); } diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ConcurrentSuspensionLimitForCluster.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ConcurrentSuspensionLimitForCluster.java index 215d9ed1b2d..ce90d5d96e1 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ConcurrentSuspensionLimitForCluster.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/ConcurrentSuspensionLimitForCluster.java @@ -5,9 +5,11 @@ package com.yahoo.vespa.orchestrator.policy; * How many nodes can suspend concurrently, at most. */ public enum ConcurrentSuspensionLimitForCluster { + ONE_NODE(0), TEN_PERCENT(10), TWENTY_PERCENT(20), + FIFTY_PERCENT(50), ALL_NODES(100); int percentage; diff --git a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaClusterPolicy.java b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaClusterPolicy.java index 065defec1cd..1e895d0e757 100644 --- a/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaClusterPolicy.java +++ b/orchestrator/src/main/java/com/yahoo/vespa/orchestrator/policy/HostedVespaClusterPolicy.java @@ -7,9 +7,9 @@ import com.yahoo.vespa.orchestrator.model.VespaModelUtil; import static com.yahoo.vespa.orchestrator.policy.HostedVespaPolicy.ENOUGH_SERVICES_UP_CONSTRAINT; public class HostedVespaClusterPolicy implements ClusterPolicy { + @Override - public void verifyGroupGoingDownIsFine(ClusterApi clusterApi) - throws HostStateChangeDeniedException { + public void verifyGroupGoingDownIsFine(ClusterApi clusterApi) throws HostStateChangeDeniedException { if (clusterApi.noServicesOutsideGroupIsDown()) { return; } @@ -36,8 +36,7 @@ public class HostedVespaClusterPolicy implements ClusterPolicy { } @Override - public void verifyGroupGoingDownPermanentlyIsFine(ClusterApi clusterApi) - throws HostStateChangeDeniedException { + public void verifyGroupGoingDownPermanentlyIsFine(ClusterApi clusterApi) throws HostStateChangeDeniedException { // This policy is similar to verifyGroupGoingDownIsFine, except that services being down in the group // is no excuse to allow suspension (like it is for verifyGroupGoingDownIsFine), since if we grant // suspension in this case they will permanently be down/removed. @@ -68,6 +67,11 @@ public class HostedVespaClusterPolicy implements ClusterPolicy { return ConcurrentSuspensionLimitForCluster.ONE_NODE; } + if (VespaModelUtil.CLUSTER_CONTROLLER_SERVICE_TYPE.equals(clusterApi.serviceType())) { + // All nodes have all state and we need to be able to remove the half that are retired on cluster migration + return ConcurrentSuspensionLimitForCluster.FIFTY_PERCENT; + } + if (VespaModelUtil.METRICS_PROXY_SERVICE_TYPE.equals(clusterApi.serviceType())) { return ConcurrentSuspensionLimitForCluster.ALL_NODES; } |