Search in sources :

Example 21 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster 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 22 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster 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 23 with ContentCluster

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

the class IndexedSearchNodeNamingTest method requireThatMultipleNodesAreNamedAfterDistributionKey.

@Test
public void requireThatMultipleNodesAreNamedAfterDistributionKey() throws Exception {
    ContentCluster cluster = getMultiNodeCluster();
    List<SearchNode> nodes = cluster.getSearch().getSearchNodes();
    assertEquals(3, nodes.size());
    assertSearchNode("n5", "5", nodes.get(0));
    assertSearchNode("n3", "3", nodes.get(1));
    assertSearchNode("n7", "7", nodes.get(2));
}
Also used : SearchNode(com.yahoo.vespa.model.search.SearchNode) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 24 with ContentCluster

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

the class IndexedSearchNodeNamingTest method requireThatSingleNodeIsNamedAfterDistributionKey.

@Test
public void requireThatSingleNodeIsNamedAfterDistributionKey() throws Exception {
    ContentCluster cluster = getSingleNodeCluster();
    List<SearchNode> nodes = cluster.getSearch().getSearchNodes();
    assertSearchNode("n3", "3", nodes.get(0));
}
Also used : SearchNode(com.yahoo.vespa.model.search.SearchNode) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 25 with ContentCluster

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

the class ContentBuilderTest method ensureOverrideAppendedOnlyOnce.

@Test
@Ignore
public void ensureOverrideAppendedOnlyOnce() throws Exception {
    ContentCluster content = createContent("<content version='1.0' id='search'>" + "  <config name=\"vespa.config.search.core.proton\">" + "    <numthreadspersearch>1</numthreadspersearch>" + "    <search>" + "      <mmap>" + "        <options><item>POPULATE</item></options>" + "      </mmap>" + "    </search>" + "  </config>" + "  <redundancy>2</redundancy>" + "  <documents>" + "    <document type='music' mode='index'/>" + "  </documents>" + "  <group>" + "    <node hostalias='mockhost' distribution-key='0'/>" + "  </group>" + "</content>");
    ProtonConfig.Builder builder = new ProtonConfig.Builder();
    content.getSearch().getIndexed().getSearchNode(0).cascadeConfig(builder);
    content.getSearch().getIndexed().getSearchNode(0).addUserConfig(builder);
    ProtonConfig config = new ProtonConfig(builder);
    assertThat(config.search().mmap().options().size(), is(1));
    assertThat(config.search().mmap().options(0), is(ProtonConfig.Search.Mmap.Options.POPULATE));
}
Also used : ProtonConfig(com.yahoo.vespa.config.search.core.ProtonConfig) ConfigPayloadBuilder(com.yahoo.vespa.config.ConfigPayloadBuilder) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Ignore(org.junit.Ignore) 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