use of com.yahoo.vespa.config.search.core.PartitionsConfig 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"));
}
use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.
the class ClusterTest method requireThatSearchCoverageIsApplied.
@Test
public void requireThatSearchCoverageIsApplied() throws ParseException {
ContentCluster cluster = newContentCluster(joinLines("<search>", " <coverage>", " <minimum>0.11</minimum>", " <min-wait-after-coverage-factor>0.23</min-wait-after-coverage-factor>", " <max-wait-after-coverage-factor>0.58</max-wait-after-coverage-factor>", " </coverage>", "</search>"));
for (Dispatch tld : cluster.getSearch().getIndexed().getTLDs()) {
PartitionsConfig.Builder builder = new PartitionsConfig.Builder();
tld.getConfig(builder);
PartitionsConfig config = new PartitionsConfig(builder);
assertEquals(11.0, config.dataset(0).minimal_searchcoverage(), 1E-6);
assertEquals(0.23, config.dataset(0).higher_coverage_minsearchwait(), 1E-6);
assertEquals(0.58, config.dataset(0).higher_coverage_maxsearchwait(), 1E-6);
}
}
use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.
the class MultilevelDispatchTest method requireThatSearchCoverageIsSetInMultilevelSetup.
@Test
public void requireThatSearchCoverageIsSetInMultilevelSetup() throws Exception {
ContentCluster cr = createCluster(getSimpleDispatchXml() + getCoverage());
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));
assertEquals(95.0, config.dataset(0).minimal_searchcoverage(), 0.1);
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));
assertEquals(95.0, c.dataset(0).minimal_searchcoverage(), 0.1);
}
}
use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.
the class MultilevelDispatchTest method requireThatSearchCoverageIsSetInSingleLevelSetup.
@Test
public void requireThatSearchCoverageIsSetInSingleLevelSetup() throws Exception {
TestRoot root = new TestDriver(true).buildModel(new MockApplicationPackage.Builder().withServices("<services version='1.0'>" + "<content id='stateful' version='1.0'>" + " <redundancy>1</redundancy>" + " <documents><document mode='index' type='music' /></documents>" + " <nodes>" + " <node distribution-key='1' hostalias='mockroot' />" + " </nodes>" + " <search><coverage><minimum>0.95</minimum></coverage></search>" + "</content>" + "<jdisc id='foo' version='1.0'>" + " <search />" + " <nodes><node hostalias='mockroot' /></nodes>" + "</jdisc>" + "</services>").withSearchDefinition(MockApplicationPackage.MUSIC_SEARCHDEFINITION).build());
PartitionsConfig config = root.getConfig(PartitionsConfig.class, "stateful/search/cluster.stateful/tlds/foo.0.tld.0");
assertThat(config.dataset().size(), is(1));
assertEquals(95.0, config.dataset(0).minimal_searchcoverage(), 0.1);
}
use of com.yahoo.vespa.config.search.core.PartitionsConfig in project vespa by vespa-engine.
the class TldTest method requireThatUseLocalPolicyIsOk.
@Test
public void requireThatUseLocalPolicyIsOk() {
ApplicationPackage app = new MockApplicationPackage.Builder().withHosts("<hosts>" + "<host name='search.node1'><alias>search1</alias></host>" + "<host name='search.node2'><alias>search2</alias></host>" + "<host name='jdisc.host.other'><alias>gateway</alias></host>" + "</hosts>").withServices("<services>" + " <admin version='2.0'>" + " <adminserver hostalias='gateway' />" + " </admin>" + " <jdisc version='1.0' id='default'>" + " <search />" + " <nodes>" + " <node hostalias='search1'/>" + " <node hostalias='search2'/>" + " </nodes>" + " </jdisc>" + " <jdisc version='1.0' id='gw'>" + " <document-api/>" + " <nodes>" + " <node hostalias='gateway'/>" + " </nodes>" + " </jdisc>" + " <content version='1.0' id='foo'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='music' mode='index'/>" + " </documents>" + " <group name='topGroup'>" + " <distribution partitions='1|*'/>" + " <group name='group1' distribution-key='0'>" + " <node hostalias='search1' distribution-key='0'/>" + " </group>" + " <group name='group2' distribution-key='1'>" + " <node hostalias='search2' distribution-key='1'/>" + " </group>" + " </group>" + " <tuning>" + " <dispatch>" + " <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/gw.0.tld.0");
PartitionsConfig config = new PartitionsConfig(builder);
assertEquals(1, config.dataset().size());
// gateway TLD with no local search node gets all search nodes
assertEquals(2, config.dataset(0).engine().size());
// Load Balance row 0
assertEquals("rowid not equal 0", 0, config.dataset(0).engine(0).rowid());
assertEquals("partid not equal 0", 0, config.dataset(0).engine(0).partid());
assertTrue("Not configured with correct search node", config.dataset(0).engine(0).name_and_port().contains("search.node1"));
// Load Balance row 1
assertEquals("rowid not equal to 1", 1, config.dataset(0).engine(1).rowid());
assertEquals("partid no equal to 0", 0, config.dataset(0).engine(1).partid());
assertTrue("Not configured with correct search node", config.dataset(0).engine(1).name_and_port().contains("search.node2"));
// First container with a local search node
builder = new PartitionsConfig.Builder();
new TestDriver(true).buildModel(app).getConfig(builder, "foo/search/cluster.foo/tlds/default.0.tld.0");
config = new PartitionsConfig(builder);
assertEquals(1, config.dataset().size());
assertEquals(1, config.dataset(0).engine().size());
assertEquals(0, config.dataset(0).engine(0).rowid());
assertEquals(0, config.dataset(0).engine(0).partid());
assertTrue("Not configured with local search node as engine", config.dataset(0).engine(0).name_and_port().contains("search.node1"));
// Second container with a local search node
builder = new PartitionsConfig.Builder();
new TestDriver(true).buildModel(app).getConfig(builder, "foo/search/cluster.foo/tlds/default.1.tld.1");
config = new PartitionsConfig(builder);
assertEquals(1, config.dataset().size());
assertEquals(1, config.dataset(0).engine().size());
assertEquals(0, config.dataset(0).engine(0).rowid());
assertEquals(0, config.dataset(0).engine(0).partid());
assertTrue("Not configured with local search node as engine", config.dataset(0).engine(0).name_and_port().contains("search.node2"));
}
Aggregations