From 76501a79f187cdcbebb1b4f37072a002cf0ef143 Mon Sep 17 00:00:00 2001 From: HÃ¥kon Hallingstad Date: Wed, 11 Aug 2021 12:30:49 +0200 Subject: Enable group-suspension with permanent suspension This will enable the same per-cluster policy for "permanently suspending" a host (i.e. removing it from an application, typically because it is wantToRetire and retired), as the policy for suspending a host (typically for upgrade). The major difference is that the new policy allows for permanently remove >1 content node at a time, if they are within the same group. Guarded by a new flag group-suspension-in-permanent-suspend, enabled by default. The old and unused flag group-suspension is removed. --- .../orchestrator/policy/HostedVespaClusterPolicy.java | 16 +++++++--------- .../vespa/orchestrator/model/ClusterApiImplTest.java | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'orchestrator') 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 e3989fd86d4..87e7fa31796 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 @@ -5,7 +5,6 @@ import com.yahoo.config.provision.Zone; import com.yahoo.vespa.applicationmodel.ClusterId; import com.yahoo.vespa.applicationmodel.ServiceType; import com.yahoo.vespa.flags.BooleanFlag; -import com.yahoo.vespa.flags.FetchVector; import com.yahoo.vespa.flags.FlagSource; import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.orchestrator.model.ClusterApi; @@ -18,26 +17,22 @@ import static com.yahoo.vespa.orchestrator.policy.HostedVespaPolicy.ENOUGH_SERVI public class HostedVespaClusterPolicy implements ClusterPolicy { - private final BooleanFlag groupSuspensionFlag; + private final BooleanFlag groupSuspensionInPermanentSuspendFlag; private final Zone zone; public HostedVespaClusterPolicy(FlagSource flagSource, Zone zone) { // Note that the "group" in this flag refers to hierarchical groups of a content cluster. - this.groupSuspensionFlag = Flags.GROUP_SUSPENSION.bindTo(flagSource); + this.groupSuspensionInPermanentSuspendFlag = Flags.GROUP_SUSPENSION_IN_PERMANENT_SUSPEND.bindTo(flagSource); this.zone = zone; } @Override public SuspensionReasons verifyGroupGoingDownIsFine(ClusterApi clusterApi) throws HostStateChangeDeniedException { - boolean enableContentGroupSuspension = groupSuspensionFlag - .with(FetchVector.Dimension.APPLICATION_ID, clusterApi.getApplication().applicationId().serializedForm()) - .value(); - if (clusterApi.noServicesOutsideGroupIsDown()) { return SuspensionReasons.nothingNoteworthy(); } - int percentageOfServicesAllowedToBeDown = getConcurrentSuspensionLimit(clusterApi, enableContentGroupSuspension).asPercentage(); + int percentageOfServicesAllowedToBeDown = getConcurrentSuspensionLimit(clusterApi, true).asPercentage(); if (clusterApi.percentageOfServicesDownIfGroupIsAllowedToBeDown() <= percentageOfServicesAllowedToBeDown) { return SuspensionReasons.nothingNoteworthy(); } @@ -69,7 +64,10 @@ public class HostedVespaClusterPolicy implements ClusterPolicy { return; } - int percentageOfServicesAllowedToBeDown = getConcurrentSuspensionLimit(clusterApi, false).asPercentage(); + boolean enableContentGroupSuspension = groupSuspensionInPermanentSuspendFlag.value(); + + int percentageOfServicesAllowedToBeDown = getConcurrentSuspensionLimit(clusterApi, enableContentGroupSuspension) + .asPercentage(); if (clusterApi.percentageOfServicesDownIfGroupIsAllowedToBeDown() <= percentageOfServicesAllowedToBeDown) { return; } diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java index 237d418aae5..cd703dad97f 100644 --- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java +++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/model/ClusterApiImplTest.java @@ -124,7 +124,7 @@ public class ClusterApiImplTest { "Services down on resumed hosts: [1 missing config server].")); } - flagSource.withBooleanFlag(Flags.GROUP_SUSPENSION.id(), true); + flagSource.withBooleanFlag(Flags.GROUP_SUSPENSION_IN_PERMANENT_SUSPEND.id(), true); try { policy.verifyGroupGoingDownIsFine(clusterApi); @@ -156,7 +156,7 @@ public class ClusterApiImplTest { "Services down on resumed hosts: [1 missing config server host].")); } - flagSource.withBooleanFlag(Flags.GROUP_SUSPENSION.id(), true); + flagSource.withBooleanFlag(Flags.GROUP_SUSPENSION_IN_PERMANENT_SUSPEND.id(), true); try { policy.verifyGroupGoingDownIsFine(clusterApi); -- cgit v1.2.3