use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.
the class DomAdminV2Builder method addConfiguredClusterControllers.
private ContainerCluster addConfiguredClusterControllers(AbstractConfigProducer parent, Element admin) {
Element controllersElements = XML.getChild(admin, "cluster-controllers");
if (controllersElements == null)
return null;
List<Element> controllers = XML.getChildren(controllersElements, "cluster-controller");
if (controllers.isEmpty())
return null;
boolean standaloneZooKeeper = "true".equals(controllersElements.getAttribute(ATTRIBUTE_CLUSTER_CONTROLLER_STANDALONE_ZK)) || multitenant;
if (standaloneZooKeeper) {
parent = new ClusterControllerCluster(parent, "standalone");
}
ContainerCluster cluster = new ContainerCluster(parent, "cluster-controllers", "cluster-controllers", new ClusterControllerClusterVerifier());
ContainerModelBuilder.addDefaultHandler_legacyBuilder(cluster);
List<Container> containers = new ArrayList<>();
for (Element controller : controllers) {
ClusterControllerContainer clusterController = new ClusterControllerBuilder(containers.size(), standaloneZooKeeper).build(cluster, controller);
containers.add(clusterController);
}
cluster.addContainers(containers);
return cluster;
}
use of com.yahoo.vespa.model.container.ContainerCluster 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.container.ContainerCluster in project vespa by vespa-engine.
the class Content method createTlds.
public void createTlds(ConfigModelRepo modelRepo) {
IndexedSearchCluster indexedCluster = cluster.getSearch().getIndexed();
if (indexedCluster == null)
return;
SimpleConfigProducer tldParent = new SimpleConfigProducer(indexedCluster, "tlds");
for (ConfigModel model : modelRepo.asMap().values()) {
if (!(model instanceof ContainerModel))
continue;
ContainerCluster containerCluster = ((ContainerModel) model).getCluster();
// this is not a qrs cluster
if (containerCluster.getSearch() == null)
continue;
log.log(LogLevel.DEBUG, "Adding tlds for indexed cluster " + indexedCluster.getClusterName() + ", container cluster " + containerCluster.getName());
indexedCluster.addTldsWithSameIdsAsContainers(tldParent, containerCluster);
}
indexedCluster.setupDispatchGroups();
}
use of com.yahoo.vespa.model.container.ContainerCluster in project vespa by vespa-engine.
the class ContainerModelBuilder method doBuild.
@Override
public void doBuild(ContainerModel model, Element spec, ConfigModelContext modelContext) {
app = modelContext.getApplicationPackage();
checkVersion(spec);
this.log = modelContext.getDeployLogger();
ContainerCluster cluster = createContainerCluster(spec, modelContext);
addClusterContent(cluster, spec, modelContext);
addBundlesForPlatformComponents(cluster);
model.setCluster(cluster);
}
use of com.yahoo.vespa.model.container.ContainerCluster 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