diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2020-02-10 11:18:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-10 11:18:13 +0100 |
commit | ea2913f09faa61641679a8c0a4d28f076bc4e43f (patch) | |
tree | 659a59ccc393bac14dd9a285a423c2a1fe8fe102 /node-repository | |
parent | 83ab3e59bfc00c35deae3d8138f407553fdc38b0 (diff) | |
parent | a8c2ea5ba90b6a407a04202b0d2b27fd1a7208d4 (diff) |
Merge pull request #12107 from vespa-engine/freva/remove-in-place-flag
Remove enable-in-place-resize flag
Diffstat (limited to 'node-repository')
3 files changed, 11 insertions, 35 deletions
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> hostProvisioner; private final HostResourcesCalculator hostResourcesCalculator; private final BooleanFlag dynamicProvisioningEnabledFlag; - private final BooleanFlag enableInPlaceResize; private final ListFlag<PreprovisionCapacity> preprovisionCapacityFlag; public GroupPreparer(NodeRepository nodeRepository, Optional<HostProvisioner> 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<Node> 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<Node> 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<String> 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() { |