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