Search in sources :

Example 41 with ContentCluster

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

the class IndexedSearchClusterChangeValidator method validateDocumentDatabases.

private static List<ConfigChangeAction> validateDocumentDatabases(ContentCluster currentCluster, ContentCluster nextCluster, ValidationOverrides overrides, Instant now) {
    List<ConfigChangeAction> result = new ArrayList<>();
    for (DocumentDatabase currentDb : getDocumentDbs(currentCluster.getSearch())) {
        String docTypeName = currentDb.getName();
        Optional<DocumentDatabase> nextDb = nextCluster.getSearch().getIndexed().getDocumentDbs().stream().filter(db -> db.getName().equals(docTypeName)).findFirst();
        if (nextDb.isPresent()) {
            result.addAll(validateDocumentDatabase(currentCluster, nextCluster, docTypeName, currentDb, nextDb.get(), overrides, now));
        }
    }
    return result;
}
Also used : ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) java.util(java.util) Instant(java.time.Instant) DocumentDatabaseChangeValidator(com.yahoo.vespa.model.application.validation.change.search.DocumentDatabaseChangeValidator) ContentCluster(com.yahoo.vespa.model.content.cluster.ContentCluster) Collectors(java.util.stream.Collectors) IndexedSearchCluster(com.yahoo.vespa.model.search.IndexedSearchCluster) VespaModel(com.yahoo.vespa.model.VespaModel) ValidationOverrides(com.yahoo.config.application.api.ValidationOverrides) ContentSearchCluster(com.yahoo.vespa.model.content.ContentSearchCluster) NewDocumentType(com.yahoo.documentmodel.NewDocumentType) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase) ServiceInfo(com.yahoo.config.model.api.ServiceInfo) ConfigChangeAction(com.yahoo.config.model.api.ConfigChangeAction) DocumentDatabase(com.yahoo.vespa.model.search.DocumentDatabase)

Example 42 with ContentCluster

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

the class ModelProvisioningTest method testMultitenantButNotHostedSharedContentNode.

@Test
public void testMultitenantButNotHostedSharedContentNode() {
    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>" + "   <content id='search' version='1.0'>" + "     <redundancy>2</redundancy>" + "     <group>" + "       <node distribution-key='0' hostalias='node1'/>" + "     </group>" + "     <documents>" + "       <document type='type1'/>" + "     </documents>" + "   </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 43 with ContentCluster

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

the class ModelProvisioningTest method testClusterControllersAreNotPlacedOnRetiredNodes.

@Test
public void testClusterControllersAreNotPlacedOnRetiredNodes() {
    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='9' groups='3'/>" + "  </content>" + "</services>";
    int numberOfHosts = 19;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true, "default09", "default06", "default03");
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    // Check content clusters
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    assertEquals(3, clusterControllers.getContainers().size());
    assertEquals("bar-controllers", clusterControllers.getName());
    assertEquals("Skipping retired default09", "default01", clusterControllers.getContainers().get(0).getHostName());
    assertEquals("Skipping retired default03", "default04", clusterControllers.getContainers().get(1).getHostName());
    assertEquals("Skipping retired default06", "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 44 with ContentCluster

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

the class ModelProvisioningTest method testUsingNodesAndGroupCountAttributesAndGettingTooFewNodes.

@Test
public void testUsingNodesAndGroupCountAttributesAndGettingTooFewNodes() {
    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='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 6 content nodes -> 3 groups with redundancy 2 in each
    int numberOfHosts = 6;
    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");
    // Reduced from 3*3
    assertEquals(2 * 3, cluster.redundancy().effectiveInitialRedundancy());
    // Reduced from 3*4
    assertEquals(2 * 3, cluster.redundancy().effectiveFinalRedundancy());
    // Reduced from 3*3
    assertEquals(2 * 3, cluster.redundancy().effectiveReadyCopies());
    // Reduced from 4|4|*
    assertEquals("2|2|*", cluster.getRootGroup().getPartitions().get());
    assertEquals(0, cluster.getRootGroup().getNodes().size());
    assertEquals(3, cluster.getRootGroup().getSubgroups().size());
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getIndex(), is("0"));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().size(), is(2));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getDistributionKey(), is(0));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getConfigId(), is("bar/storage/0"));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(1).getDistributionKey(), is(1));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(1).getConfigId(), is("bar/storage/1"));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getIndex(), is("1"));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().size(), is(2));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getDistributionKey(), is(2));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getConfigId(), is("bar/storage/2"));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(1).getDistributionKey(), is(3));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(1).getConfigId(), is("bar/storage/3"));
    assertThat(cluster.getRootGroup().getSubgroups().get(2).getIndex(), is("2"));
    assertThat(cluster.getRootGroup().getSubgroups().get(2).getNodes().size(), is(2));
    assertThat(cluster.getRootGroup().getSubgroups().get(2).getNodes().get(0).getDistributionKey(), is(4));
    assertThat(cluster.getRootGroup().getSubgroups().get(2).getNodes().get(0).getConfigId(), is("bar/storage/4"));
    assertThat(cluster.getRootGroup().getSubgroups().get(2).getNodes().get(1).getDistributionKey(), is(5));
    assertThat(cluster.getRootGroup().getSubgroups().get(2).getNodes().get(1).getConfigId(), is("bar/storage/5"));
}
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 45 with ContentCluster

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

