use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class DistributionBuilder method forHierarchicCluster.
public static Distribution forHierarchicCluster(GroupBuilder root) {
List<ConfiguredNode> nodes = buildConfiguredNodes(root.totalNodeCount());
StorDistributionConfig.Builder configBuilder = new StorDistributionConfig.Builder();
configBuilder.redundancy(2);
StorDistributionConfig.Group.Builder rootBuilder = new StorDistributionConfig.Group.Builder();
rootBuilder.name("invalid");
rootBuilder.index("invalid");
rootBuilder.partitions(root.groupDistributionSpec());
configBuilder.group(rootBuilder);
int offset = 0;
for (int group = 0; group < root.groupsWithNodeCount.size(); ++group) {
int nodeCount = root.groupsWithNodeCount.get(group);
StorDistributionConfig.Group.Builder groupBuilder = configuredGroup("group_" + (group + 1), group + 1, nodes.subList(offset, offset + nodeCount));
configBuilder.group(groupBuilder);
offset += nodeCount;
}
return new Distribution(new StorDistributionConfig(configBuilder));
}
use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class ClusterTest method testReadyWhenInitialOne.
@Test
public void testReadyWhenInitialOne() {
StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
parse("<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <redundancy>1</redundancy>\n" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>" + " </group>" + "</content>").getConfig(builder);
StorDistributionConfig config = new StorDistributionConfig(builder);
assertEquals(1, config.initial_redundancy());
assertEquals(1, config.redundancy());
assertEquals(1, config.ready_copies());
}
use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class ClusterTest method testRedundancyDefaults.
@Test
public void testRedundancyDefaults() {
StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
parse("<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <group>" + " <node hostalias=\"mockhost\" distribution-key=\"0\"/>\"" + " <node hostalias=\"mockhost\" distribution-key=\"1\"/>\"" + " <node hostalias=\"mockhost\" distribution-key=\"2\"/>\"" + " </group>" + "</content>").getConfig(builder);
StorDistributionConfig config = new StorDistributionConfig(builder);
assertEquals(2, config.initial_redundancy());
assertEquals(3, config.redundancy());
assertEquals(2, config.ready_copies());
}
use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class ClusterTest method testAlternativeNodeSyntax.
@Test
public void testAlternativeNodeSyntax() {
ContentCluster cluster = parse("<content version=\"1.0\" id=\"test\">\n" + " <documents/>" + " <engine>" + " <proton/>" + " </engine>" + " <nodes>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " <node distribution-key=\"1\" hostalias=\"mockhost\"/>\n" + " </nodes>\n" + "</content>");
StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
cluster.getConfig(builder);
StorDistributionConfig config = new StorDistributionConfig(builder);
assertEquals("invalid", config.group(0).name());
assertEquals("invalid", config.group(0).index());
assertEquals(2, config.group(0).nodes().size());
}
use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class ClusterTest method testHierarchicRedundancy.
@Test
public void testHierarchicRedundancy() {
ContentCluster cc = parse("" + "<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <engine>" + " <proton>" + " <searchable-copies>3</searchable-copies>" + " </proton>" + " </engine>" + " <redundancy>15</redundancy>\n" + " <group name='root' distribution-key='0'>" + " <distribution partitions='1|1|*'/>" + " <group name='g-1' distribution-key='0'>" + " <node hostalias='mockhost' distribution-key='0'/>" + " <node hostalias='mockhost' distribution-key='1'/>" + " <node hostalias='mockhost' distribution-key='2'/>" + " <node hostalias='mockhost' distribution-key='3'/>" + " <node hostalias='mockhost' distribution-key='4'/>" + " </group>" + " <group name='g-2' distribution-key='1'>" + " <node hostalias='mockhost' distribution-key='5'/>" + " <node hostalias='mockhost' distribution-key='6'/>" + " <node hostalias='mockhost' distribution-key='7'/>" + " <node hostalias='mockhost' distribution-key='8'/>" + " <node hostalias='mockhost' distribution-key='9'/>" + " </group>" + " <group name='g-3' distribution-key='1'>" + " <node hostalias='mockhost' distribution-key='10'/>" + " <node hostalias='mockhost' distribution-key='11'/>" + " <node hostalias='mockhost' distribution-key='12'/>" + " <node hostalias='mockhost' distribution-key='13'/>" + " <node hostalias='mockhost' distribution-key='14'/>" + " </group>" + " </group>" + "</content>");
StorDistributionConfig.Builder storBuilder = new StorDistributionConfig.Builder();
cc.getConfig(storBuilder);
StorDistributionConfig storConfig = new StorDistributionConfig(storBuilder);
assertEquals(15, storConfig.initial_redundancy());
assertEquals(15, storConfig.redundancy());
assertEquals(3, storConfig.ready_copies());
ProtonConfig.Builder protonBuilder = new ProtonConfig.Builder();
cc.getSearch().getConfig(protonBuilder);
ProtonConfig protonConfig = new ProtonConfig(protonBuilder);
assertEquals(1, protonConfig.distribution().searchablecopies());
assertEquals(5, protonConfig.distribution().redundancy());
}
Aggregations