summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2024-01-12 11:49:24 +0100
committerjonmv <venstad@gmail.com>2024-01-12 11:49:24 +0100
commit469d7dc346f3c900953e9cd8110c6fa070ff5e74 (patch)
tree7f905b3da1293c64b7fecb3d98d7d6edbbeca959 /config-model
parent98071980faf792198f218adead74ab2d48e04178 (diff)
Always delay config until after restart when loading models, for restarting clusters
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/Validation.java18
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartChangesDefersConfigChangesTest.java48
2 files changed, 0 insertions, 66 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/Validation.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/Validation.java
index dc7a2651e1f..56b7e6ee0c8 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/Validation.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/Validation.java
@@ -74,8 +74,6 @@ public class Validation {
}
else if (deployState.getPreviousModel().isPresent() && (deployState.getPreviousModel().get() instanceof VespaModel)) {
validateChanges(execution);
- // TODO: Why is this done here? It won't be done on more than one config server?
- deferConfigChangesForClustersToBeRestarted(execution.actions, model);
}
execution.throwIfFailed();
@@ -138,22 +136,6 @@ public class Validation {
new RestartOnDeployForOnnxModelChangesValidator().validate(execution);
}
- private static void deferConfigChangesForClustersToBeRestarted(List<ConfigChangeAction> actions, VespaModel model) {
- Set<ClusterSpec.Id> clustersToBeRestarted = actions.stream()
- .filter(action -> action.getType() == ConfigChangeAction.Type.RESTART)
- .map(action -> action.clusterId())
- .collect(Collectors.toCollection(() -> new LinkedHashSet<>()));
- for (var clusterToRestart : clustersToBeRestarted) {
- var containerCluster = model.getContainerClusters().get(clusterToRestart.value());
- if (containerCluster != null)
- containerCluster.setDeferChangesUntilRestart(true);
-
- var contentCluster = model.getContentClusters().get(clusterToRestart.value());
- if (contentCluster != null)
- contentCluster.setDeferChangesUntilRestart(true);
- }
- }
-
public interface Context {
/** Auxiliary deploy state of the application. */
DeployState deployState();
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartChangesDefersConfigChangesTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartChangesDefersConfigChangesTest.java
deleted file mode 100644
index 35681095144..00000000000
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartChangesDefersConfigChangesTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.vespa.model.application.validation.change;
-
-import com.yahoo.config.model.provision.InMemoryProvisioner;
-import com.yahoo.config.provision.Environment;
-import com.yahoo.config.provision.NodeResources;
-import com.yahoo.container.ComponentsConfig;
-import com.yahoo.vespa.model.VespaModel;
-import com.yahoo.vespa.model.application.validation.ValidationTester;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * @author bratseth
- */
-public class RestartChangesDefersConfigChangesTest {
-
- @Test
- void changes_requiring_restart_defers_config_changes() {
- ValidationTester tester = new ValidationTester(new InMemoryProvisioner(5,
- new NodeResources(1, 3, 9, 1),
- true));
- VespaModel gen1 = tester.deploy(null, getServices(5, 3), Environment.prod, null).getFirst();
-
- // Change node count - no restart
- VespaModel gen2 = tester.deploy(gen1, getServices(4, 3), Environment.prod, null).getFirst();
- var config2 = new ComponentsConfig.Builder();
- gen2.getContainerClusters().get("default").getContainers().get(0).getConfig(config2);
- assertFalse(config2.getApplyOnRestart());
-
- // Change memory amount - requires restart
- VespaModel gen3 = tester.deploy(gen2, getServices(4, 2), Environment.prod, null).getFirst();
- var config3 = new ComponentsConfig.Builder();
- gen3.getContainerClusters().get("default").getContainers().get(0).getConfig(config3);
- assertTrue(config3.getApplyOnRestart());
- }
-
- private static String getServices(int nodes, int memory) {
- return "<services version='1.0'>" +
- " <container id='default' version='1.0'>" +
- " <nodes count='" + nodes + "'><resources vcpu='1' memory='" + memory + "Gb' disk='9Gb'/></nodes>" +
- " </container>" +
- "</services>";
- }
-
-}