Search in sources :

Example 1 with FleetcontrollerConfig

use of com.yahoo.vespa.config.content.FleetcontrollerConfig in project vespa by vespa-engine.

the class ClusterControllerClusterConfigurerTest method testSimple.

@Test
public void testSimple() throws Exception {
    ClusterController controller = new ClusterController();
    StorDistributionConfig.Builder distributionConfig = new StorDistributionConfig.Builder();
    StorDistributionConfig.Group.Builder group = new StorDistributionConfig.Group.Builder();
    group.index("0").name("foo");
    StorDistributionConfig.Group.Nodes.Builder node = new StorDistributionConfig.Group.Nodes.Builder();
    node.index(0);
    group.nodes.add(node);
    distributionConfig.group.add(group);
    FleetcontrollerConfig.Builder fleetcontrollerConfig = new FleetcontrollerConfig.Builder();
    fleetcontrollerConfig.cluster_name("storage").index(0).zookeeper_server("zoo").min_node_ratio_per_group(0.123);
    SlobroksConfig.Builder slobroksConfig = new SlobroksConfig.Builder();
    SlobroksConfig.Slobrok.Builder slobrok = new SlobroksConfig.Slobrok.Builder();
    slobrok.connectionspec("foo");
    slobroksConfig.slobrok.add(slobrok);
    ZookeepersConfig.Builder zookeepersConfig = new ZookeepersConfig.Builder();
    zookeepersConfig.zookeeperserverlist("foo");
    Metric metric = new Metric() {

        @Override
        public void set(String s, Number number, Context context) {
        }

        @Override
        public void add(String s, Number number, Context context) {
        }

        @Override
        public Context createContext(Map<String, ?> stringMap) {
            return null;
        }
    };
    // Used in standalone modus to get config without a cluster controller instance
    ClusterControllerClusterConfigurer configurer = new ClusterControllerClusterConfigurer(null, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric);
    assertTrue(configurer.getOptions() != null);
    assertEquals(0.123, configurer.getOptions().minNodeRatioPerGroup, 0.01);
    // Oki with no zookeeper if one node
    zookeepersConfig.zookeeperserverlist("");
    new ClusterControllerClusterConfigurer(controller, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric);
    try {
        fleetcontrollerConfig.fleet_controller_count(5);
        new ClusterControllerClusterConfigurer(controller, new StorDistributionConfig(distributionConfig), new FleetcontrollerConfig(fleetcontrollerConfig), new SlobroksConfig(slobroksConfig), new ZookeepersConfig(zookeepersConfig), metric);
        fail("Should not get here");
    } catch (Exception e) {
        assertEquals("Must set zookeeper server with multiple fleetcontrollers", e.getMessage());
    }
}
Also used : StorDistributionConfig(com.yahoo.vespa.config.content.StorDistributionConfig) SlobroksConfig(com.yahoo.cloud.config.SlobroksConfig) ZookeepersConfig(com.yahoo.cloud.config.ZookeepersConfig) Metric(com.yahoo.jdisc.Metric) FleetcontrollerConfig(com.yahoo.vespa.config.content.FleetcontrollerConfig) Map(java.util.Map) Test(org.junit.Test)

Example 2 with FleetcontrollerConfig

use of com.yahoo.vespa.config.content.FleetcontrollerConfig in project vespa by vespa-engine.

the class ClusterTest method assertDistributionBitsInConfig.

private void assertDistributionBitsInConfig(ContentCluster cluster, int distributionBits) {
    FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder();
    cluster.getConfig(builder);
    cluster.getClusterControllerConfig().getConfig(builder);
    FleetcontrollerConfig config = new FleetcontrollerConfig(builder);
    assertEquals(distributionBits, config.ideal_distribution_bits());
    StorDistributormanagerConfig.Builder sdBuilder = new StorDistributormanagerConfig.Builder();
    cluster.getConfig(sdBuilder);
    StorDistributormanagerConfig storDistributormanagerConfig = new StorDistributormanagerConfig(sdBuilder);
    assertEquals(distributionBits, storDistributormanagerConfig.minsplitcount());
}
Also used : StorDistributormanagerConfig(com.yahoo.vespa.config.content.core.StorDistributormanagerConfig) SearchDefinitionBuilder(com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder) ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) FleetcontrollerConfig(com.yahoo.vespa.config.content.FleetcontrollerConfig)

Example 3 with FleetcontrollerConfig

use of com.yahoo.vespa.config.content.FleetcontrollerConfig in project vespa by vespa-engine.

the class ClusterTest method getFleetControllerConfig.

FleetcontrollerConfig getFleetControllerConfig(String xml) {
    ContentCluster cluster = parse(xml);
    FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder();
    cluster.getConfig(builder);
    cluster.getClusterControllerConfig().getConfig(builder);
    return new FleetcontrollerConfig(builder);
}
Also used : SearchDefinitionBuilder(com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder) ContentClusterBuilder(com.yahoo.vespa.model.content.utils.ContentClusterBuilder) FleetcontrollerConfig(com.yahoo.vespa.config.content.FleetcontrollerConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 4 with FleetcontrollerConfig

use of com.yahoo.vespa.config.content.FleetcontrollerConfig in project vespa by vespa-engine.

the class FleetControllerClusterTest method testParameters.

@Test
public void testParameters() {
    FleetcontrollerConfig.Builder builder = new FleetcontrollerConfig.Builder();
    parse("<cluster id=\"storage\">\n" + "  <documents/>" + "  <tuning>\n" + "    <bucket-splitting minimum-bits=\"7\" />" + "    <cluster-controller>\n" + "      <init-progress-time>13</init-progress-time>\n" + "      <transition-time>27</transition-time>\n" + "      <max-premature-crashes>4</max-premature-crashes>\n" + "      <stable-state-period>72</stable-state-period>\n" + "      <min-distributor-up-ratio>0.7</min-distributor-up-ratio>\n" + "      <min-storage-up-ratio>0.3</min-storage-up-ratio>\n" + "    </cluster-controller>\n" + "  </tuning>\n" + "</cluster>").getConfig(builder);
    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());
    assertEquals(72 * 1000, config.stable_state_time_period());
    assertEquals(0.7, config.min_distributor_up_ratio(), 0.01);
    assertEquals(0.3, config.min_storage_up_ratio(), 0.01);
    assertEquals(7, config.ideal_distribution_bits());
}
Also used : FleetcontrollerConfig(com.yahoo.vespa.config.content.FleetcontrollerConfig) Test(org.junit.Test)

Example 5 with FleetcontrollerConfig

use of com.yahoo.vespa.config.content.FleetcontrollerConfig in project vespa by vespa-engine.

the class FleetControllerClusterTest method testDurationParameters.

@Test
public 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);
    assertEquals(13, config.init_progress_time());
}
Also used : FleetcontrollerConfig(com.yahoo.vespa.config.content.FleetcontrollerConfig) Test(org.junit.Test)

Aggregations

FleetcontrollerConfig (com.yahoo.vespa.config.content.FleetcontrollerConfig)11 Test (org.junit.Test)9 VespaModel (com.yahoo.vespa.model.VespaModel)4 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)2 SearchDefinitionBuilder (com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder)2 SlobroksConfig (com.yahoo.cloud.config.SlobroksConfig)1 ZookeepersConfig (com.yahoo.cloud.config.ZookeepersConfig)1 Metric (com.yahoo.jdisc.Metric)1 StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)1 StorDistributormanagerConfig (com.yahoo.vespa.config.content.core.StorDistributormanagerConfig)1 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)1 Map (java.util.Map)1