summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Musum <musum@verizonmedia.com>2023-07-04 16:47:10 +0200
committerGitHub <noreply@github.com>2023-07-04 16:47:10 +0200
commitad62ec51457fb8b826b7e379430fadac1a46c71d (patch)
treeb21306585c4e8cd4fa59b649eda04554a0748d11
parentf2157bd7004552ba64090139423f536283a630d8 (diff)
parentb3080e117fdabb6068913fe431ec49af139ec1b7 (diff)
Merge pull request #27626 from vespa-engine/hmusum/support-min-groups-up-ratio
Support groups-allowed-down-ratio
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ClusterControllerConfig.java166
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java4
-rw-r--r--config-model/src/main/resources/schema/content.rnc2
-rw-r--r--config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java127
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/FleetControllerClusterTest.java127
6 files changed, 227 insertions, 201 deletions
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 e2166b263ee..538a1b49d24 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
@@ -12,10 +12,11 @@ import com.yahoo.vespa.model.builder.xml.dom.VespaDomBuilder;
import com.yahoo.vespa.model.content.cluster.ContentCluster;
import com.yahoo.vespa.model.utils.Duration;
import org.w3c.dom.Element;
+
import java.util.Optional;
/**
- * Config generation for common parameters for all fleet controllers.
+ * Config generation for parameters for fleet controllers.
*/
public class ClusterControllerConfig extends AnyConfigProducer implements FleetcontrollerConfig.Producer {
@@ -48,25 +49,13 @@ public class ClusterControllerConfig extends AnyConfigProducer implements Fleetc
clusterControllerTuning = tuning.child("cluster-controller");
}
+ var numberOfLeafGroups = ((ContentCluster) ancestor).getRootGroup().getNumberOfLeafGroups();
var tuningConfig = new ClusterControllerTuningBuilder(clusterControllerTuning,
- minNodeRatioPerGroup,
- bucketSplittingMinimumBits)
+ minNodeRatioPerGroup,
+ bucketSplittingMinimumBits,
+ allowMoreThanOneContentGroupDown,
+ numberOfLeafGroups)
.build();
- if (ancestor instanceof ContentCluster) {
- int numberOfLeafGroups = ((ContentCluster) ancestor).getRootGroup().getNumberOfLeafGroups();
- if (tuningConfig.maxGroupsAllowedDown().isPresent()) {
- Integer maxGroupsAllowedDown = tuningConfig.maxGroupsAllowedDown().get();
- if (deployState.zone().environment().isProduction() && (maxGroupsAllowedDown > numberOfLeafGroups))
- throw new IllegalArgumentException("Cannot set max-groups-allowed-down (" + maxGroupsAllowedDown +
- ") larger than number of groups (" + numberOfLeafGroups + ")");
- } else {
- // Reduce to numberOfLeafGroups for tests or in environments where number of groups are reduced by policy (dev, test, staging, perf)
- tuningConfig = tuningConfig.withMaxGroupsAllowedDown(numberOfLeafGroups);
- }
- } else {
- // Reduce to 1 for tests (ancestor is a mock class)
- tuningConfig = tuningConfig.withMaxGroupsAllowedDown(1);
- }
return new ClusterControllerConfig(ancestor,
clusterName,
@@ -74,6 +63,7 @@ public class ClusterControllerConfig extends AnyConfigProducer implements Fleetc
resourceLimits,
allowMoreThanOneContentGroupDown);
}
+
}
private final String clusterName;
@@ -122,79 +112,83 @@ public class ClusterControllerConfig extends AnyConfigProducer implements Fleetc
public ClusterControllerTuning tuning() {return tuning;}
-private static class ClusterControllerTuningBuilder {
-
- private final Optional<Double> minNodeRatioPerGroup;
- private final Optional<Duration> initProgressTime;
- private final Optional<Duration> transitionTime;
- private final Optional<Long> maxPrematureCrashes;
- private final Optional<Duration> stableStateTimePeriod;
- private final Optional<Double> minDistributorUpRatio;
- private final Optional<Double> minStorageUpRatio;
- private final Optional<Integer> minSplitBits;
- final Optional<Integer> maxGroupsAllowedDown;
-
- ClusterControllerTuningBuilder(ModelElement tuning,
- Optional<Double> minNodeRatioPerGroup,
- Optional<Integer> bucketSplittingMinimumBits) {
- this.minSplitBits = bucketSplittingMinimumBits;
- this.minNodeRatioPerGroup = minNodeRatioPerGroup;
- if (tuning == null) {
- this.initProgressTime = Optional.empty();
- this.transitionTime = Optional.empty();
- this.maxPrematureCrashes = Optional.empty();
- this.stableStateTimePeriod = Optional.empty();
- this.minDistributorUpRatio = Optional.empty();
- this.minStorageUpRatio = Optional.empty();
- this.maxGroupsAllowedDown = Optional.empty();
- } else {
- this.initProgressTime = Optional.ofNullable(tuning.childAsDuration("init-progress-time"));
- this.transitionTime = Optional.ofNullable(tuning.childAsDuration("transition-time"));
- this.maxPrematureCrashes = Optional.ofNullable(tuning.childAsLong("max-premature-crashes"));
- this.stableStateTimePeriod = Optional.ofNullable(tuning.childAsDuration("stable-state-period"));
- this.minDistributorUpRatio = Optional.ofNullable(tuning.childAsDouble("min-distributor-up-ratio"));
- this.minStorageUpRatio = Optional.ofNullable(tuning.childAsDouble("min-storage-up-ratio"));
- this.maxGroupsAllowedDown = Optional.ofNullable(tuning.childAsInteger("max-groups-allowed-down"));
+ private static class ClusterControllerTuningBuilder {
+
+ private final Optional<Double> minNodeRatioPerGroup;
+ private final Optional<Duration> initProgressTime;
+ private final Optional<Duration> transitionTime;
+ private final Optional<Long> maxPrematureCrashes;
+ private final Optional<Duration> stableStateTimePeriod;
+ private final Optional<Double> minDistributorUpRatio;
+ private final Optional<Double> minStorageUpRatio;
+ private final Optional<Integer> minSplitBits;
+ private final Optional<Integer> maxGroupsAllowedDown;
+
+ ClusterControllerTuningBuilder(ModelElement tuning,
+ Optional<Double> minNodeRatioPerGroup,
+ Optional<Integer> bucketSplittingMinimumBits,
+ boolean maxGroupsAllowedDown,
+ int numberOfLeafGroups) {
+ this.minSplitBits = bucketSplittingMinimumBits;
+ this.minNodeRatioPerGroup = minNodeRatioPerGroup;
+ if (tuning == null) {
+ this.initProgressTime = Optional.empty();
+ this.transitionTime = Optional.empty();
+ this.maxPrematureCrashes = Optional.empty();
+ this.stableStateTimePeriod = Optional.empty();
+ this.minDistributorUpRatio = Optional.empty();
+ this.minStorageUpRatio = Optional.empty();
+ this.maxGroupsAllowedDown = Optional.empty();
+ }
+ else {
+ this.initProgressTime = Optional.ofNullable(tuning.childAsDuration("init-progress-time"));
+ this.transitionTime = Optional.ofNullable(tuning.childAsDuration("transition-time"));
+ this.maxPrematureCrashes = Optional.ofNullable(tuning.childAsLong("max-premature-crashes"));
+ this.stableStateTimePeriod = Optional.ofNullable(tuning.childAsDuration("stable-state-period"));
+ this.minDistributorUpRatio = Optional.ofNullable(tuning.childAsDouble("min-distributor-up-ratio"));
+ this.minStorageUpRatio = Optional.ofNullable(tuning.childAsDouble("min-storage-up-ratio"));
+ this.maxGroupsAllowedDown = maxGroupsAllowedDown(tuning, maxGroupsAllowedDown, numberOfLeafGroups);
+ }
}
- }
- private ClusterControllerTuning build() {
- return new ClusterControllerTuning(initProgressTime,
- transitionTime,
- maxPrematureCrashes,
- stableStateTimePeriod,
- minDistributorUpRatio,
- minStorageUpRatio,
- maxGroupsAllowedDown,
- minNodeRatioPerGroup,
- minSplitBits);
- }
-}
+ private static Optional<Integer> maxGroupsAllowedDown(ModelElement tuning, boolean allowMoreThanOneContentGroupDown, int numberOfLeafGroups) {
+ var groupsAllowedDownRatio = tuning.childAsDouble("groups-allowed-down-ratio");
+
+ if (groupsAllowedDownRatio != null) {
+ if (groupsAllowedDownRatio < 0 || groupsAllowedDownRatio > 1)
+ throw new IllegalArgumentException("groups-allowed-down-ratio must be between 0 and 1, got " + groupsAllowedDownRatio);
+
+ var maxGroupsAllowedDown = Math.max(1, (int) Math.floor(groupsAllowedDownRatio * numberOfLeafGroups));
+ return allowMoreThanOneContentGroupDown ? Optional.of(maxGroupsAllowedDown) : Optional.empty();
+ }
+
+ return Optional.empty();
+ }
+
+ private ClusterControllerTuning build() {
+ return new ClusterControllerTuning(initProgressTime,
+ transitionTime,
+ maxPrematureCrashes,
+ stableStateTimePeriod,
+ minDistributorUpRatio,
+ minStorageUpRatio,
+ maxGroupsAllowedDown,
+ minNodeRatioPerGroup,
+ minSplitBits);
+ }
-private record ClusterControllerTuning(Optional<Duration> initProgressTime,
- Optional<Duration> transitionTime,
- Optional<Long> maxPrematureCrashes,
- Optional<Duration> stableStateTimePeriod,
- Optional<Double> minDistributorUpRatio,
- Optional<Double> minStorageUpRatio,
- Optional<Integer> maxGroupsAllowedDown,
- Optional<Double> minNodeRatioPerGroup,
- Optional<Integer> minSplitBits) {
-
- public ClusterControllerTuning withMaxGroupsAllowedDown(int maxGroupsAllowedDown) {
- return new ClusterControllerConfig.ClusterControllerTuning(
- initProgressTime,
- transitionTime,
- maxPrematureCrashes,
- stableStateTimePeriod,
- minDistributorUpRatio,
- minStorageUpRatio,
- Optional.of(maxGroupsAllowedDown),
- minNodeRatioPerGroup,
- minSplitBits);
}
-}
+ private record ClusterControllerTuning(Optional<Duration> initProgressTime,
+ Optional<Duration> transitionTime,
+ Optional<Long> maxPrematureCrashes,
+ Optional<Duration> stableStateTimePeriod,
+ Optional<Double> minDistributorUpRatio,
+ Optional<Double> minStorageUpRatio,
+ Optional<Integer> maxGroupsAllowedDown,
+ Optional<Double> minNodeRatioPerGroup,
+ Optional<Integer> minSplitBits) {
+ }
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
index f2d55b4d49f..985cef3a5ad 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java
@@ -211,7 +211,7 @@ public class ContentCluster extends TreeConfigProducer<AnyConfigProducer> implem
docprocChain = docprocChain.trim();
}
if (docprocCluster != null && !docprocCluster.isEmpty()) {
- if (!c.getSearch().hasIndexedCluster() && !c.getSearch().getIndexingDocproc().isPresent() &&
+ if (!c.getSearch().hasIndexedCluster() && c.getSearch().getIndexingDocproc().isEmpty() &&
docprocChain != null && !docprocChain.isEmpty()) {
c.getSearch().setupStreamingSearchIndexingDocProc();
}
@@ -459,7 +459,7 @@ public class ContentCluster extends TreeConfigProducer<AnyConfigProducer> implem
@Override
public void getConfig(MessagetyperouteselectorpolicyConfig.Builder builder) {
- if ( ! getSearch().getIndexingDocproc().isPresent()) return;
+ if (getSearch().getIndexingDocproc().isEmpty()) return;
DocumentProtocol.getConfig(builder, getConfigId());
}
diff --git a/config-model/src/main/resources/schema/content.rnc b/config-model/src/main/resources/schema/content.rnc
index 4d8b44f3fc1..bb63dcd73ff 100644
--- a/config-model/src/main/resources/schema/content.rnc
+++ b/config-model/src/main/resources/schema/content.rnc
@@ -82,7 +82,7 @@ ClusterControllerTuning = element cluster-controller {
element stable-state-period { xsd:string { pattern = "([0-9\.]+)\s*([a-z]+)?" } }? &
element min-distributor-up-ratio { xsd:double }? &
element min-storage-up-ratio { xsd:double }? &
- element max-groups-allowed-down { xsd:nonNegativeInteger }?
+ element groups-allowed-down-ratio { xsd:double }?
}
DispatchTuning = element dispatch {
diff --git a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
index 7273053db5c..b1f47c54d54 100644
--- a/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
+++ b/config-model/src/test/java/com/yahoo/config/model/provision/ModelProvisioningTest.java
@@ -2373,7 +2373,7 @@ public class ModelProvisioningTest {
" <nodes count='4' groups='4'/>" +
" <tuning>" +
" <cluster-controller>" +
- " <max-groups-allowed-down>2</max-groups-allowed-down>" +
+ " <groups-allowed-down-ratio>0.5</groups-allowed-down-ratio>" +
" </cluster-controller>" +
" </tuning>" +
" </content>" +
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
index 73bbd6ee464..ef2767249a5 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentClusterTest.java
@@ -1422,51 +1422,36 @@ public class ContentClusterTest extends ContentBaseTest {
}
@Test
- void testAllow2GroupsDown() {
- String services = "<?xml version='1.0' encoding='UTF-8' ?>" +
- "<services version='1.0'>" +
- " <container id='default' version='1.0' />" +
- " <content id='storage' version='1.0'>" +
- " <redundancy>4</redundancy>" +
- " <documents>" +
- " <document mode='index' type='type1' />" +
- " </documents>" +
- " <group name='root'>" +
- " <distribution partitions='1|1|1|*'/>" +
- " <group name='g-1' distribution-key='0'>" +
- " <node hostalias='mockhost' distribution-key='0'/>" +
- " </group>" +
- " <group name='g-2' distribution-key='1'>" +
- " <node hostalias='mockhost' distribution-key='1'/>" +
- " </group>" +
- " <group name='g-3' distribution-key='2'>" +
- " <node hostalias='mockhost' distribution-key='2'/>" +
- " </group>" +
- " <group name='g-4' distribution-key='3'>" +
- " <node hostalias='mockhost' distribution-key='3'/>" +
- " </group>" +
- " </group>" +
- " <tuning>" +
- " <cluster-controller>" +
- " <max-groups-allowed-down>2</max-groups-allowed-down>" +
- " </cluster-controller>" +
- " </tuning>" +
- " <engine>" +
- " <proton>" +
- " <searchable-copies>4</searchable-copies>" +
- " </proton>" +
- " </engine>" +
- " </content>" +
- " </services>";
- VespaModel model = createEnd2EndOneNode(new TestProperties().setAllowMoreThanOneContentGroupDown(true), services);
-
- var fleetControllerConfigBuilder = new FleetcontrollerConfig.Builder();
- model.getConfig(fleetControllerConfigBuilder, "admin/cluster-controllers/0/components/clustercontroller-storage-configurer");
- assertEquals(2, fleetControllerConfigBuilder.build().max_number_of_groups_allowed_to_be_down());
- }
-
- private void assertIndexingDocprocEnabled(boolean indexed, boolean force, boolean expEnabled)
- {
+ void testGroupsAllowedToBeDown() {
+ assertGroupsAllowedsDown(1, 0.5, 1);
+ assertGroupsAllowedsDown(2, 0.5, 1);
+ assertGroupsAllowedsDown(3, 0.5, 1);
+ assertGroupsAllowedsDown(4, 0.5, 2);
+ assertGroupsAllowedsDown(5, 0.5, 2);
+ assertGroupsAllowedsDown(6, 0.5, 3);
+
+ assertGroupsAllowedsDown(1, 0.33, 1);
+ assertGroupsAllowedsDown(2, 0.33, 1);
+ assertGroupsAllowedsDown(3, 0.33, 1);
+ assertGroupsAllowedsDown(4, 0.33, 1);
+ assertGroupsAllowedsDown(5, 0.33, 1);
+ assertGroupsAllowedsDown(6, 0.33, 1);
+
+ assertGroupsAllowedsDown(1, 0.67, 1);
+ assertGroupsAllowedsDown(2, 0.67, 1);
+ assertGroupsAllowedsDown(3, 0.67, 2);
+ assertGroupsAllowedsDown(4, 0.67, 2);
+ assertGroupsAllowedsDown(5, 0.67, 3);
+ assertGroupsAllowedsDown(6, 0.67, 4);
+
+ assertGroupsAllowedsDown(1, 0, 1);
+ assertGroupsAllowedsDown(2, 0, 1);
+
+ assertGroupsAllowedsDown(1, 1, 1);
+ assertGroupsAllowedsDown(2, 1, 2);
+ }
+
+ private void assertIndexingDocprocEnabled(boolean indexed, boolean force, boolean expEnabled) {
String services = "<?xml version='1.0' encoding='UTF-8' ?>" +
"<services version='1.0'>" +
" <container id='default' version='1.0'>" +
@@ -1503,4 +1488,56 @@ public class ContentClusterTest extends ContentBaseTest {
assertIndexingDocprocEnabled(false, true, true);
}
+ private void assertGroupsAllowedsDown(int groupCount, double groupsAllowedDown, int expectedGroupsAllowedDown) {
+ var services = servicesWithGroups(groupCount, groupsAllowedDown);
+ var model = createEnd2EndOneNode(new TestProperties().setAllowMoreThanOneContentGroupDown(true), services);
+
+ var fleetControllerConfigBuilder = new FleetcontrollerConfig.Builder();
+ model.getConfig(fleetControllerConfigBuilder, "admin/cluster-controllers/0/components/clustercontroller-storage-configurer");
+ var config = fleetControllerConfigBuilder.build();
+
+ assertEquals(expectedGroupsAllowedDown, config.max_number_of_groups_allowed_to_be_down());
+ }
+
+ private String servicesWithGroups(int groupCount, double minGroupUpRatio) {
+ String services = String.format("<?xml version='1.0' encoding='UTF-8' ?>" +
+ "<services version='1.0'>" +
+ " <container id='default' version='1.0' />" +
+ " <content id='storage' version='1.0'>" +
+ " <redundancy>%d</redundancy>" +
+ " <documents>" +
+ " <document mode='index' type='type1' />" +
+ " </documents>" +
+ " <group name='root'>", groupCount);
+ String distribution = switch (groupCount) {
+ case 1, 2 -> " <distribution partitions='1|*'/>";
+ case 3 -> " <distribution partitions='1|1|*'/>";
+ case 4 -> " <distribution partitions='1|1|1|*'/>";
+ case 5 -> " <distribution partitions='1|1|1|1|*'/>";
+ case 6 -> " <distribution partitions='1|1|1|1|1|*'/>";
+ default -> throw new IllegalArgumentException("Does not support groupCount > 6");
+ };
+ services += distribution;
+ for (int i = 0; i < groupCount; i++) {
+ services += String.format(" <group name='g-%d' distribution-key='%d'>" +
+ " <node hostalias='mockhost' distribution-key='%d'/>" +
+ " </group>",
+ i, i, i);
+ }
+ return services +
+ String.format(" </group>" +
+ " <tuning>" +
+ " <cluster-controller>" +
+ " <groups-allowed-down-ratio>%f</groups-allowed-down-ratio>" +
+ " </cluster-controller>" +
+ " </tuning>" +
+ " <engine>" +
+ " <proton>" +
+ " <searchable-copies>%d</searchable-copies>" +
+ " </proton>" +
+ " </engine>" +
+ " </content>" +
+ " </services>", minGroupUpRatio, groupCount);
+ }
+
}
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 138852e1c5c..2f7ed875226 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
@@ -3,44 +3,40 @@ package com.yahoo.vespa.model.content;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.deploy.TestProperties;
-import com.yahoo.config.model.test.MockRoot;
import com.yahoo.config.provision.ClusterSpec;
-import com.yahoo.text.XML;
import com.yahoo.vespa.config.content.FleetcontrollerConfig;
-import com.yahoo.vespa.model.builder.xml.dom.ModelElement;
+import com.yahoo.vespa.model.test.utils.ApplicationPackageUtils;
+import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg;
import org.junit.jupiter.api.Test;
-import org.w3c.dom.Document;
import static com.yahoo.config.model.test.TestUtil.joinLines;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class FleetControllerClusterTest {
- private ClusterControllerConfig parse(String xml, TestProperties props) {
- Document doc = XML.getDocument(xml);
- var deployState = new DeployState.Builder().properties(props).build();
- MockRoot root = new MockRoot("", deployState);
- var clusterElement = new ModelElement(doc.getDocumentElement());
- return new ClusterControllerConfig.Builder("storage",
- clusterElement,
- new ClusterResourceLimits.Builder(false,
- props.resourceLimitDisk(),
- props.resourceLimitMemory())
- .build(clusterElement).getClusterControllerLimits(),
- props.allowMoreThanOneContentGroupDown(new ClusterSpec.Id("default")))
- .build(root.getDeployState(), root, clusterElement.getXml());
+ private FleetcontrollerConfig parse(String xml, TestProperties props) {
+ var deployStateBuilder = new DeployState.Builder().properties(props);
+ props.allowMoreThanOneContentGroupDown(new ClusterSpec.Id("default"));
+ var mockPkg = new VespaModelCreatorWithMockPkg(null, xml, ApplicationPackageUtils.generateSchemas("type1"));
+ var model = mockPkg.create(deployStateBuilder);
+ var builder = new FleetcontrollerConfig.Builder();
+ model.getConfig(builder, "admin/cluster-controllers/0/components/clustercontroller-storage-configurer");
+ return builder.build();
}
- private ClusterControllerConfig parse(String xml) {
+ private FleetcontrollerConfig parse(String xml) {
return parse(xml, new TestProperties());
}
@Test
void testParameters() {
- FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder();
- parse("""
- <cluster id="storage">
- <documents/> <tuning>
+ var config = parse("""
+ <content id="storage" version="1.0">
+ <documents>
+ <document type="type1" mode="index"/>
+ </documents>
+ <redundancy>2</redundancy>
+ <tuning>
<bucket-splitting minimum-bits="7" />
<cluster-controller>
<init-progress-time>13</init-progress-time>
@@ -51,11 +47,9 @@ public class FleetControllerClusterTest {
<min-storage-up-ratio>0.3</min-storage-up-ratio>
</cluster-controller>
</tuning>
- </cluster>""",
- new TestProperties().setAllowMoreThanOneContentGroupDown(true)).
- getConfig(builder);
+ </content>""",
+ new TestProperties().setAllowMoreThanOneContentGroupDown(true));
- FleetcontrollerConfig config = new FleetcontrollerConfig(builder);
assertEquals(13 * 1000, config.init_progress_time());
assertEquals(27 * 1000, config.storage_transition_time());
assertEquals(4, config.max_premature_crashes());
@@ -67,33 +61,34 @@ public class FleetControllerClusterTest {
@Test
void testDurationParameters() {
- FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder();
- parse("<cluster id=\"storage\">\n" +
- " <documents/>" +
- " <tuning>\n" +
- " <cluster-controller>\n" +
- " <init-progress-time>13ms</init-progress-time>\n" +
- " </cluster-controller>\n" +
- " </tuning>\n" +
- "</cluster>").
- getConfig(builder);
-
- FleetcontrollerConfig config = new FleetcontrollerConfig(builder);
+ var config = parse(
+ "<content id='storage' version='1.0'>\n" +
+ "<documents>\n" +
+ " <document type='type1' mode='index'/>" +
+ "</documents>\n" +
+ "<redundancy>2</redundancy>\n" +
+ " <tuning>\n" +
+ " <cluster-controller>\n" +
+ " <init-progress-time>13ms</init-progress-time>\n" +
+ " </cluster-controller>\n" +
+ " </tuning>\n" +
+ "</content>");
+
assertEquals(13, config.init_progress_time());
}
@Test
void min_node_ratio_per_group_tuning_config_is_propagated() {
- FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder();
- parse("<cluster id=\"storage\">\n" +
- " <documents/>\n" +
- " <tuning>\n" +
- " <min-node-ratio-per-group>0.75</min-node-ratio-per-group>\n" +
- " </tuning>\n" +
- "</cluster>").
- getConfig(builder);
-
- FleetcontrollerConfig config = new FleetcontrollerConfig(builder);
+ var config = parse("<content id='storage' version='1.0'>" +
+ "<documents>" +
+ "<document type='type1' mode='index'/>" +
+ "</documents>" +
+ "<redundancy>2</redundancy>" +
+ " <tuning>\n" +
+ " <min-node-ratio-per-group>0.75</min-node-ratio-per-group>\n" +
+ " </tuning>\n" +
+ "</content>");
+
assertEquals(0.75, config.min_node_ratio_per_group(), 0.01);
}
@@ -126,18 +121,18 @@ public class FleetControllerClusterTest {
}
private FleetcontrollerConfig getConfigForResourceLimitsTuning(Double diskLimit, Double memoryLimit) {
- FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder();
- parse(joinLines("<cluster id=\"test\">",
- "<documents/>",
- "<tuning>",
- " <resource-limits>",
- (diskLimit != null ? (" <disk>" + diskLimit + "</disk>") : ""),
- (memoryLimit != null ? (" <memory>" + memoryLimit + "</memory>") : ""),
- " </resource-limits>",
- "</tuning>" +
- "</cluster>")).
- getConfig(builder);
- return new FleetcontrollerConfig(builder);
+ return parse(joinLines("<content id='storage' version='1.0'>" +
+ "<documents>" +
+ "<document type='type1' mode='index'/>" +
+ "</documents>" +
+ "<redundancy>2</redundancy>" +
+ "<tuning>",
+ " <resource-limits>",
+ (diskLimit != null ? (" <disk>" + diskLimit + "</disk>") : ""),
+ (memoryLimit != null ? (" <memory>" + memoryLimit + "</memory>") : ""),
+ " </resource-limits>",
+ "</tuning>" +
+ "</content>"));
}
@Test
@@ -153,12 +148,12 @@ public class FleetControllerClusterTest {
}
private FleetcontrollerConfig getConfigForBasicCluster(TestProperties props) {
- var builder = new FleetcontrollerConfig.Builder();
- parse("<cluster id=\"storage\">\n" +
- " <documents/>\n" +
- "</cluster>", props).
- getConfig(builder);
- return new FleetcontrollerConfig(builder);
+ return parse("<content id='storage' version='1.0'>" +
+ "<documents>" +
+ "<document type='type1' mode='index'/>" +
+ "</documents>" +
+ "<redundancy>2</redundancy>" +
+ "</content>", props);
}
private FleetcontrollerConfig getConfigForBasicCluster() {