Search in sources :

Example 51 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentBuilderTest method canConfigureCpuAffinity.

@Test
public void canConfigureCpuAffinity() throws Exception {
    ContentCluster b = createContent("<content version =\"1.0\" id=\"b\">" + "    <redundancy>2</redundancy>" + "      <documents>" + "        <document type='music' mode='index'/>" + "      </documents>" + "    <group>" + "      <node hostalias=\"mockhost\" distribution-key=\"0\" cpu-socket=\"0\" />" + "      <node hostalias=\"mockhost\" distribution-key=\"1\" cpu-socket=\"1\" />" + "    </group>" + "</content>");
    ContentSearchCluster s;
    s = b.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertNotNull(s.getIndexed());
    assertEquals(2, b.getStorageNodes().getChildren().size());
    assertTrue(b.getStorageNodes().getChildren().get("0").getAffinity().isPresent());
    assertThat(b.getStorageNodes().getChildren().get("0").getAffinity().get().cpuSocket(), is(0));
    assertTrue(b.getStorageNodes().getChildren().get("1").getAffinity().isPresent());
    assertThat(b.getStorageNodes().getChildren().get("1").getAffinity().get().cpuSocket(), is(1));
    assertThat(s.getSearchNodes().size(), is(2));
    assertTrue(s.getSearchNodes().get(0).getAffinity().isPresent());
    assertThat(s.getSearchNodes().get(0).getAffinity().get().cpuSocket(), is(0));
    assertTrue(s.getSearchNodes().get(1).getAffinity().isPresent());
    assertThat(s.getSearchNodes().get(1).getAffinity().get().cpuSocket(), is(1));
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 52 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentBuilderTest method handleStreamingOnlyWithoutPersistence.

@Test
public void handleStreamingOnlyWithoutPersistence() throws Exception {
    final String musicClusterId = "music-cluster-id";
    ContentCluster cluster = createContent("<content version='1.0' id='" + musicClusterId + "'>" + "    <redundancy>3</redundancy>" + "    <documents>" + "       <document type='music' mode='streaming'/>" + "    </documents>" + "    <engine>" + "      <vds/>" + "    </engine>" + "    <group>" + "      <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + "    </group>" + "</content>");
    ContentSearchCluster s;
    s = cluster.getSearch();
    assertFalse(s.hasIndexedCluster());
    assertEquals(1, s.getClusters().size());
    assertNull(s.getIndexed());
    AbstractSearchCluster sc = s.getClusters().get(musicClusterId + ".music");
    assertEquals(musicClusterId + ".music", sc.getClusterName());
    assertEquals(musicClusterId, ((StreamingSearchCluster) sc).getStorageRouteSpec());
    assertTrue(cluster.getPersistence() instanceof VDSEngine.Factory);
    assertEquals(1, cluster.getStorageNodes().getChildren().size());
    assertEquals(musicClusterId, cluster.getConfigId());
    // assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId());
    // Due to reuse.
    assertEquals(musicClusterId + "/storage/0", cluster.getRootGroup().getNodes().get(0).getConfigId());
    assertEquals(1, cluster.getRoot().getHostSystem().getHosts().size());
    HostResource h = cluster.getRoot().getHostSystem().getHost("mockhost");
    String[] expectedServices = { "logd", "configproxy", "config-sentinel", "configserver", "logserver", "slobrok", "container-clustercontroller", "storagenode", "distributor" };
    assertServices(h, expectedServices);
    assertEquals(musicClusterId + "/storage/0", h.getService("storagenode").getConfigId());
/* Not yet
        assertNotNull(h.getService("qrserver"));
        assertNotNull(h.getService("topleveldisptach"));
        assertNotNull(h.getService("docproc"));
        */
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) HostResource(com.yahoo.vespa.model.HostResource) VDSEngine(com.yahoo.vespa.model.content.engines.VDSEngine) Matchers.containsString(org.hamcrest.Matchers.containsString) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 53 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentBuilderTest method defaultCoreOnOOMIsFalse.

@Test
public void defaultCoreOnOOMIsFalse() throws Exception {
    ContentCluster b = createContent("<content version =\"1.0\" id=\"b\">" + "    <redundancy>2</redundancy>" + "      <documents>" + "        <document type='music' mode='index'/>" + "      </documents>" + "    <group>" + "      <node hostalias=\"mockhost\" distribution-key=\"0\" />" + "      <node hostalias=\"mockhost\" distribution-key=\"1\" />" + "    </group>" + "</content>");
    ContentSearchCluster s = b.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertNotNull(s.getIndexed());
    assertEquals(2, b.getStorageNodes().getChildren().size());
    assertFalse(b.getRootGroup().getCoreOnOOM().isPresent());
    assertThat(s.getSearchNodes().size(), is(2));
    assertFalse(s.getSearchNodes().get(0).getCoreOnOOM());
    assertFalse(s.getSearchNodes().get(1).getCoreOnOOM());
    assertEquals("VESPA_SILENCE_CORE_ON_OOM=true ", s.getSearchNodes().get(0).getCoreOnOOMEnvVariable());
    assertEquals("VESPA_SILENCE_CORE_ON_OOM=true ", s.getSearchNodes().get(1).getCoreOnOOMEnvVariable());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 54 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentBuilderTest method canConfigureVespaMallocPerHost.

@Test
public void canConfigureVespaMallocPerHost() throws Exception {
    ContentCluster b = createContent("<content version =\"1.0\" id=\"b\">" + "    <redundancy>2</redundancy>" + "      <documents>" + "        <document type='music' mode='index'/>" + "      </documents>" + "    <group>" + "      <node hostalias=\"mockhost\" distribution-key=\"0\" no-vespamalloc=\"proton\"/>" + "      <node hostalias=\"mockhost\" distribution-key=\"1\" vespamalloc-debug=\"distributord\"/>" + "      <node hostalias=\"mockhost\" distribution-key=\"2\" vespamalloc-debug-stacktrace=\"all\"/>" + "      <node hostalias=\"mockhost\" distribution-key=\"3\" vespamalloc=\"storaged\"/>" + "    </group>" + "</content>");
    ContentSearchCluster s = b.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertNotNull(s.getIndexed());
    assertEquals(4, b.getStorageNodes().getChildren().size());
    assertFalse(b.getRootGroup().getNoVespaMalloc().isPresent());
    assertFalse(b.getRootGroup().getVespaMalloc().isPresent());
    assertFalse(b.getRootGroup().getVespaMallocDebug().isPresent());
    assertFalse(b.getRootGroup().getVespaMallocDebugStackTrace().isPresent());
    assertThat(s.getSearchNodes().size(), is(4));
    assertEquals("VESPA_SILENCE_CORE_ON_OOM=true VESPA_USE_NO_VESPAMALLOC=\"proton\" ", s.getSearchNodes().get(0).getEnvVariables());
    assertEquals("VESPA_SILENCE_CORE_ON_OOM=true VESPA_USE_VESPAMALLOC_D=\"distributord\" ", s.getSearchNodes().get(1).getEnvVariables());
    assertEquals("VESPA_SILENCE_CORE_ON_OOM=true VESPA_USE_VESPAMALLOC_DST=\"all\" ", s.getSearchNodes().get(2).getEnvVariables());
    assertEquals("VESPA_SILENCE_CORE_ON_OOM=true VESPA_USE_VESPAMALLOC=\"storaged\" ", s.getSearchNodes().get(3).getEnvVariables());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 55 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ContentBuilderTest method requireThatContentStreamingHandlesMultipleSearchDefinitions.

@Test
public void requireThatContentStreamingHandlesMultipleSearchDefinitions() throws Exception {
    final String musicClusterId = "music-cluster-id";
    ContentCluster cluster = createContentWithBooksToo("<content version='1.0' id='" + musicClusterId + "'>" + "    <redundancy>3</redundancy>" + "    <documents>" + "       <document type='music' mode='streaming'/>" + "       <document type='book' mode='streaming'/>" + "    </documents>" + "    <engine>" + "      <vds/>" + "    </engine>" + "    <group>" + "      <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + "    </group>" + "</content>");
    ContentSearchCluster s;
    s = cluster.getSearch();
    assertFalse(s.hasIndexedCluster());
    assertEquals(2, s.getClusters().size());
    assertNull(s.getIndexed());
    {
        String id = musicClusterId + ".book";
        AbstractSearchCluster sc = s.getClusters().get(id);
        assertEquals(id, sc.getClusterName());
        assertEquals(musicClusterId, ((StreamingSearchCluster) sc).getStorageRouteSpec());
    }
    {
        String id = musicClusterId + ".music";
        AbstractSearchCluster sc = s.getClusters().get(id);
        assertEquals(id, sc.getClusterName());
        assertEquals(musicClusterId, ((StreamingSearchCluster) sc).getStorageRouteSpec());
    }
    assertTrue(cluster.getPersistence() instanceof VDSEngine.Factory);
    assertEquals(1, cluster.getStorageNodes().getChildren().size());
    assertEquals(musicClusterId, cluster.getConfigId());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) VDSEngine(com.yahoo.vespa.model.content.engines.VDSEngine) Matchers.containsString(org.hamcrest.Matchers.containsString) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

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