diff options
author | Geir Storli <geirst@verizonmedia.com> | 2021-07-16 12:58:15 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2021-07-16 12:58:15 +0000 |
commit | 6b3f45e1972fc0a02922c1a6cfb5c1b9433a413f (patch) | |
tree | b50b6f8ce668a1c0ce3f7f93e0f3557ea4bf1247 /config-model | |
parent | 10974148951ed9690fa7dc9bc7ca5703906cf0fa (diff) |
Add feature flag for min-node-ratio-per-group.
Diffstat (limited to 'config-model')
3 files changed, 28 insertions, 9 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java index 62c192e2c99..a891e16e165 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java @@ -66,6 +66,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea private List<X509Certificate> operatorCertificates = Collections.emptyList(); private double resourceLimitDisk = 0.8; private double resourceLimitMemory = 0.8; + private double minNodeRatioPerGroup = 0.0; @Override public ModelContext.FeatureFlags featureFlags() { return this; } @Override public boolean multitenant() { return multitenant; } @@ -111,6 +112,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea @Override public boolean dryRunOnnxOnSetup() { return dryRunOnnxOnSetup; } @Override public double resourceLimitDisk() { return resourceLimitDisk; } @Override public double resourceLimitMemory() { return resourceLimitMemory; } + @Override public double minNodeRatioPerGroup() { return minNodeRatioPerGroup; } public TestProperties setDryRunOnnxOnSetup(boolean value) { dryRunOnnxOnSetup = value; @@ -274,6 +276,11 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea return this; } + public TestProperties setMinNodeRatioPerGroup(double value) { + this.minNodeRatioPerGroup = value; + return this; + } + public static class Spec implements ConfigServerSpec { private final String hostName; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java index 66ec0d81947..b3d03bbbfdb 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java @@ -35,7 +35,7 @@ public class ClusterControllerConfig extends AbstractConfigProducer<ClusterContr ModelElement clusterTuning = clusterElement.child("tuning"); Integer bucketSplittingMinimumBits = null; - Double minNodeRatioPerGroup = null; + Double minNodeRatioPerGroup = deployState.getProperties().featureFlags().minNodeRatioPerGroup(); if (clusterTuning != null) { tuning = clusterTuning.child("cluster-controller"); minNodeRatioPerGroup = clusterTuning.childAsDouble("min-node-ratio-per-group"); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java index dedf344c546..d17f2d36b9c 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java @@ -17,10 +17,10 @@ import static org.junit.Assert.assertEquals; public class FleetControllerClusterTest { - private ClusterControllerConfig parse(String xml, boolean enableFeedBlockInDistributor) { + private ClusterControllerConfig parse(String xml, TestProperties props) { Document doc = XML.getDocument(xml); - var deployState = new DeployState.Builder().properties( - new TestProperties().enableFeedBlockInDistributor(enableFeedBlockInDistributor)).build(); + var deployState = new DeployState.Builder().properties(props).build(); + boolean enableFeedBlockInDistributor = deployState.getProperties().featureFlags().enableFeedBlockInDistributor(); MockRoot root = new MockRoot("", deployState); var clusterElement = new ModelElement(doc.getDocumentElement()); ModelContext.FeatureFlags featureFlags = new TestProperties(); @@ -37,7 +37,7 @@ public class FleetControllerClusterTest { } private ClusterControllerConfig parse(String xml) { - return parse(xml, true); + return parse(xml, new TestProperties().enableFeedBlockInDistributor(true)); } @Test @@ -153,20 +153,32 @@ public class FleetControllerClusterTest { } private void verifyThatFeatureFlagControlsEnableClusterFeedBlock(boolean flag) { - var config = getConfigForBasicCluster(flag); + var config = getConfigForBasicCluster(new TestProperties().enableFeedBlockInDistributor(flag)); assertEquals(flag, config.enable_cluster_feed_block()); } - private FleetcontrollerConfig getConfigForBasicCluster(boolean enableFeedBlockInDistributor) { + @Test + public void feature_flag_controls_min_node_ratio_per_group() { + verifyFeatureFlagControlsMinNodeRatioPerGroup(0.0, new TestProperties()); + verifyFeatureFlagControlsMinNodeRatioPerGroup(0.3, + new TestProperties().setMinNodeRatioPerGroup(0.3)); + } + + private void verifyFeatureFlagControlsMinNodeRatioPerGroup(double expRatio, TestProperties props) { + var config = getConfigForBasicCluster(props); + assertEquals(expRatio, config.min_node_ratio_per_group(), DELTA); + } + + private FleetcontrollerConfig getConfigForBasicCluster(TestProperties props) { var builder = new FleetcontrollerConfig.Builder(); parse("<cluster id=\"storage\">\n" + " <documents/>\n" + - "</cluster>", enableFeedBlockInDistributor). + "</cluster>", props). getConfig(builder); return new FleetcontrollerConfig(builder); } private FleetcontrollerConfig getConfigForBasicCluster() { - return getConfigForBasicCluster(true); + return getConfigForBasicCluster(new TestProperties().enableFeedBlockInDistributor(true)); } } |