use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testSlobroksAreSpreadOverAllContainerClustersExceptNodeAdmin.
@Test
public void testSlobroksAreSpreadOverAllContainerClustersExceptNodeAdmin() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='4.0'/>" + " <container version='1.0' id='routing'>" + " <nodes count='10'/>" + " </container>" + " <container version='1.0' id='node-admin'>" + " <nodes count='3'/>" + " </container>" + "</services>";
int numberOfHosts = 13;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
tester.setApplicationId("hosted-vespa", "routing", "default");
VespaModel model = tester.createModel(services, true);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
Set<String> routingHosts = getClusterHostnames(model, "routing");
assertEquals(10, routingHosts.size());
Set<String> nodeAdminHosts = getClusterHostnames(model, "node-admin");
assertEquals(3, nodeAdminHosts.size());
Set<String> slobrokHosts = model.getAdmin().getSlobroks().stream().map(AbstractService::getHostName).collect(Collectors.toSet());
assertEquals(3, slobrokHosts.size());
assertThat(slobrokHosts, everyItem(isIn(routingHosts)));
assertThat(slobrokHosts, everyItem(not(isIn(nodeAdminHosts))));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testUsingNodesCountAttributesAndGettingJustOneNode.
@Test
public void testUsingNodesCountAttributesAndGettingJustOneNode() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='3.0'>" + // Ignored
" <nodes count='3'/>" + " </admin>" + " <content version='1.0' id='bar'>" + " <redundancy reply-after='8'>12</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='24'/>" + " <engine><proton><searchable-copies>5</searchable-copies></proton></engine>" + " <dispatch><num-dispatch-groups>7</num-dispatch-groups></dispatch>" + " </content>" + "</services>";
int numberOfHosts = 1;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, false);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
ContentCluster cluster = model.getContentClusters().get("bar");
assertEquals(1, cluster.redundancy().effectiveInitialRedundancy());
assertEquals(1, cluster.redundancy().effectiveFinalRedundancy());
assertEquals(1, cluster.redundancy().effectiveReadyCopies());
assertEquals(1, cluster.getSearch().getIndexed().getDispatchSpec().getGroups().size());
assertFalse(cluster.getRootGroup().getPartitions().isPresent());
assertEquals(1, cluster.getRootGroup().getNodes().size());
assertEquals(0, cluster.getRootGroup().getSubgroups().size());
assertThat(cluster.getRootGroup().getNodes().size(), is(1));
assertThat(cluster.getRootGroup().getNodes().get(0).getDistributionKey(), is(0));
assertThat(cluster.getRootGroup().getNodes().get(0).getConfigId(), is("bar/storage/0"));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testThatTldConfigIdsAreDeterministic.
@Test
public void testThatTldConfigIdsAreDeterministic() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='4.0'/>" + " <jdisc version='1.0' id='jdisc0'>" + " <search/>" + " <nodes count='2'/>" + " </jdisc>" + " <jdisc version='1.0' id='jdisc1'>" + " <search/>" + " <nodes count='2'/>" + " </jdisc>" + " <content version='1.0' id='content0'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + " <content version='1.0' id='content1'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + "</services>";
int numberOfHosts = 8;
{
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
// Nodes used will be default0, default1, .. and so on.
VespaModel model = tester.createModel(services, true);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
Map<String, ContentCluster> contentClusters = model.getContentClusters();
assertEquals(2, contentClusters.size());
checkThatTldAndContainerRunningOnSameHostHaveSameId(model.getContainerClusters().values(), model.getContentClusters().values(), 0);
}
{
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts + 1);
// Start numbering nodes with index 1 and retire first node
// Nodes used will be default1, default2, .. and so on. Containers will start with index 1, not 0 as they are in the test above
VespaModel model = tester.createModel(services, true, 1, "default0");
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
Map<String, ContentCluster> contentClusters = model.getContentClusters();
assertEquals(2, contentClusters.size());
checkThatTldAndContainerRunningOnSameHostHaveSameId(model.getContainerClusters().values(), model.getContentClusters().values(), 1);
}
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ClusterTest method testEndToEndOneNode.
@Test
public void testEndToEndOneNode() throws Exception {
String services = "<?xml version='1.0' encoding='UTF-8' ?>" + "<services version='1.0'>" + " <admin version='2.0'>" + " <adminserver hostalias='node1'/>" + " </admin>" + " <jdisc id='default' version='1.0'>" + " <search/>" + " <nodes>" + " <node hostalias='node1'/>" + " </nodes>" + " </jdisc>" + " <content id='storage' version='1.0'>" + " <redundancy>2</redundancy>" + " <group>" + " <node distribution-key='0' hostalias='node1'/>" + " <node distribution-key='1' hostalias='node1'/>" + " </group>" + " <tuning>" + " <cluster-controller>" + " <transition-time>0</transition-time>" + " </cluster-controller>" + " </tuning>" + " <documents>" + " <document mode='store-only' type='type1'/>" + " </documents>" + " <engine>" + " <proton/>" + " </engine>" + " </content>" + " </services>";
List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1");
VespaModel model = (new VespaModelCreatorWithMockPkg(null, services, sds)).create();
assertEquals(1, model.getContentClusters().get("storage").getDocumentDefinitions().size());
ContainerCluster cluster = model.getAdmin().getClusterControllers();
assertEquals(1, cluster.getContainers().size());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ClusterTest method testSearchTuning.
@Test
public void testSearchTuning() throws Exception {
String xml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n" + "<services>\n" + "\n" + " <admin version=\"2.0\">\n" + " <adminserver hostalias=\"node0\" />\n" + " <cluster-controllers>\n" + " <cluster-controller hostalias=\"node0\"/>" + " </cluster-controllers>\n" + " </admin>\n" + " <content version='1.0' id='bar'>" + " <redundancy>1</redundancy>\n" + " <documents>" + " <document type=\"type1\" mode='index'/>\n" + " <document type=\"type2\" mode='index'/>\n" + " </documents>\n" + " <group>" + " <node hostalias='node0' distribution-key='0'/>" + " </group>" + " <tuning>\n" + " <cluster-controller>" + " <init-progress-time>34567</init-progress-time>" + " </cluster-controller>" + " </tuning>" + " </content>" + "\n" + "</services>";
List<String> sds = ApplicationPackageUtils.generateSearchDefinitions("type1", "type2");
VespaModel model = new VespaModelCreatorWithMockPkg(getHosts(), xml, sds).create();
assertTrue(model.getContentClusters().get("bar").getPersistence() instanceof ProtonEngine.Factory);
{
StorDistributormanagerConfig.Builder builder = new StorDistributormanagerConfig.Builder();
model.getConfig(builder, "bar/distributor/0");
StorDistributormanagerConfig config = new StorDistributormanagerConfig(builder);
assertEquals(false, config.inlinebucketsplitting());
}
{
StorFilestorConfig.Builder builder = new StorFilestorConfig.Builder();
model.getConfig(builder, "bar/storage/0");
StorFilestorConfig config = new StorFilestorConfig(builder);
assertEquals(false, config.enable_multibit_split_optimalization());
}
}
Aggregations