Search in sources :

Example 1 with ContentCluster

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

the class ApplicationConfigProducerRoot method getConfig.

@Override
public void getConfig(ClusterListConfig.Builder builder) {
    VespaModel model = (VespaModel) getRoot();
    for (ContentCluster cluster : model.getContentClusters().values()) {
        ClusterListConfig.Storage.Builder storage = new ClusterListConfig.Storage.Builder();
        storage.name(cluster.getName());
        storage.configid(cluster.getConfigId());
        builder.storage(storage);
    }
}
Also used : ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 2 with ContentCluster

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

the class IndexingModeChangeValidator method validate.

@Override
public List<ConfigChangeAction> validate(VespaModel currentModel, VespaModel nextModel, ValidationOverrides overrides, Instant now) {
    List<ConfigChangeAction> actions = new ArrayList<>();
    for (Map.Entry<String, ContentCluster> currentEntry : currentModel.getContentClusters().entrySet()) {
        ContentCluster nextCluster = nextModel.getContentClusters().get(currentEntry.getKey());
        if (nextCluster == null)
            continue;
        Optional<ConfigChangeAction> change = validateContentCluster(currentEntry.getValue(), nextCluster, overrides, now);
        if (change.isPresent())
            actions.add(change.get());
    }
    return actions;
}
Also used : ArrayList(java.util.ArrayList) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) Map(java.util.Map) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 3 with ContentCluster

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

the class ClusterSizeReductionValidator method validate.

@Override
public List<ConfigChangeAction> validate(VespaModel current, VespaModel next, ValidationOverrides overrides, Instant now) {
    for (ContainerCluster currentCluster : current.getContainerClusters().values()) {
        ContainerCluster nextCluster = next.getContainerClusters().get(currentCluster.getName());
        if (nextCluster == null)
            continue;
        validate(currentCluster.getContainers().size(), nextCluster.getContainers().size(), currentCluster.getName(), overrides, now);
    }
    for (ContentCluster currentCluster : current.getContentClusters().values()) {
        ContentCluster nextCluster = next.getContentClusters().get(currentCluster.getName());
        if (nextCluster == null)
            continue;
        validate(currentCluster.getSearch().getSearchNodes().size(), nextCluster.getSearch().getSearchNodes().size(), currentCluster.getName(), overrides, now);
    }
    return Collections.emptyList();
}
Also used : ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster)

Example 4 with ContentCluster

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

the class ModelProvisioningTest method testUsingNodesCountAttributesAndGettingTooFewNodes.

@Test
public void testUsingNodesCountAttributesAndGettingTooFewNodes() {
    String services = "<?xml version='1.0' encoding='utf-8' ?>" + "<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 = 4;
    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(4, cluster.redundancy().effectiveInitialRedundancy());
    assertEquals(4, cluster.redundancy().effectiveFinalRedundancy());
    assertEquals(4, cluster.redundancy().effectiveReadyCopies());
    assertEquals(4, cluster.getSearch().getIndexed().getDispatchSpec().getGroups().size());
    assertFalse(cluster.getRootGroup().getPartitions().isPresent());
    assertEquals(4, cluster.getRootGroup().getNodes().size());
    assertEquals(0, cluster.getRootGroup().getSubgroups().size());
    assertThat(cluster.getRootGroup().getNodes().size(), is(4));
    assertThat(cluster.getRootGroup().getNodes().get(0).getDistributionKey(), is(0));
    assertThat(cluster.getRootGroup().getNodes().get(0).getConfigId(), is("bar/storage/0"));
    assertThat(cluster.getRootGroup().getNodes().get(1).getDistributionKey(), is(1));
    assertThat(cluster.getRootGroup().getNodes().get(1).getConfigId(), is("bar/storage/1"));
    assertThat(cluster.getRootGroup().getNodes().get(2).getDistributionKey(), is(2));
    assertThat(cluster.getRootGroup().getNodes().get(2).getConfigId(), is("bar/storage/2"));
    assertThat(cluster.getRootGroup().getNodes().get(3).getDistributionKey(), is(3));
    assertThat(cluster.getRootGroup().getNodes().get(3).getConfigId(), is("bar/storage/3"));
}
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 5 with ContentCluster

use of com.yahoo.vespa.model.content.cluster.ContentCluster 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"));
}
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)

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