Search in sources :

Example 6 with StorDistributionConfig

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));
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) ConfiguredNode(com.yahoo.vdslib.distribution.ConfiguredNode) Distribution(com.yahoo.vdslib.distribution.Distribution)

Example 7 with StorDistributionConfig

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

Example 8 with StorDistributionConfig

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

Example 9 with StorDistributionConfig

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

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());
}
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)

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