use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ModelProvisioningTest method testMultitenantButNotHosted.
/**
* Recreate the combination used in some factory tests
*/
@Test
public void testMultitenantButNotHosted() {
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>";
VespaModel model = createNonProvisionedMultitenantModel(services);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(1));
ContentCluster content = model.getContentClusters().get("storage");
assertEquals(2, content.getRootGroup().getNodes().size());
ContainerCluster controller = content.getClusterControllers();
assertEquals(1, controller.getContainers().size());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ModelProvisioningTest method test2ContentNodesProduces1ClusterController.
@Test
public void test2ContentNodesProduces1ClusterController() {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <content version='1.0' id='bar'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <nodes count='2'/>" + " </content>" + "</services>";
int numberOfHosts = 2;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, true);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
ContentCluster cluster = model.getContentClusters().get("bar");
ContainerCluster clusterControllers = cluster.getClusterControllers();
assertEquals(1, clusterControllers.getContainers().size());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class ModelProvisioningTest method testClusterControllersCanSupplementWithAllContainerClusters.
@Test
public void testClusterControllersCanSupplementWithAllContainerClusters() throws ParseException {
String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + " <admin version='4.0'/>" + " <container version='1.0' id='foo1'>" + " <nodes count='2'/>" + " </container>" + " <container version='1.0' id='foo2'>" + " <nodes count='1'/>" + " </container>" + " <content version='1.0' id='bar'>" + " <redundancy>2</redundancy>" + " <documents>" + " <document type='type1' mode='index'/>" + " </documents>" + " <controllers><nodes dedicated='false' count='5'/></controllers>" + " <nodes count='2'/>" + " </content>" + "</services>";
int numberOfHosts = 5;
VespaModelTester tester = new VespaModelTester();
tester.addHosts(numberOfHosts);
VespaModel model = tester.createModel(services, true);
assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
ContentCluster cluster = model.getContentClusters().get("bar");
ContainerCluster clusterControllers = cluster.getClusterControllers();
// TODO: Expected 5 with this feature reactivated
assertEquals(1, clusterControllers.getContainers().size());
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class DocumentProtocol method createRoutingTable.
/**
* This function extrapolates any routes for the document protocol that it can from the vespa model.
*
* @param plugins All initialized plugins of the vespa model.
* @return Routing table for the document protocol.
*/
private static RoutingTableSpec createRoutingTable(ConfigModelRepo plugins) {
// Build simple hops and routes.
List<ContentCluster> content = Content.getContentClusters(plugins);
Collection<ContainerCluster> containerClusters = ContainerModel.containerClusters(plugins);
RoutingTableSpec table = new RoutingTableSpec(NAME);
addContainerClusterDocprocHops(containerClusters, table);
addContentRouting(content, table);
// Build the indexing hop if it is possible to derive.
addIndexingHop(content, table);
// Build the default route if is is possible to derive.
addDefaultRoute(content, containerClusters, table);
// Return the complete routing table.
simplifyRouteNames(table);
return table;
}
use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.
the class IndexedSearchNodeNamingTest method requireThatNodesInHierarchicGroupsAreNamedAfterDistributionKey.
@Test
public void requireThatNodesInHierarchicGroupsAreNamedAfterDistributionKey() throws Exception {
ContentCluster cluster = getMultiGroupCluster();
List<SearchNode> nodes = cluster.getSearch().getSearchNodes();
assertEquals(4, nodes.size());
assertSearchNode("n7", "7", nodes.get(0));
assertSearchNode("n11", "11", nodes.get(1));
assertSearchNode("n17", "17", nodes.get(2));
assertSearchNode("n13", "13", nodes.get(3));
}
Aggregations