Search in sources :

Example 46 with ContentCluster

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());
}
Also used : VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 47 with ContentCluster

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());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 48 with ContentCluster

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());
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Example 49 with ContentCluster

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;
}
Also used : RoutingTableSpec(com.yahoo.messagebus.routing.RoutingTableSpec) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 50 with ContentCluster

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));
}
Also used : SearchNode(com.yahoo.vespa.model.search.SearchNode) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Test(org.junit.Test)

Aggregations

ContentCluster (com.yahoo.vespa.model.content.cluster.ContentCluster)83 Test (org.junit.Test)70 VespaModel (com.yahoo.vespa.model.VespaModel)22 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)20 ContentSearchCluster (com.yahoo.vespa.model.content.ContentSearchCluster)18 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)16 VespaModelTester (com.yahoo.vespa.model.test.VespaModelTester)15 MockRoot (com.yahoo.config.model.test.MockRoot)7 ContentClusterBuilder (com.yahoo.vespa.model.content.utils.ContentClusterBuilder)7 SearchDefinitionBuilder (com.yahoo.vespa.model.content.utils.SearchDefinitionBuilder)6 PartitionsConfig (com.yahoo.vespa.config.search.core.PartitionsConfig)5 HostResource (com.yahoo.vespa.model.HostResource)5 SearchNode (com.yahoo.vespa.model.search.SearchNode)5 Matchers.containsString (org.hamcrest.Matchers.containsString)5 StorDistributionConfig (com.yahoo.vespa.config.content.StorDistributionConfig)4 ProtonConfig (com.yahoo.vespa.config.search.core.ProtonConfig)4 ProtonEngine (com.yahoo.vespa.model.content.engines.ProtonEngine)4 VDSEngine (com.yahoo.vespa.model.content.engines.VDSEngine)4 StorServerConfig (com.yahoo.vespa.config.content.core.StorServerConfig)3 ConfigChangeAction (com.yahoo.config.model.api.ConfigChangeAction)2