Search in sources :

Example 6 with PartitionsConfig

use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.

the class ContentBuilderTest method testMultipleSearchNodesOnSameHost.

@Test
public void testMultipleSearchNodesOnSameHost() throws Exception {
    String services = getServices("<node hostalias='mockhost' distribution-key='0'/>" + "<node hostalias='mockhost' distribution-key='1'/>");
    VespaModel m = new VespaModelCreatorWithMockPkg(createAppWithMusic(getHosts(), services)).create();
    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"));
    IndexedSearchCluster sc = m.getContentClusters().get("clu").getSearch().getIndexed();
    assertEquals(2, sc.getSearchNodeCount());
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) Matchers.containsString(org.hamcrest.Matchers.containsString) PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 7 with PartitionsConfig

use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.

the class ContentBuilderTest method testConfigIdLookup.

@Test
public void testConfigIdLookup() throws Exception {
    VespaModel m = new VespaModelCreatorWithMockPkg(createAppWithMusic(getHosts(), getBasicServices())).create();
    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 : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 8 with PartitionsConfig

use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.

the class DispatchUtils method getDataset.

public static PartitionsConfig.Dataset getDataset(Dispatch dispatch) {
    PartitionsConfig.Builder builder = new PartitionsConfig.Builder();
    dispatch.getConfig(builder);
    PartitionsConfig cfg = new PartitionsConfig(builder);
    assertEquals(1, cfg.dataset().size());
    return cfg.dataset(0);
}
Also used : PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig)

Example 9 with PartitionsConfig

use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.

the class MultilevelDispatchTest method requireThatMaxHitsIsScaled.

@Test
public void requireThatMaxHitsIsScaled() throws Exception {
    ContentCluster cr = createCluster(getSimpleDispatchXml() + getMaxhitsTuning());
    IndexedSearchCluster ix = cr.getSearch().getIndexed();
    Dispatch tld = cr.getSearch().getIndexed().getTLDs().get(0);
    PartitionsConfig.Builder builder = new PartitionsConfig.Builder();
    tld.getConfig(builder);
    PartitionsConfig config = new PartitionsConfig(builder);
    assertThat(config.dataset().size(), is(1));
    assertThat(config.dataset(0).maxhitspernode(), is(300));
    for (Dispatch dispatch : getDispatchers(tld)) {
        PartitionsConfig.Builder b = new PartitionsConfig.Builder();
        dispatch.getConfig(b);
        PartitionsConfig c = new PartitionsConfig(b);
        assertThat(c.dataset().size(), is(1));
        assertThat(c.dataset(0).maxhitspernode(), is(100));
    }
}
Also used : PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 10 with PartitionsConfig

use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.

the class TldTest method requireThatServicesIsParsed.

@Test
public void requireThatServicesIsParsed() {
    ApplicationPackage app = new MockApplicationPackage.Builder().withHosts("<hosts><host name='localhost'><alias>mockhost</alias></host><host name='my.other.host'><alias>mockhost2</alias></host></hosts>").withServices("<services>" + "  <admin version='2.0'>" + "    <adminserver hostalias='mockhost' />" + "  </admin>" + "  <jdisc version='1.0' id='default'>" + "    <search />" + "    <nodes>" + "      <node hostalias='mockhost'/>" + "    </nodes>" + "  </jdisc>" + "  <content version='1.0' id='foo'>" + "    <redundancy>1</redundancy>" + "    <documents>" + "      <document type='music' mode='index'/>" + "    </documents>" + "    <group>" + "      <node hostalias='mockhost' distribution-key='0'/>" + "      <node hostalias='mockhost2' distribution-key='1'/>" + "    </group>" + "    <tuning>" + "      <dispatch>" + "        <max-hits-per-partition>69</max-hits-per-partition>" + "        <use-local-node>true</use-local-node>" + "      </dispatch>" + "    </tuning>" + "  </content>" + "</services>").withSearchDefinition(MockApplicationPackage.MUSIC_SEARCHDEFINITION).build();
    PartitionsConfig.Builder builder = new PartitionsConfig.Builder();
    new TestDriver(true).buildModel(app).getConfig(builder, "foo/search/cluster.foo/tlds/default.0.tld.0");
    PartitionsConfig config = new PartitionsConfig(builder);
    assertEquals(1, config.dataset().size());
    assertEquals(69, config.dataset(0).maxhitspernode());
    assertEquals(1, config.dataset(0).engine().size());
}
Also used : PartitionsConfig(com.yahoo.vespa.config.search.core.PartitionsConfig) ApplicationPackage(com.yahoo.config.application.api.ApplicationPackage) MockApplicationPackage(com.yahoo.config.model.test.MockApplicationPackage) TestDriver(com.yahoo.config.model.test.TestDriver) Test(org.junit.Test)

Aggregations

PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)10 Test (org.junit.Test)9 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)3 TestDriver (com.yahoo.config.model.test.TestDriver)3 VespaModel (com.yahoo.vespa.model.VespaModel)3 ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)3 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)3 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)2 MockApplicationPackage (com.yahoo.config.model.test.MockApplicationPackage)2 Matchers.containsString (org.hamcrest.Matchers.containsString)2 TestRoot (com.yahoo.config.model.test.TestRoot)1 SearchBuilder (com.yahoo.searchdefinition.SearchBuilder)1 HostResource (com.yahoo.vespa.model.HostResource)1 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)1 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)1 Dispatch (com.yahoo.vespa.model.search.Dispatch)1