Search in sources :

Example 11 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ModelProvisioningTest method test2ContentNodesWithContainerClusterProducesMixedClusterControllerCluster.

@Test
public void test2ContentNodesWithContainerClusterProducesMixedClusterControllerCluster() throws ParseException {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <container version='1.0' id='foo'>" + "     <nodes count='3'/>" + "  </container>" + "  <content version='1.0' id='bar'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='2'/>" + "  </content>" + "</services>";
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(5);
    VespaModel model = tester.createModel(services, true);
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    // TODO: Expected 3 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 12 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ModelProvisioningTest method testClusterControllersWithGroupSize2.

@Test
public void testClusterControllersWithGroupSize2() {
    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>" + "     <nodes count='8' groups='4'/>" + "  </content>" + "</services>";
    int numberOfHosts = 18;
    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("We get the closest odd number", 3, clusterControllers.getContainers().size());
    assertEquals("bar-controllers", clusterControllers.getName());
    assertEquals("default01", clusterControllers.getContainers().get(0).getHostName());
    assertEquals("default03", clusterControllers.getContainers().get(1).getHostName());
    assertEquals("default08", clusterControllers.getContainers().get(2).getHostName());
}
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 13 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class ModelProvisioningTest method testExplicitDedicatedClusterControllers.

@Test
public void testExplicitDedicatedClusterControllers() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>\n" + "<services>" + "  <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='true' count='4'/></controllers>" + "     <nodes count='9' groups='3'/>" + "  </content>" + "</services>";
    int numberOfHosts = 23;
    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(4, clusterControllers.getContainers().size());
    assertEquals("bar-controllers", clusterControllers.getName());
    assertEquals("default04", clusterControllers.getContainers().get(0).getHostName());
    assertEquals("default03", clusterControllers.getContainers().get(1).getHostName());
    assertEquals("default02", clusterControllers.getContainers().get(2).getHostName());
    assertEquals("default01", clusterControllers.getContainers().get(3).getHostName());
}
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 14 with ContentCluster

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

Example 15 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster in project vespa by vespa-engine.

the class DocumentProtocol method addContentRouting.

/**
 * Create hops to all configured storage nodes for the Document protocol. The "Distributor" policy resolves its
 * recipients using slobrok lookups, so it requires no configured recipients.
 *
 * @param content The storage model from {@link com.yahoo.vespa.model.VespaModel}.
 * @param table   The routing table to add to.
 */
private static void addContentRouting(List<ContentCluster> content, RoutingTableSpec table) {
    for (ContentCluster cluster : content) {
        RouteSpec spec = new RouteSpec(cluster.getConfigId());
        if (cluster.getSearch().hasIndexedCluster()) {
            table.addRoute(spec.addHop("[MessageType:" + cluster.getConfigId() + "]"));
            table.addRoute(new RouteSpec(getIndexedRouteName(cluster.getConfigId())).addHop(cluster.getSearch().getIndexed().getIndexingServiceName()).addHop("[Content:cluster=" + cluster.getName() + "]"));
            table.addRoute(new RouteSpec(getDirectRouteName(cluster.getConfigId())).addHop("[Content:cluster=" + cluster.getName() + "]"));
        } else {
            table.addRoute(spec.addHop("[Content:cluster=" + cluster.getName() + "]"));
        }
        table.addRoute(new RouteSpec("storage/cluster." + cluster.getName()).addHop("route:" + cluster.getConfigId()));
    }
}
Also used : RouteSpec(com.yahoo.messagebus.routing.RouteSpec) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

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