use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class ClusterTest method testRedundancy.
@Test
public void testRedundancy() {
ContentCluster cc = parse("" + "<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <engine>" + " <proton>" + " <searchable-copies>3</searchable-copies>" + " </proton>" + " </engine>" + " <redundancy reply-after='4'>5</redundancy>\n" + " <group>" + " <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>" + "</content>");
StorDistributionConfig.Builder storBuilder = new StorDistributionConfig.Builder();
cc.getConfig(storBuilder);
StorDistributionConfig storConfig = new StorDistributionConfig(storBuilder);
assertEquals(4, storConfig.initial_redundancy());
assertEquals(5, storConfig.redundancy());
assertEquals(3, storConfig.ready_copies());
ProtonConfig.Builder protonBuilder = new ProtonConfig.Builder();
cc.getSearch().getConfig(protonBuilder);
ProtonConfig protonConfig = new ProtonConfig(protonBuilder);
assertEquals(3, protonConfig.distribution().searchablecopies());
assertEquals(5, protonConfig.distribution().redundancy());
}
use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class StorageGroupTest method testGroupCapacity.
@Test
public void testGroupCapacity() throws Exception {
StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
parse("<content version=\"1.0\" id=\"storage\">\n" + " <documents/>" + " <group>\n" + " <distribution partitions=\"1|*\"/>\n" + " <group distribution-key=\"0\" name=\"sub1\">\n" + " <node hostalias=\"mockhost\" capacity=\"0.5\" distribution-key=\"0\"/>\n" + " <node hostalias=\"mockhost\" capacity=\"1.5\" distribution-key=\"1\"/>\n" + " </group>\n" + " <group distribution-key=\"1\" name=\"sub2\">\n" + " <node hostalias=\"mockhost\" capacity=\"2.0\" distribution-key=\"2\"/>\n" + " <node hostalias=\"mockhost\" capacity=\"1.5\" distribution-key=\"3\"/>\n" + " </group>\n" + " </group>\n" + "</content>").getConfig(builder);
StorDistributionConfig config = new StorDistributionConfig(builder);
assertEquals(3, config.group().size());
assertEquals(5.5, config.group(0).capacity(), 0.001);
assertEquals(2, config.group(1).capacity(), 0.001);
assertEquals(3.5, config.group(2).capacity(), 0.001);
}
use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class StorageGroupTest method testSingleGroup.
@Test
public void testSingleGroup() throws Exception {
StorDistributionConfig.Builder builder = new StorDistributionConfig.Builder();
ContentCluster cluster = parse("<content id=\"storage\">\n" + " <documents/>" + " <group>\n" + " <node jvmargs=\"foo\" hostalias=\"mockhost\" distribution-key=\"0\"/>\n" + " <node hostalias=\"mockhost\" distribution-key=\"1\"/>\n" + " </group>\n" + "</content>");
cluster.getConfig(builder);
assertEquals("content", cluster.getStorageNodes().getChildren().get("0").getServicePropertyString("clustertype"));
assertEquals("storage", cluster.getStorageNodes().getChildren().get("0").getServicePropertyString("clustername"));
assertEquals("0", cluster.getStorageNodes().getChildren().get("0").getServicePropertyString("index"));
assertEquals("content", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("clustertype"));
assertEquals("storage", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("clustername"));
assertEquals("0", cluster.getDistributorNodes().getChildren().get("0").getServicePropertyString("index"));
StorDistributionConfig config = new StorDistributionConfig(builder);
assertEquals(1, config.group().size());
assertEquals("invalid", config.group(0).index());
assertEquals("invalid", config.group(0).name());
assertEquals(2, config.group(0).nodes().size());
assertEquals(0, config.group(0).nodes(0).index());
assertEquals(1, config.group(0).nodes(1).index());
// assertNotNull(cluster.getRootGroup().getNodes().get(0).getHost());
}
use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class DistributionTestCase method clusterDownInHierarchicSetupThrowsNoDistributorsAvailableException.
@Test(expected = Distribution.NoDistributorsAvailableException.class)
public void clusterDownInHierarchicSetupThrowsNoDistributorsAvailableException() throws Exception {
ClusterState clusterState = new ClusterState("cluster:d");
StorDistributionConfig.Builder config = buildHierarchicalConfig(4, 4, 1, "1|1|1|*", 1);
Distribution distr = new Distribution(new StorDistributionConfig(config));
distr.getIdealDistributorNode(clusterState, new BucketId(16, 0), "uim");
}
use of com.yahoo.vespa.config.content.StorDistributionConfig in project vespa by vespa-engine.
the class DistributionTestCase method testHierarchicalDistributionDeep.
@Test
public void testHierarchicalDistributionDeep() throws Exception {
System.out.println(new StorDistributionConfig(buildHierarchicalConfig(8, 5, 3, "*|*", 3)));
test = new DistributionTestFactory("hierarchical-grouping-deep").setNodeCount(500).setDistribution(buildHierarchicalConfig(8, 5, 3, "*|*", 3));
for (BucketId bucket : getTestBuckets()) {
test.recordResult(bucket).assertNodeCount(1);
}
Set<ConfiguredNode> nodes = test.getDistribution().getNodes();
// Despite setNodeCount(500) above, the actual distribution config
// itself only has 375 actual leaf nodes.
assertEquals(375, nodes.size());
}
Aggregations