use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testUsingNodesAndGroupCountAttributesAndGettingJustOneNode.
@Test
public void testUsingNodesAndGroupCountAttributesAndGettingJustOneNode() throws ParseException {
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='3'>4</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='24' groups='3'/>" + " <engine><proton><searchable-copies>3</searchable-copies></proton></engine>" + " </content>" + "</services>";
// We only have 1 content node -> 1 groups with redundancy 1
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");
ContainerCluster clusterControllers = cluster.getClusterControllers();
assertEquals(1, clusterControllers.getContainers().size());
assertEquals("bar-controllers", clusterControllers.getName());
assertEquals("default01", clusterControllers.getContainers().get(0).getHostName());
// Reduced from 3*3
assertEquals(1, cluster.redundancy().effectiveInitialRedundancy());
// Reduced from 3*4
assertEquals(1, cluster.redundancy().effectiveFinalRedundancy());
// Reduced from 3*3
assertEquals(1, cluster.redundancy().effectiveReadyCopies());
// 1 group - > flattened -> no distribution
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 testCombinedCluster.
@Test
public void testCombinedCluster() {
String xmlWithNodes = "<?xml version='1.0' encoding='utf-8' ?>" + "<services>" + " <container version='1.0' id='container1'>" + " <search/>" + " <nodes of='content1'/>" + " </container>" + " <content version='1.0' id='content1'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester();
tester.addHosts(2);
VespaModel model = tester.createModel(xmlWithNodes, true);
assertEquals("Nodes in content1", 2, model.getContentClusters().get("content1").getRootGroup().getNodes().size());
assertEquals("Nodes in container1", 2, model.getContainerClusters().get("container1").getContainers().size());
assertEquals("Heap size is lowered with combined clusters", 17, physicalMemoryPercentage(model.getContainerClusters().get("container1")));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testExplicitNonDedicatedClusterControllers.
@Test
public void testExplicitNonDedicatedClusterControllers() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='4.0'/>" + " <container version='1.0' id='foo'>" + " <nodes count='10'/>" + " </container>" + " <content version='1.0' id='bar'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <controllers><nodes dedicated='false' count='6'/></controllers>" + " <nodes count='9' groups='3'/>" + " </content>" + "</services>";
int numberOfHosts = 19;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, true);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
// Check content clusters
ContentCluster cluster = model.getContentClusters().get("bar");
ContainerCluster clusterControllers = cluster.getClusterControllers();
assertEquals(8, cluster.distributionBits());
assertEquals("We get the closest odd number", 5, clusterControllers.getContainers().size());
assertEquals("bar-controllers", clusterControllers.getName());
assertEquals("default01", clusterControllers.getContainers().get(0).getHostName());
assertEquals("default02", clusterControllers.getContainers().get(1).getHostName());
assertEquals("default04", clusterControllers.getContainers().get(2).getHostName());
assertEquals("default05", clusterControllers.getContainers().get(3).getHostName());
assertEquals("default07", clusterControllers.getContainers().get(4).getHostName());
assertEquals("default09", cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getHostName());
assertEquals("default08", cluster.getRootGroup().getSubgroups().get(0).getNodes().get(1).getHostName());
assertEquals("default06", cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getHostName());
assertEquals("default03", cluster.getRootGroup().getSubgroups().get(2).getNodes().get(0).getHostName());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testNoNodeTagMeans1NodeNoContent.
@Test
public void testNoNodeTagMeans1NodeNoContent() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <jdisc id='foo' version='1.0'>" + " <search/>" + " <document-api/>" + " </jdisc>" + "</services>";
VespaModelTester tester = new VespaModelTester();
tester.addHosts(1);
VespaModel model = tester.createModel(services, true);
assertEquals(1, model.getRoot().getHostSystem().getHosts().size());
assertEquals(1, model.getAdmin().getSlobroks().size());
assertEquals(1, model.getContainerClusters().get("foo").getContainers().size());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class ModelProvisioningTest method testSingleNodeNonHosted.
@Test
public void testSingleNodeNonHosted() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <jdisc id='foo' version='1.0'>" + " <search/>" + " <document-api/>" + " <nodes><node hostalias='foo'/></nodes>" + " </jdisc>" + " <content version='1.0' id='bar'>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes><node hostalias='foo' distribution-key='0'/></nodes>" + " </content>" + "</services>";
VespaModelTester tester = new VespaModelTester();
tester.setHosted(false);
tester.addHosts(1);
VespaModel model = tester.createModel(services, true);
assertEquals(1, model.getRoot().getHostSystem().getHosts().size());
assertEquals(1, model.getAdmin().getSlobroks().size());
assertEquals(1, model.getContainerClusters().get("foo").getContainers().size());
assertEquals(1, model.getContentClusters().get("bar").getRootGroup().countNodes());
}
Aggregations