aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2021-09-29 20:40:10 +0200
committerGitHub <noreply@github.com>2021-09-29 20:40:10 +0200
commit22d3521aa825bc21f8ff3fd86862ce7d9cf40e7f (patch)
treebd9d2500d368ea789668c23dcd807cac8de285cd
parent1bc2cca4b527bb9a5a8c67744b0796c9fafbe024 (diff)
parent0c266792971f88d6b51a92321e7b39bf214c815b (diff)
Merge pull request #19356 from vespa-engine/freva/allow-more-inplacev7.476.1v7.475.17
Allow in-place resize for non-content nodes when decreasing resources…
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java1
-rw-r--r--node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeSpec.java9
-rw-r--r--node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/InPlaceResizeProvisionTest.java27
3 files changed, 18 insertions, 19 deletions
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java
index e506216f13d..1f618a18d24 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodePrioritizer.java
@@ -191,6 +191,7 @@ public class NodePrioritizer {
parent.exclusiveToApplicationId().isEmpty()
&& requestedNodes.canResize(node.resources(),
capacity.availableCapacityOf(parent),
+ clusterSpec.type(),
topologyChange,
currentClusterSize));
} else {
diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeSpec.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeSpec.java
index a84f35a314b..48cfe671248 100644
--- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeSpec.java
+++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/NodeSpec.java
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.provisioning;
+import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.Flavor;
import com.yahoo.config.provision.NodeFlavors;
import com.yahoo.config.provision.NodeResources;
@@ -72,7 +73,7 @@ public interface NodeSpec {
* in-place to resources in this spec.
*/
default boolean canResize(NodeResources currentNodeResources, NodeResources currentSpareHostResources,
- boolean hasTopologyChange, int currentClusterSize) {
+ ClusterSpec.Type type, boolean hasTopologyChange, int currentClusterSize) {
return false;
}
@@ -153,12 +154,12 @@ public interface NodeSpec {
@Override
public boolean canResize(NodeResources currentNodeResources, NodeResources currentSpareHostResources,
- boolean hasTopologyChange, int currentClusterSize) {
+ ClusterSpec.Type type, boolean hasTopologyChange, int currentClusterSize) {
// Never allow in-place resize when also changing topology or decreasing cluster size
if (hasTopologyChange || count < currentClusterSize) return false;
- // Do not allow increasing cluster size and decreasing node resources at the same time
- if (count > currentClusterSize && !requestedNodeResources.satisfies(currentNodeResources.justNumbers()))
+ // Do not allow increasing cluster size and decreasing node resources at the same time for content nodes
+ if (type.isContent() && count > currentClusterSize && !requestedNodeResources.satisfies(currentNodeResources.justNumbers()))
return false;
// Otherwise, allowed as long as the host can satisfy the new requested resources
diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/InPlaceResizeProvisionTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/InPlaceResizeProvisionTest.java
index 8f07e57a26b..06a9bc9ac12 100644
--- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/InPlaceResizeProvisionTest.java
+++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/InPlaceResizeProvisionTest.java
@@ -29,20 +29,17 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
- * If there is no change in cluster size or topology, any increase in node resource allocation is fine as long as:
- * a. We have the necessary spare resources available on the all hosts used in the cluster
- * b. We have the necessary spare resources available on a subset of the hosts used in the cluster AND
- * also have available capacity to migrate the remaining nodes to different hosts.
- * c. Any decrease in node resource allocation is fine.
+ * Node resources can be increased in-place if
+ * 1. No change to topology
+ * 2. No reduction to cluster size
+ * 3. There is enough spare capacity on host
*
- * If there is an increase in cluster size, this can be combined with increase in resource allocations given there is
- * available resources and new nodes.
+ * Node resources can be decreased in-place if
+ * 1. No change to topology
+ * 2. No reduction to cluster size
+ * 3. For content/combined nodes: No increase to cluster size
*
- * No other changes should be supported at this time, due to risks in complexity and possibly unknowns.
- * Specifically, the following is intentionally not supported by the above changes:
- * a. Decrease in resource allocation combined with cluster size increase
- * b. Change in resource allocation combined with cluster size reduction
- * c. Change in resource allocation combined with cluster topology changes
+ * Node resources are increased if at least one of the components (vcpu, memory, disk, bandwidth) is increased.
*
* @author freva
*/
@@ -218,10 +215,10 @@ public class InPlaceResizeProvisionTest {
public void cannot_inplace_decrease_resources_while_increasing_cluster_size() {
addParentHosts(6, mediumResources.with(fast).with(local));
- new PrepareHelper(tester, app).prepare(container1, 4, 1, mediumResources).activate();
- assertSizeAndResources(container1, 4, new NodeResources(4, 8, 160, 1, fast, local));
+ new PrepareHelper(tester, app).prepare(content1, 4, 1, mediumResources).activate();
+ assertSizeAndResources(content1, 4, new NodeResources(4, 8, 160, 1, fast, local));
- new PrepareHelper(tester, app).prepare(container1, 6, 1, smallResources);
+ new PrepareHelper(tester, app).prepare(content1, 6, 1, smallResources);
}
@Test(expected = OutOfCapacityException.class)