Search in sources :

Example 1 with ContentSearchCluster

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

the class ModelProvisioningTest method require_that_proton_config_is_tuned_based_on_node_flavor.

@Test
public void require_that_proton_config_is_tuned_based_on_node_flavor() {
    String services = joinLines("<?xml version='1.0' encoding='utf-8' ?>", "<services>", "  <content version='1.0' id='test'>", "     <documents>", "       <document type='type1' mode='index'/>", "     </documents>", "     <nodes count='2' flavor='content-test-flavor'/>", "  </content>", "</services>");
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(createFlavorFromDiskSetting("content-test-flavor", false), 2);
    VespaModel model = tester.createModel(services, true, 0);
    ContentSearchCluster cluster = model.getContentClusters().get("test").getSearch();
    assertEquals(2, cluster.getSearchNodes().size());
    assertEquals(40, getProtonConfig(cluster, 0).hwinfo().disk().writespeed(), 0.001);
    assertEquals(40, getProtonConfig(cluster, 1).hwinfo().disk().writespeed(), 0.001);
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) Test(org.junit.Test)

Example 2 with ContentSearchCluster

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

the class ContentBuilderTest method handleIndexedWithoutPersistence.

@Test
public void handleIndexedWithoutPersistence() throws Exception {
    ContentCluster b = createContent("<content version =\"1.0\" id=\"b\">" + "    <redundancy>3</redundancy>" + "      <documents>" + "        <document type='music' mode='index'/>" + "      </documents>" + "    <group>" + "      <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + "    </group>" + "</content>");
    ContentSearchCluster s;
    s = b.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertEquals(1, s.getClusters().size());
    assertNotNull(s.getIndexed());
    assertEquals("b", s.getIndexed().getClusterName());
    assertTrue(b.getPersistence() instanceof ProtonEngine.Factory);
    assertEquals(1, b.getStorageNodes().getChildren().size());
    assertEquals("b", b.getConfigId());
    // assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId());
    // Due to reuse.
    assertEquals("b/storage/0", b.getRootGroup().getNodes().get(0).getConfigId());
    assertEquals(1, b.getRoot().getHostSystem().getHosts().size());
    HostResource h = b.getRoot().getHostSystem().getHost("mockhost");
    assertEquals("b/storage/0", h.getService("storagenode").getConfigId());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) HostResource(com.yahoo.vespa.model.HostResource) ProtonEngine(com.yahoo.vespa.model.content.engines.ProtonEngine) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 3 with ContentSearchCluster

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

the class ContentBuilderTest method handleSingleNonSearchPersistentProton.

@Test
public void handleSingleNonSearchPersistentProton() throws Exception {
    ContentCluster a = createContent("<content version =\"1.0\" id=\"a\">" + "    <redundancy>3</redundancy>" + "    <documents>" + "       <document type=\"music\" mode=\"store-only\"/>" + "    </documents>" + "    <engine>" + "      <proton/>" + "    </engine>" + "    <group>" + "      <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + "    </group>" + "</content>");
    ContentSearchCluster s = a.getSearch();
    assertFalse(s.hasIndexedCluster());
    assertTrue(s.getClusters().isEmpty());
    assertTrue(a.getPersistence() instanceof ProtonEngine.Factory);
    assertEquals(1, a.getStorageNodes().getChildren().size());
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) ProtonEngine(com.yahoo.vespa.model.content.engines.ProtonEngine) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 4 with ContentSearchCluster

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

the class ContentBuilderTest method handleIndexedOnlyWithoutPersistence.

@Test
public void handleIndexedOnlyWithoutPersistence() throws Exception {
    VespaModel m = new VespaModelCreatorWithMockPkg(createAppWithMusic(getHosts(), getBasicServices())).create();
    ContentCluster c = CollectionUtil.first(m.getContentClusters().values());
    ContentSearchCluster s = c.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertEquals(1, s.getClusters().size());
    assertNotNull(s.getIndexed());
    assertEquals("clu", s.getIndexed().getClusterName());
    assertEquals(7.3, s.getIndexed().getQueryTimeout(), 0.0);
    assertTrue(c.getPersistence() instanceof ProtonEngine.Factory);
    assertEquals(1, c.getStorageNodes().getChildren().size());
    assertEquals("clu", c.getConfigId());
    // assertEquals("content/a/0", a.getRootGroup().getNodes().get(0).getConfigId()); // This is how it should look like in an ideal world.
    // Due to reuse.
    assertEquals("clu/storage/0", c.getRootGroup().getNodes().get(0).getConfigId());
    assertEquals(1, c.getRoot().getHostSystem().getHosts().size());
    HostResource h = c.getRoot().getHostSystem().getHost("mockhost");
    String[] expectedServices = { "logd", "configproxy", "config-sentinel", "qrserver", "storagenode", "searchnode", "distributor", "topleveldispatch", "transactionlogserver" };
    // TODO        assertServices(h, expectedServices);
    assertEquals("clu/storage/0", h.getService("storagenode").getConfigId());
    assertEquals("clu/search/cluster.clu/0", h.getService("searchnode").getConfigId());
    assertEquals("clu/distributor/0", h.getService("distributor").getConfigId());
    assertEquals("clu/search/cluster.clu/tlds/qrc.0.tld.0", h.getService("topleveldispatch").getConfigId());
    // assertEquals("tcp/node0:19104", h.getService("topleveldispatch").getConfig("partitions", "").innerArray("dataset").value("0").innerArray("engine").value("0").getString("name_and_port"));
    PartitionsConfig partitionsConfig = new PartitionsConfig((PartitionsConfig.Builder) m.getConfig(new PartitionsConfig.Builder(), "clu/search/cluster.clu/tlds/qrc.0.tld.0"));
    assertTrue(partitionsConfig.dataset(0).engine(0).name_and_port().startsWith("tcp/node0:191"));
}
Also used : ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) HostResource(com.yahoo.vespa.model.HostResource) VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) ProtonEngine(com.yahoo.vespa.model.content.engines.ProtonEngine) Matchers.containsString(org.hamcrest.Matchers.containsString) PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 5 with ContentSearchCluster

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