the class ModelProvisioningTest method testUsingNodesAndGroupCountAttributes.

@Test
public void testUsingNodesAndGroupCountAttributes() {
    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='27' groups='9'/>" + "  </content>" + "  <content version='1.0' id='baz'>" + "     <redundancy>1</redundancy>" + "     <documents>" + "       <document type='type1' mode='index'/>" + "     </documents>" + "     <nodes count='27' groups='27'/>" + "   </content>" + "</services>";
    int numberOfHosts = 64;
    VespaModelTester tester = new VespaModelTester();
    tester.addHosts(numberOfHosts);
    VespaModel model = tester.createModel(services, true);
    assertThat(model.getRoot().getHostSystem().getHosts().size(), is(numberOfHosts));
    // Check container cluster
    assertEquals(1, model.getContainerClusters().size());
    Set<com.yahoo.vespa.model.Host> containerHosts = model.getContainerClusters().get("foo").getContainers().stream().map(Container::getHost).collect(Collectors.toSet());
    assertEquals(10, containerHosts.size());
    // Check admin clusters
    Admin admin = model.getAdmin();
    Set<com.yahoo.vespa.model.Host> slobrokHosts = admin.getSlobroks().stream().map(Slobrok::getHost).collect(Collectors.toSet());
    assertEquals(3, slobrokHosts.size());
    assertTrue("Slobroks are assigned from container nodes", containerHosts.containsAll(slobrokHosts));
    assertTrue("Logserver is assigned from container nodes", containerHosts.contains(admin.getLogserver().getHost()));
    assertEquals("No in-cluster config servers in a hosted environment", 0, admin.getConfigservers().size());
    assertEquals("No admin cluster controller when multitenant", null, admin.getClusterControllers());
    // Check content clusters
    ContentCluster cluster = model.getContentClusters().get("bar");
    ContainerCluster clusterControllers = cluster.getClusterControllers();
    assertEquals(3, clusterControllers.getContainers().size());
    assertEquals("bar-controllers", clusterControllers.getName());
    assertEquals("default28", clusterControllers.getContainers().get(0).getHostName());
    assertEquals("default31", clusterControllers.getContainers().get(1).getHostName());
    assertEquals("default54", clusterControllers.getContainers().get(2).getHostName());
    assertEquals(0, cluster.getRootGroup().getNodes().size());
    assertEquals(9, cluster.getRootGroup().getSubgroups().size());
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getIndex(), is("0"));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().size(), is(3));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getDistributionKey(), is(0));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getConfigId(), is("bar/storage/0"));
    assertEquals("default54", cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getHostName());
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(1).getDistributionKey(), is(1));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(1).getConfigId(), is("bar/storage/1"));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(2).getDistributionKey(), is(2));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(2).getConfigId(), is("bar/storage/2"));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getIndex(), is("1"));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().size(), is(3));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getDistributionKey(), is(3));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getConfigId(), is("bar/storage/3"));
    assertEquals("default51", cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getHostName());
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(1).getDistributionKey(), is(4));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(1).getConfigId(), is("bar/storage/4"));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(2).getDistributionKey(), is(5));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(2).getConfigId(), is("bar/storage/5"));
    // ...
    assertEquals("default48", cluster.getRootGroup().getSubgroups().get(2).getNodes().get(0).getHostName());
    // ...
    assertThat(cluster.getRootGroup().getSubgroups().get(8).getIndex(), is("8"));
    assertThat(cluster.getRootGroup().getSubgroups().get(8).getNodes().size(), is(3));
    assertThat(cluster.getRootGroup().getSubgroups().get(8).getNodes().get(0).getDistributionKey(), is(24));
    assertThat(cluster.getRootGroup().getSubgroups().get(8).getNodes().get(0).getConfigId(), is("bar/storage/24"));
    assertThat(cluster.getRootGroup().getSubgroups().get(8).getNodes().get(1).getDistributionKey(), is(25));
    assertThat(cluster.getRootGroup().getSubgroups().get(8).getNodes().get(1).getConfigId(), is("bar/storage/25"));
    assertThat(cluster.getRootGroup().getSubgroups().get(8).getNodes().get(2).getDistributionKey(), is(26));
    assertThat(cluster.getRootGroup().getSubgroups().get(8).getNodes().get(2).getConfigId(), is("bar/storage/26"));
    cluster = model.getContentClusters().get("baz");
    clusterControllers = cluster.getClusterControllers();
    assertEquals(3, clusterControllers.getContainers().size());
    assertEquals("baz-controllers", clusterControllers.getName());
    assertEquals("default01", clusterControllers.getContainers().get(0).getHostName());
    assertEquals("default02", clusterControllers.getContainers().get(1).getHostName());
    assertEquals("default27", clusterControllers.getContainers().get(2).getHostName());
    assertEquals(0, cluster.getRootGroup().getNodes().size());
    assertEquals(27, cluster.getRootGroup().getSubgroups().size());
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getIndex(), is("0"));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().size(), is(1));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getDistributionKey(), is(0));
    assertThat(cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getConfigId(), is("baz/storage/0"));
    assertEquals("default27", cluster.getRootGroup().getSubgroups().get(0).getNodes().get(0).getHostName());
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getIndex(), is("1"));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().size(), is(1));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getDistributionKey(), is(1));
    assertThat(cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getConfigId(), is("baz/storage/1"));
    assertEquals("default26", cluster.getRootGroup().getSubgroups().get(1).getNodes().get(0).getHostName());
    // ...
    assertEquals("default25", cluster.getRootGroup().getSubgroups().get(2).getNodes().get(0).getHostName());
    // ...
    assertThat(cluster.getRootGroup().getSubgroups().get(26).getIndex(), is("26"));
    assertThat(cluster.getRootGroup().getSubgroups().get(26).getNodes().size(), is(1));
    assertThat(cluster.getRootGroup().getSubgroups().get(26).getNodes().get(0).getDistributionKey(), is(26));
    assertThat(cluster.getRootGroup().getSubgroups().get(26).getNodes().get(0).getConfigId(), is("baz/storage/26"));
}
Also used : VespaModelTester(com.yahoo.vespa.model.test.VespaModelTester) VespaModel(com.yahoo.vespa.model.VespaModel) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) Admin(com.yahoo.vespa.model.admin.Admin) 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