Search in sources :

Example 11 with StorDistributionConfig

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());
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) SearchDefinitionBuilder(com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder) ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 12 with StorDistributionConfig

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);
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) Test(org.junit.Test)

Example 13 with StorDistributionConfig

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());
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 14 with StorDistributionConfig

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");
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) ClusterState(com.yahoo.vdslib.state.ClusterState) BucketId(com.yahoo.document.BucketId) Test(org.junit.Test)

Example 15 with StorDistributionConfig

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());
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) BucketId(com.yahoo.document.BucketId) Test(org.junit.Test)

Aggregations

StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)16 Test (org.junit.Test)11 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)5 SearchDefinitionBuilder (com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder)5 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)4 BucketId (com.yahoo.document.BucketId)2 ConfiguredNode (com.yahoo.vdslib.distribution.ConfiguredNode)2 Distribution (com.yahoo.vdslib.distribution.Distribution)2 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)2 SlobroksConfig (com.yahoo.cloud.config.SlobroksConfig)1 ZookeepersConfig (com.yahoo.cloud.config.ZookeepersConfig)1 Metric (com.yahoo.jdisc.Metric)1 ClusterState (com.yahoo.vdslib.state.ClusterState)1 Node (com.yahoo.vdslib.state.Node)1 NodeState (com.yahoo.vdslib.state.NodeState)1 FleetcontrollerConfig (com.yahoo.vespa.config.content.FleetcontrollerConfig)1 Map (java.util.Map)1 JSONArray (org.codehaus.jettison.json.JSONArray)1 JSONObject (org.codehaus.jettison.json.JSONObject)1