diff options
3 files changed, 13 insertions, 7 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidator.java index d6731c86607..5d56a27321a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidator.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidator.java @@ -16,7 +16,8 @@ import java.util.Optional; import java.util.stream.Collectors; /** - * Emits restart change actions for clusters where the node resources are changed. + * Emits restart change actions for clusters where the node resources are changed in a way + * which requires a "restart" (container recreation) to take effect. * Nodes will restart on their own on this condition but we want to emit restart actions to * defer applying new config until restart. * @@ -31,12 +32,16 @@ public class NodeResourceChangeValidator implements ChangeValidator { Optional<NodeResources> currentResources = resourcesOf(clusterId, current); Optional<NodeResources> nextResources = resourcesOf(clusterId, next); if (currentResources.isEmpty() || nextResources.isEmpty()) continue; // new or removed cluster - if ( ! currentResources.equals(nextResources)) + if ( changeRequiresRestart(currentResources.get(), nextResources.get())) restartActions.addAll(createRestartActionsFor(clusterId, current)); } return restartActions; } + private boolean changeRequiresRestart(NodeResources currentResources, NodeResources nextResources) { + return currentResources.memoryGb() != nextResources.memoryGb(); + } + private Optional<NodeResources> resourcesOf(ClusterSpec.Id clusterId, VespaModel model) { return model.allocatedHosts().getHosts().stream().filter(host -> host.membership().isPresent()) .filter(host -> host.membership().get().cluster().id().equals(clusterId)) diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidatorTest.java index fa4887cd8ee..ecf026e7d88 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/NodeResourceChangeValidatorTest.java @@ -61,7 +61,7 @@ public class NodeResourceChangeValidatorTest { Clock.systemUTC().instant()); } - private static VespaModel model(int vcpu1, int vcpu2, int vcpu3, int vcpu4) { + private static VespaModel model(int mem1, int mem2, int mem3, int mem4) { var properties = new TestProperties(); properties.setHostedVespa(true); var deployState = new DeployState.Builder().properties(properties) @@ -72,17 +72,17 @@ public class NodeResourceChangeValidatorTest { "<services version='1.0'>\n" + " <container id='container1' version='1.0'>\n" + " <nodes count='1'>\n" + - " <resources vcpu='" + vcpu1 + "' memory='10Gb' disk='100Gb'/>" + + " <resources vcpu='1' memory='" + mem1 + "Gb' disk='100Gb'/>" + " </nodes>\n" + " </container>\n" + " <container id='container2' version='1.0'>\n" + " <nodes count='2'>\n" + - " <resources vcpu='" + vcpu2 + "' memory='10Gb' disk='100Gb'/>" + + " <resources vcpu='1' memory='" + mem2 + "Gb' disk='100Gb'/>" + " </nodes>\n" + " </container>\n" + " <content id='content1' version='1.0'>\n" + " <nodes count='3'>\n" + - " <resources vcpu='" + vcpu3 + "' memory='10Gb' disk='100Gb'/>" + + " <resources vcpu='1' memory='" + mem3 + "Gb' disk='100Gb'/>" + " </nodes>\n" + " <documents>\n" + " <document mode='index' type='test'/>\n" + @@ -91,7 +91,7 @@ public class NodeResourceChangeValidatorTest { " </content>\n" + " <content id='content2' version='1.0'>\n" + " <nodes count='4'>\n" + - " <resources vcpu='" + vcpu4 + "' memory='10Gb' disk='100Gb'/>" + + " <resources vcpu='1' memory='" + mem4 + "Gb' disk='100Gb'/>" + " </nodes>\n" + " <documents>\n" + " <document mode='streaming' type='test'/>\n" + diff --git a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerEngine.java b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerEngine.java index 6c831cef7d7..1f2a35a2a38 100644 --- a/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerEngine.java +++ b/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerEngine.java @@ -44,6 +44,7 @@ import java.util.logging.Logger; import java.util.stream.Stream; public class DockerEngine implements ContainerEngine { + private static final Logger logger = Logger.getLogger(DockerEngine.class.getName()); static final String LABEL_NAME_MANAGEDBY = "com.yahoo.vespa.managedby"; |