From a8c2ea5ba90b6a407a04202b0d2b27fd1a7208d4 Mon Sep 17 00:00:00 2001 From: Valerij Fredriksen Date: Fri, 7 Feb 2020 10:22:11 +0100 Subject: Remove enable-in-place-resize flag --- flags/src/main/java/com/yahoo/vespa/flags/Flags.java | 6 ------ .../hosted/provision/provisioning/GroupPreparer.java | 12 +++--------- .../provision/provisioning/NodePrioritizer.java | 19 +++++++------------ .../provisioning/InPlaceResizeProvisionTest.java | 15 +-------------- 4 files changed, 11 insertions(+), 41 deletions(-) diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index a8ee5c7fbd7..92f4a542a3e 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -187,12 +187,6 @@ public class Flags { "Takes effect when routing container asks for new config", APPLICATION_ID); - public static final UnboundBooleanFlag ENABLE_IN_PLACE_RESIZE = defineFeatureFlag( - "enable-in-place-resize", false, - "Whether nodes can be resized in-place when certain conditions are met", - "Takes effect on next deployment", - APPLICATION_ID); - public static final UnboundBooleanFlag USE_CONFIG_SERVER_FOR_TESTER_API_CALLS = defineFeatureFlag( "use-config-server-for-tester-api-calls", false, "Whether controller should send requests to tester API through config server (if false) or tester endpoint (if true)", diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java index 6686160982a..3cb6f848f7b 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupPreparer.java @@ -31,7 +31,6 @@ public class GroupPreparer { private final Optional hostProvisioner; private final HostResourcesCalculator hostResourcesCalculator; private final BooleanFlag dynamicProvisioningEnabledFlag; - private final BooleanFlag enableInPlaceResize; private final ListFlag preprovisionCapacityFlag; public GroupPreparer(NodeRepository nodeRepository, Optional hostProvisioner, @@ -40,7 +39,6 @@ public class GroupPreparer { this.hostProvisioner = hostProvisioner; this.hostResourcesCalculator = hostResourcesCalculator; this.dynamicProvisioningEnabledFlag = Flags.ENABLE_DYNAMIC_PROVISIONING.bindTo(flagSource); - this.enableInPlaceResize = Flags.ENABLE_IN_PLACE_RESIZE.bindTo(flagSource); this.preprovisionCapacityFlag = Flags.PREPROVISION_CAPACITY.bindTo(flagSource); } @@ -64,11 +62,7 @@ public class GroupPreparer { List surplusActiveNodes, MutableInteger highestIndex, int spareCount, int wantedGroups) { boolean dynamicProvisioningEnabled = hostProvisioner.isPresent() && dynamicProvisioningEnabledFlag .with(FetchVector.Dimension.APPLICATION_ID, application.serializedForm()) - .value(); - // Do not in-place resize in dynamically provisioned zones - boolean inPlaceResizeEnabled = enableInPlaceResize - .with(FetchVector.Dimension.APPLICATION_ID, application.serializedForm()) - .value() && !dynamicProvisioningEnabled; + .value() && preprovisionCapacityFlag.value().isEmpty(); try (Mutex lock = nodeRepository.lock(application)) { @@ -79,12 +73,12 @@ public class GroupPreparer { LockedNodeList nodeList = nodeRepository.list(allocationLock); NodePrioritizer prioritizer = new NodePrioritizer(nodeList, application, cluster, requestedNodes, spareCount, wantedGroups, nodeRepository.nameResolver(), - hostResourcesCalculator, inPlaceResizeEnabled); + hostResourcesCalculator, dynamicProvisioningEnabled); prioritizer.addApplicationNodes(); prioritizer.addSurplusNodes(surplusActiveNodes); prioritizer.addReadyNodes(); - prioritizer.addNewDockerNodes(dynamicProvisioningEnabled && preprovisionCapacityFlag.value().isEmpty()); + prioritizer.addNewDockerNodes(); // Allocate from the prioritized list NodeAllocation allocation = new NodeAllocation(nodeList, application, cluster, requestedNodes, 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 a5fd37640d8..a0e9141f753 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 @@ -46,13 +46,13 @@ public class NodePrioritizer { private final boolean isDocker; private final boolean isAllocatingForReplacement; private final boolean isTopologyChange; - private final boolean inPlaceResizeEnabled; + private final boolean dynamicProvisioningEnabled; private final int currentClusterSize; private final Set spareHosts; NodePrioritizer(LockedNodeList allNodes, ApplicationId application, ClusterSpec clusterSpec, NodeSpec nodeSpec, int spares, int wantedGroups, NameResolver nameResolver, HostResourcesCalculator hostResourcesCalculator, - boolean inPlaceResizeEnabled) { + boolean dynamicProvisioningEnabled) { this.allNodes = allNodes; this.capacity = new DockerHostCapacity(allNodes, hostResourcesCalculator); this.requestedNodes = nodeSpec; @@ -60,7 +60,7 @@ public class NodePrioritizer { this.application = application; this.nameResolver = nameResolver; this.spareHosts = findSpareHosts(allNodes, capacity, spares); - this.inPlaceResizeEnabled = inPlaceResizeEnabled; + this.dynamicProvisioningEnabled = dynamicProvisioningEnabled; NodeList nodesInCluster = allNodes.owner(application).type(clusterSpec.type()).cluster(clusterSpec.id()); NodeList nonRetiredNodesInCluster = nodesInCluster.not().retired(); @@ -117,20 +117,15 @@ public class NodePrioritizer { } } - /** - * Add a node on each docker host with enough capacity for the requested flavor - * - * @param exclusively whether the ready docker nodes should only be added on hosts that - * already have nodes allocated to this tenant - */ - void addNewDockerNodes(boolean exclusively) { + /** Add a node on each docker host with enough capacity for the requested flavor */ + void addNewDockerNodes() { if ( ! isDocker) return; LockedNodeList candidates = allNodes .filter(node -> node.type() != NodeType.host || ALLOCATABLE_HOST_STATES.contains(node.state())) .filter(node -> node.reservedTo().isEmpty() || node.reservedTo().get().equals(application.tenant())); - if (exclusively) { + if (dynamicProvisioningEnabled) { Set candidateHostnames = candidates.asList().stream() .filter(node -> node.type() == NodeType.tenant) .filter(node -> node.allocation() @@ -218,7 +213,7 @@ public class NodePrioritizer { builder.parent(parent).freeParentCapacity(parentCapacity); if (!isNewNode) - builder.resizable(inPlaceResizeEnabled && requestedNodes.canResize( + builder.resizable(!dynamicProvisioningEnabled && requestedNodes.canResize( node.flavor().resources(), parentCapacity, isTopologyChange, currentClusterSize)); if (spareHosts.contains(parent)) 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 9145cb9d88f..0ad7d37d13b 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 @@ -11,7 +11,6 @@ import com.yahoo.config.provision.NodeType; import com.yahoo.config.provision.OutOfCapacityException; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.Zone; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.flags.InMemoryFlagSource; import com.yahoo.vespa.hosted.provision.Node; import com.yahoo.vespa.hosted.provision.NodeList; @@ -56,8 +55,7 @@ public class InPlaceResizeProvisionTest { private static final ClusterSpec container2 = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("container2"), Version.fromString("7.157.9"), false); private static final ClusterSpec content1 = ClusterSpec.request(ClusterSpec.Type.container, ClusterSpec.Id.from("content1"), Version.fromString("7.157.9"), false); - private final InMemoryFlagSource flagSource = new InMemoryFlagSource() - .withBooleanFlag(Flags.ENABLE_IN_PLACE_RESIZE.id(), true); + private final InMemoryFlagSource flagSource = new InMemoryFlagSource(); private final ProvisioningTester tester = new ProvisioningTester.Builder() .flagSource(flagSource) .zone(new Zone(Environment.prod, RegionName.from("us-east"))).build(); @@ -159,17 +157,6 @@ public class InPlaceResizeProvisionTest { assertTrue("All initial nodes should still be allocated to the application", initialHostnames.isEmpty()); } - @Test(expected = OutOfCapacityException.class) - public void no_in_place_resize_if_flag_not_set() { - flagSource.withBooleanFlag(Flags.ENABLE_IN_PLACE_RESIZE.id(), false); - addParentHosts(4, mediumResources.with(fast).with(local)); - - new PrepareHelper(tester, app).prepare(container1, 4, 1, mediumResources).activate(); - assertClusterSizeAndResources(container1, 4, new NodeResources(4, 8, 16, 1, fast, local)); - - new PrepareHelper(tester, app).prepare(container1, 4, 1, smallResources); - } - @Test(expected = OutOfCapacityException.class) public void cannot_inplace_decrease_resources_while_increasing_cluster_size() { -- cgit v1.2.3