the class ContentBuilderTest method canConfigureCpuAffinityAutomatically.

@Test
public void canConfigureCpuAffinityAutomatically() throws Exception {
    ContentCluster b = createContent("<content version =\"1.0\" id=\"b\">" + "    <redundancy>2</redundancy>" + "      <documents>" + "        <document type='music' mode='index'/>" + "      </documents>" + "    <group cpu-socket-affinity=\"true\">" + "      <node hostalias=\"mockhost\" distribution-key=\"0\" />" + "      <node hostalias=\"mockhost\" distribution-key=\"1\" />" + "      <node hostalias=\"mockhost\" distribution-key=\"2\" />" + "      <node hostalias=\"mockhost2\" distribution-key=\"3\" />" + "      <node hostalias=\"mockhost2\" distribution-key=\"4\" />" + "      <node hostalias=\"mockhost3\" distribution-key=\"5\" />" + "    </group>" + "</content>");
    ContentSearchCluster s;
    s = b.getSearch();
    assertTrue(s.hasIndexedCluster());
    assertNotNull(s.getIndexed());
    assertEquals(6, b.getStorageNodes().getChildren().size());
    assertTrue(b.getRootGroup().useCpuSocketAffinity());
    assertThat(s.getSearchNodes().size(), is(6));
    assertTrue(s.getSearchNodes().get(0).getAffinity().isPresent());
    assertTrue(s.getSearchNodes().get(1).getAffinity().isPresent());
    assertTrue(s.getSearchNodes().get(2).getAffinity().isPresent());
    assertTrue(s.getSearchNodes().get(3).getAffinity().isPresent());
    assertTrue(s.getSearchNodes().get(4).getAffinity().isPresent());
    assertTrue(s.getSearchNodes().get(5).getAffinity().isPresent());
    assertThat(s.getSearchNodes().get(0).getAffinity().get().cpuSocket(), is(0));
    assertThat(s.getSearchNodes().get(1).getAffinity().get().cpuSocket(), is(1));
    assertThat(s.getSearchNodes().get(2).getAffinity().get().cpuSocket(), is(2));
    assertThat(s.getSearchNodes().get(3).getAffinity().get().cpuSocket(), is(0));
    assertThat(s.getSearchNodes().get(4).getAffinity().get().cpuSocket(), is(1));
    assertThat(s.getSearchNodes().get(5).getAffinity().get().cpuSocket(), is(0));
    // TODO: Only needed for the search nodes anyway?
    assertFalse(b.getStorageNodes().getChildren().get("0").getAffinity().isPresent());
    assertFalse(b.getStorageNodes().getChildren().get("1").getAffinity().isPresent());
    assertFalse(b.getStorageNodes().getChildren().get("2").getAffinity().isPresent());
    assertFalse(b.getStorageNodes().getChildren().get("3").getAffinity().isPresent());
    assertFalse(b.getStorageNodes().getChildren().get("4").getAffinity().isPresent());
    assertFalse(b.getStorageNodes().getChildren().get("5").getAffinity().isPresent());
// assertThat(b.getStorageNodes().getChildren().get("0").getAffinity().get().cpuSocket(), is(0));
// assertThat(b.getStorageNodes().getChildren().get("1").getAffinity().get().cpuSocket(), is(1));
// assertThat(b.getStorageNodes().getChildren().get("2").getAffinity().get().cpuSocket(), is(2));
// assertThat(b.getStorageNodes().getChildren().get("3").getAffinity().get().cpuSocket(), is(0));
// assertThat(b.getStorageNodes().getChildren().get("4").getAffinity().get().cpuSocket(), is(1));
// assertThat(b.getStorageNodes().getChildren().get("5").getAffinity().get().cpuSocket(), is(0));
}
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)

Aggregations

ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)22 Test (org.junit.Test)20 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)17 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)17 VespaModel (com.yahoo.vespa.model.VespaModel)6 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)4 VDSEngine (com.yahoo.vespa.model.content.engines.VDSEngine)4 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)4 HostResource (com.yahoo.vespa.model.HostResource)3 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 AttributesConfig (com.yahoo.vespa.config.search.AttributesConfig)2 IndexedSearchCluster (com.yahoo.vespa.model.search.IndexedSearchCluster)2 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)2 IndexInfoConfig (com.yahoo.search.config.IndexInfoConfig)1 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)1 IlscriptsConfig (com.yahoo.vespa.configdefinition.IlscriptsConfig)1