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);
}
}
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;
}
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();
}
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"));
}
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"));
}
Aggregations