Search in sources :

Example 36 with ContentCluster

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());
    }
}
Also used : MockRoot(com.yahoo.config.model.test.MockRoot) StorDevicesConfig(com.yahoo.vespa.config.storage.StorDevicesConfig) StorServerConfig(com.yahoo.vespa.config.content.core.StorServerConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 37 with ContentCluster

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

Example 38 with ContentCluster

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

Example 39 with ContentCluster

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());
}
Also used : FileDistributionConfigProducer(com.yahoo.vespa.model.filedistribution.FileDistributionConfigProducer) Metrics(com.yahoo.vespa.model.admin.monitoring.builder.Metrics) DefaultMonitoring(com.yahoo.vespa.model.admin.monitoring.DefaultMonitoring) Document(org.w3c.dom.Document) Admin(com.yahoo.vespa.model.admin.Admin) MockFileRegistry(com.yahoo.config.model.application.provider.MockFileRegistry) ConfigModelContext(com.yahoo.config.model.ConfigModelContext) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 40 with ContentCluster

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

Aggregations

ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)83 Test (org.junit.Test)70 VespaModel (com.yahoo.vespa.model.VespaModel)22 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)20 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)18 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)15 MockRoot (com.yahoo.config.model.test.MockRoot)7 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)7 SearchDefinitionBuilder (com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder)6 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)5 HostResource (com.yahoo.vespa.model.HostResource)5 SearchNode (com.yahoo.vespa.model.search.SearchNode)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)4 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)4 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)4 VDSEngine (com.yahoo.vespa.model.content.engines.VDSEngine)4 StorServerConfig (com.yahoo.vespa.config.content.core.StorServerConfig)3 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)2