use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class StorageClusterTest method testRootFolder.
@Test
public void testRootFolder() throws Exception {
String xml = "<cluster id=\"storage\">\n" + " <documents/>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " </group>\n" + "</cluster>";
ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
StorageNode node = cluster.getStorageNodes().getChildren().get("0");
{
StorDevicesConfig.Builder builder = new StorDevicesConfig.Builder();
node.getConfig(builder);
StorDevicesConfig config = new StorDevicesConfig(builder);
assertEquals(getDefaults().underVespaHome("var/db/vespa/vds/storage/storage/0"), config.root_folder());
}
{
StorServerConfig.Builder builder = new StorServerConfig.Builder();
cluster.getStorageNodes().getConfig(builder);
node.getConfig(builder);
StorServerConfig config = new StorServerConfig(builder);
assertEquals(getDefaults().underVespaHome("var/db/vespa/vds/storage/storage/0"), config.root_folder());
}
{
StorServerConfig.Builder builder = new StorServerConfig.Builder();
cluster.getDistributorNodes().getConfig(builder);
cluster.getDistributorNodes().getChildren().get("0").getConfig(builder);
StorServerConfig config = new StorServerConfig(builder);
assertEquals(getDefaults().underVespaHome("var/db/vespa/vds/storage/distributor/0"), config.root_folder());
}
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class StorageClusterTest method testGenericPersistenceTuning.
@Test
public void testGenericPersistenceTuning() throws Exception {
String xml = "<cluster id=\"storage\">\n" + "<documents/>" + "<engine>\n" + " <fail-partition-on-error>true</fail-partition-on-error>\n" + " <revert-time>34m</revert-time>\n" + " <recovery-time>5d</recovery-time>\n" + "</engine>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " </group>\n" + "</cluster>";
ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
PersistenceConfig.Builder builder = new PersistenceConfig.Builder();
cluster.getStorageNodes().getConfig(builder);
PersistenceConfig config = new PersistenceConfig(builder);
assertEquals(true, config.fail_partition_on_error());
assertEquals(34 * 60, config.revert_time_period());
assertEquals(5 * 24 * 60 * 60, config.keep_remove_time_period());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class StorageClusterTest method testCapacity.
@Test
public void testCapacity() throws Exception {
String xml = "<cluster id=\"storage\">\n" + " <documents/>" + " <group>\n" + " <node distribution-key=\"0\" hostalias=\"mockhost\"/>\n" + " <node distribution-key=\"1\" hostalias=\"mockhost\" capacity=\"1.5\"/>\n" + " <node distribution-key=\"2\" hostalias=\"mockhost\" capacity=\"2.0\"/>\n" + " </group>\n" + "</cluster>";
ContentCluster cluster = ContentClusterUtils.createCluster(xml, new MockRoot());
for (int i = 0; i < 3; ++i) {
StorageNode node = cluster.getStorageNodes().getChildren().get("" + i);
StorServerConfig.Builder builder = new StorServerConfig.Builder();
cluster.getStorageNodes().getConfig(builder);
node.getConfig(builder);
StorServerConfig config = new StorServerConfig(builder);
assertEquals(1.0 + (double) i * 0.5, config.node_capacity(), 0.001);
}
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ContentClusterUtils method createCluster.
public static ContentCluster createCluster(String clusterXml, MockRoot root) {
Document doc = XML.getDocument(clusterXml);
Admin admin = new Admin(root, new DefaultMonitoring("vespa", 60), new Metrics(), Collections.emptyMap(), false, new FileDistributionConfigProducer(root, new MockFileRegistry(), null));
ConfigModelContext context = ConfigModelContext.create(null, root.getDeployState(), null, root, null);
return new ContentCluster.Builder(admin).build(Collections.emptyList(), context, doc.getDocumentElement());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class GenericConfigTest method config_override_on_root_is_visible_on_content_cluster.
@Test
public void config_override_on_root_is_visible_on_content_cluster() throws Exception {
ContentCluster cluster = model.getContentClusters().get("storage");
StorMemfilepersistenceConfig config = model.getConfig(StorMemfilepersistenceConfig.class, cluster.getConfigId());
assertThat(config.disk_full_factor(), is(0.001));
}
Aggregations