diff options
Diffstat (limited to 'config-model/src/main')
9 files changed, 17 insertions, 459 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilder.java index a4f2ecd6675..ee4879f2203 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/VespaDomBuilder.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.model.builder.xml.dom; import com.yahoo.config.application.api.DeployLogger; import com.yahoo.config.model.ApplicationConfigProducerRoot; -import com.yahoo.config.model.ConfigModel; import com.yahoo.config.model.ConfigModelRepo; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.builder.xml.XmlHelper; @@ -181,7 +180,7 @@ public class VespaDomBuilder extends VespaModelBuilder { if (port > 0) { t.setBasePort(port); } - allocateHost(t, hostSystem, producerSpec, deployState.getDeployLogger()); + allocateHost(t, hostSystem, producerSpec); } // This depends on which constructor in AbstractService is used, but the best way // is to let this method do initialize. @@ -199,7 +198,7 @@ public class VespaDomBuilder extends VespaModelBuilder { * @param producerSpec xml element for the service */ private void allocateHost(final AbstractService service, HostSystem hostSystem, - Element producerSpec, DeployLogger deployLogger) + Element producerSpec) { // TODO store service on something else than HostSystem, to not make that overloaded service.setHostResource(hostSystem.getHost(producerSpec.getAttribute("hostalias"))); @@ -207,15 +206,15 @@ public class VespaDomBuilder extends VespaModelBuilder { } /** - * The SimpleConfigProducer is the producer for elements such as qrservers, topleveldispatchers, gateways. + * The SimpleConfigProducer is the producer for elements such as qrservers, gateways. * Must support overrides for that too, hence this builder * * @author vegardh */ - public static class DomSimpleConfigProducerBuilder extends DomConfigProducerBuilder<SimpleConfigProducer> { - private String configId = null; + static class DomSimpleConfigProducerBuilder extends DomConfigProducerBuilder<SimpleConfigProducer> { + private String configId; - public DomSimpleConfigProducerBuilder(String configId) { + DomSimpleConfigProducerBuilder(String configId) { this.configId = configId; } @@ -231,7 +230,7 @@ public class VespaDomBuilder extends VespaModelBuilder { /** * @param name The name of the Vespa to create. Usually 'root' when there is only one. */ - public DomRootBuilder(String name) { + DomRootBuilder(String name) { this.name = name; } @@ -249,23 +248,13 @@ public class VespaDomBuilder extends VespaModelBuilder { } /** - * Gets the index from a service's spec - * - * @param spec The element containing the xml specification for this Service. - * @return the index of the service, which is retrieved from the xml spec. - */ - static int getIndex(Element spec) { - return getXmlIntegerAttribute(spec, "index"); - } - - /** * Gets an integer attribute value from a service's spec * * @param spec XML element * @param attributeName nam of attribute to get value from * @return value of attribute, or 0 if it does not exist or is empty */ - static int getXmlIntegerAttribute(Element spec, String attributeName) { + private static int getXmlIntegerAttribute(Element spec, String attributeName) { String value = (spec == null) ? null : spec.getAttribute(attributeName); if (value == null || value.equals("")) { return 0; @@ -287,7 +276,6 @@ public class VespaDomBuilder extends VespaModelBuilder { * @param configModelRepo a {@link ConfigModelRepo} */ public void postProc(DeployLogger deployLogger, AbstractConfigProducer root, ConfigModelRepo configModelRepo) { - createTlds(deployLogger, configModelRepo); setContentSearchClusterIndexes(configModelRepo); createDocprocMBusServersAndClients(configModelRepo); } @@ -303,14 +291,6 @@ public class VespaDomBuilder extends VespaModelBuilder { docproc.getChains().addServersAndClientsForChains(); } - private void createTlds(DeployLogger deployLogger, ConfigModelRepo pc) { - for (ConfigModel p : pc.asMap().values()) { - if (p instanceof Content) { - ((Content)p).createTlds(deployLogger, pc); - } - } - } - /** * For some reason, search clusters need to be enumerated. * @param configModelRepo a {@link ConfigModelRepo} diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java index 84e8cdf144f..5266fc46f6e 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java @@ -12,7 +12,6 @@ import com.yahoo.vespa.model.container.component.ContainerSubsystem; import com.yahoo.vespa.model.container.search.searchchain.LocalProvider; import com.yahoo.vespa.model.container.search.searchchain.SearchChains; import com.yahoo.vespa.model.search.AbstractSearchCluster; -import com.yahoo.vespa.model.search.Dispatch; import com.yahoo.vespa.model.search.IndexedSearchCluster; import com.yahoo.vespa.model.search.StreamingSearchCluster; @@ -124,13 +123,7 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains> } scB.rankprofiles(new QrSearchersConfig.Searchcluster.Rankprofiles.Builder().configid(sys.getConfigId())); scB.indexingmode(QrSearchersConfig.Searchcluster.Indexingmode.Enum.valueOf(sys.getIndexingModeName())); - if (sys instanceof IndexedSearchCluster) { - for (Dispatch tld: ((IndexedSearchCluster)sys).getTLDs()) { - scB.dispatcher(new QrSearchersConfig.Searchcluster.Dispatcher.Builder(). - host(tld.getHostname()). - port(tld.getDispatchPort())); - } - } else { + if ( ! (sys instanceof IndexedSearchCluster)) { scB.storagecluster(new QrSearchersConfig.Searchcluster.Storagecluster.Builder(). routespec(((StreamingSearchCluster)sys).getStorageRouteSpec())); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java b/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java index 74caf2d8026..8533c8d430f 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java @@ -81,23 +81,6 @@ public class Content extends ConfigModel { */ public Optional<ApplicationContainerCluster> ownedIndexingCluster() { return ownedIndexingCluster; } - public void createTlds(DeployLogger deployLogger, 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<? extends Container> containerCluster = ((ContainerModel) model).getCluster(); - if (containerCluster.getSearch() == null) continue; // this is not a qrs cluster - - log.log(LogLevel.DEBUG, "Adding tlds for indexed cluster " + indexedCluster.getClusterName() + ", container cluster " + containerCluster.getName()); - indexedCluster.addTldsWithSameIdsAsContainers(deployLogger, tldParent, containerCluster); - } - indexedCluster.setupDispatchGroups(deployLogger); - } - private static boolean containsIndexingChain(ComponentRegistry<DocprocChain> allChains, ChainSpecification chainSpec) { if (IndexingDocprocChain.NAME.equals(chainSpec.componentId.stringValue())) return true; diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java index fc79a3f4bbf..fdf88124012 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java @@ -186,11 +186,6 @@ public class ContentCluster extends AbstractConfigProducer implements } index.setSearchCoverage(DomSearchCoverageBuilder.build(element)); index.setDispatchSpec(DomDispatchBuilder.build(element)); - if (index.useMultilevelDispatchSetup()) { - // We must validate this before we add tlds and setup the dispatch groups. - // This must therefore happen before the regular validate() step. - new MultilevelDispatchValidator(index.getClusterName(), index.getDispatchSpec(), index.getSearchNodes()).validate(); - } // TODO: This should be cleaned up to avoid having to change code in 100 places // every time we add a dispatch option. @@ -656,9 +651,6 @@ public class ContentCluster extends AbstractConfigProducer implements if (search.usesHierarchicDistribution() && !isHosted) { // validate manually configured groups new IndexedHierarchicDistributionValidator(search.getClusterName(), rootGroup, redundancy, search.getIndexed().getTuning().dispatch.policy).validate(); - if (search.getIndexed().useMultilevelDispatchSetup()) { - throw new IllegalArgumentException("In indexed content cluster '" + search.getClusterName() + "': Using multi-level dispatch setup is not supported when using hierarchical distribution."); - } } new ReservedDocumentTypeNameValidator().validate(documentDefinitions); new GlobalDistributionValidator().validate(documentDefinitions, globallyDistributedDocuments); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/Dispatch.java b/config-model/src/main/java/com/yahoo/vespa/model/search/Dispatch.java deleted file mode 100644 index 2e821a67cb2..00000000000 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/Dispatch.java +++ /dev/null @@ -1,247 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.model.search; - -import com.yahoo.vespa.config.search.core.FdispatchrcConfig; -import com.yahoo.vespa.config.search.core.PartitionsConfig; -import com.yahoo.config.model.producer.AbstractConfigProducer; -import com.yahoo.vespa.model.AbstractService; -import com.yahoo.vespa.model.PortAllocBridge; -import com.yahoo.vespa.model.application.validation.RestartConfigs; -import com.yahoo.vespa.model.content.SearchCoverage; - -import java.util.ArrayList; -import java.util.List; - -/** - * Represents a dispatch (top-level (tld) or mid-level). - * There must be one or more tld instances in a search cluster. - * - * @author arnej27959 - */ -@RestartConfigs({FdispatchrcConfig.class, PartitionsConfig.class}) -public class Dispatch extends AbstractService implements SearchInterface, - FdispatchrcConfig.Producer, - PartitionsConfig.Producer { - - private static final String TLD_NAME = "tld"; - private static final String DISPATCH_NAME = "dispatch"; - - private static final long serialVersionUID = 1L; - private final DispatchGroup dispatchGroup; - private final NodeSpec nodeSpec; - private final int dispatchLevel; - private final boolean preferLocalRow; - private final boolean isTopLevel; - private boolean useAdaptiveDispatch; - - private Dispatch(DispatchGroup dispatchGroup, AbstractConfigProducer parent, String subConfigId, - NodeSpec nodeSpec, int dispatchLevel, boolean preferLocalRow, boolean isTopLevel) { - super(parent, subConfigId); - this.dispatchGroup = dispatchGroup; - this.nodeSpec = nodeSpec; - this.dispatchLevel = dispatchLevel; - this.preferLocalRow = preferLocalRow; - this.isTopLevel = isTopLevel; - this.useAdaptiveDispatch = false; - portsMeta.on(0).tag("rpc").tag("admin"); - portsMeta.on(1).tag("fs4"); - portsMeta.on(2).tag("http").tag("json").tag("health").tag("state"); - setProp("clustertype", "search") - .setProp("clustername", dispatchGroup.getClusterName()) - .setProp("index", nodeSpec.groupIndex()); - } - - public Dispatch useAdaptiveDispatch(boolean useAdaptiveDispatch) { - this.useAdaptiveDispatch = useAdaptiveDispatch; - return this; - } - - public static Dispatch createTld(DispatchGroup dispatchGroup, AbstractConfigProducer parent, int rowId) { - return createTld(dispatchGroup, parent, rowId, false); - } - - public static Dispatch createTld(DispatchGroup dispatchGroup, AbstractConfigProducer parent, int rowId, boolean preferLocalRow) { - String subConfigId = TLD_NAME + "." + rowId; - return new Dispatch(dispatchGroup, parent, subConfigId, new NodeSpec(rowId, 0), 0, preferLocalRow, true); - } - - public static Dispatch createTldWithContainerIdInName(DispatchGroup dispatchGroup, AbstractConfigProducer parent, String containerName, int containerIndex) { - String subConfigId = containerName + "." + containerIndex + "." + TLD_NAME + "." + containerIndex; - return new Dispatch(dispatchGroup, parent, subConfigId, new NodeSpec(containerIndex, 0), 0, false, true); - } - - public static Dispatch createDispatchWithStableConfigId(DispatchGroup dispatchGroup, AbstractConfigProducer parent, NodeSpec nodeSpec, int distributionKey, int dispatchLevel) { - String subConfigId = DISPATCH_NAME + "." + distributionKey; - return new Dispatch(dispatchGroup, parent, subConfigId, nodeSpec, dispatchLevel, false, false); - } - - /** - * Override the default service-type - * @return String "topleveldispatch" - */ - public String getServiceType() { - return "topleveldispatch"; - } - - /** - * @return the startup command - */ - public String getStartupCommand() { - return "exec sbin/vespa-dispatch -c $VESPA_CONFIG_ID"; - } - - private int getFrtPort() { return getRelativePort(0); } - public int getDispatchPort() { return getRelativePort(1); } - @Override - public int getHealthPort() { return getRelativePort(2); } - - /** - * Twice the default of the number of threads in the container. - * Could have been unbounded if it was not roundrobin, but stack based usage in dispatch. - * We are not putting to much magic into this one as this will disappear as soon as - * dispatch is implemented in Java. - */ - public int getMaxThreads() { return 500*2; } - - public String getHostname() { - return getHost().getHostname(); - } - - @Override - public NodeSpec getNodeSpec() { - return nodeSpec; - } - - public String getDispatcherConnectSpec() { - return "tcp/" + getHost().getHostname() + ":" + getDispatchPort(); - } - - public DispatchGroup getDispatchGroup() { - return dispatchGroup; - } - - @Override - public void getConfig(FdispatchrcConfig.Builder builder) { - builder.ptport(getDispatchPort()). - frtport(getFrtPort()). - healthport(getHealthPort()). - maxthreads(getMaxThreads()); - if (!isTopLevel) { - builder.partition(getNodeSpec().partitionId()); - builder.dispatchlevel(dispatchLevel); - } - } - - @Override - public void getConfig(PartitionsConfig.Builder builder) { - int rowbits = dispatchGroup.getRowBits(); - final PartitionsConfig.Dataset.Builder datasetBuilder = new PartitionsConfig.Dataset.Builder(). - id(0). - searchablecopies(dispatchGroup.getSearchableCopies()). - refcost(1). - rowbits(rowbits). - numparts(dispatchGroup.getNumPartitions()). - mpp(dispatchGroup.getMinNodesPerColumn()); - if (dispatchGroup.useFixedRowInDispatch()) { - datasetBuilder.querydistribution(PartitionsConfig.Dataset.Querydistribution.Enum.FIXEDROW); - datasetBuilder.maxnodesdownperfixedrow(dispatchGroup.getMaxNodesDownPerFixedRow()); - } - if (useAdaptiveDispatch) { - datasetBuilder.useroundrobinforfixedrow(false); - } - SearchCoverage coverage = dispatchGroup.getSearchCoverage(); - if (coverage != null) { - if (coverage.getMinimum() != null) { - datasetBuilder.minimal_searchcoverage(coverage.getMinimum() * 100); // as percentage - } - if (coverage.getMinWaitAfterCoverageFactor() != null) { - datasetBuilder.higher_coverage_minsearchwait(coverage.getMinWaitAfterCoverageFactor()); - } - if (coverage.getMaxWaitAfterCoverageFactor() != null) { - datasetBuilder.higher_coverage_maxsearchwait(coverage.getMaxWaitAfterCoverageFactor()); - } - } - - Tuning tuning = dispatchGroup.getTuning(); - boolean useLocalNode = false; - if (tuning != null && tuning.dispatch != null) { - useLocalNode = tuning.dispatch.useLocalNode; - } - final List<PartitionsConfig.Dataset.Engine.Builder> allEngines = new ArrayList<>(); - for (SearchInterface searchNode : dispatchGroup.getSearchersIterable()) { - final PartitionsConfig.Dataset.Engine.Builder engineBuilder = new PartitionsConfig.Dataset.Engine.Builder(). - name_and_port(searchNode.getDispatcherConnectSpec()). - rowid(searchNode.getNodeSpec().groupIndex()). - partid(searchNode.getNodeSpec().partitionId()); - allEngines.add(engineBuilder); - if (preferLocalRow) { - if (getHostname().equals(searchNode.getHostName())) { - engineBuilder.refcost(1); - } else { - engineBuilder.refcost(Integer.MAX_VALUE); - } - } - - if (!useLocalNode || getHostname().equals(searchNode.getHostName())) { - if (useLocalNode) { - engineBuilder.rowid(0); - } - datasetBuilder.engine.add(engineBuilder); - - } - } - //Do not create empty engine list for a dataset if no local search nodes found - if(datasetBuilder.engine.isEmpty() && useLocalNode) { - for(PartitionsConfig.Dataset.Engine.Builder engineBuilder: allEngines) { - datasetBuilder.engine.add(engineBuilder); - } - } - - builder.dataset.add(datasetBuilder); - - if (tuning != null) { - tuning.getConfig(builder); - scaleMaxHitsPerPartitions(builder, tuning); - } - } - - private int getNumLeafNodesInGroup() { - int numSearchers = 0; - for (SearchInterface search : dispatchGroup.getSearchersIterable()) { - if (search instanceof Dispatch) { - numSearchers += ((Dispatch) search).getNumLeafNodesInGroup(); - } else { - numSearchers++; - } - } - if (numSearchers > 0) { - // Divide by number of partitions, otherwise we would count the same leaf node partition number of times. - return numSearchers / dispatchGroup.getNumPartitions(); - } - return 0; - } - - private void scaleMaxHitsPerPartitions(PartitionsConfig.Builder builder, Tuning tuning) { - if (tuning == null || tuning.dispatch == null || tuning.dispatch.maxHitsPerPartition == null) { - return; - } - int numLeafNodes = getNumLeafNodesInGroup(); - for (PartitionsConfig.Dataset.Builder dataset : builder.dataset) { - dataset.maxhitspernode(tuning.dispatch.maxHitsPerPartition * numLeafNodes); - } - } - - @Override - public void allocatePorts(int start, PortAllocBridge from) { - // NB: ignore "start" - from.allocatePort("rpc"); - from.allocatePort("fs4"); - from.allocatePort("health"); - } - - /** - * @return the number of ports needed - */ - public int getPortCount() { return 3; } - -} diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java b/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java index 3d57732efde..04b293fdc36 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroup.java @@ -3,7 +3,8 @@ package com.yahoo.vespa.model.search; import com.yahoo.vespa.model.content.SearchCoverage; -import java.util.*; +import java.util.Map; +import java.util.TreeMap; /** * Class representing a group of @link{SearchInterface} nodes and a set of @link{Dispatch} nodes. @@ -14,8 +15,7 @@ import java.util.*; */ public class DispatchGroup { - private final List<Dispatch> dispatchers = new ArrayList<>(); - private final Map<Integer, Map<Integer, SearchInterface> > searchers = new TreeMap<>(); + private final Map<Integer, Map<Integer, SearchInterface>> searchers = new TreeMap<>(); final private IndexedSearchCluster sc; @@ -23,11 +23,6 @@ public class DispatchGroup { this.sc = sc; } - DispatchGroup addDispatcher(Dispatch dispatch) { - dispatchers.add(dispatch); - return this; - } - DispatchGroup addSearcher(SearchInterface search) { Map<Integer, SearchInterface> rows = searchers.get(search.getNodeSpec().partitionId()); if (rows == null) { @@ -43,15 +38,6 @@ public class DispatchGroup { return this; } - DispatchGroup clearSearchers() { - searchers.clear(); - return this; - } - - List<Dispatch> getDispatchers() { - return Collections.unmodifiableList(dispatchers); - } - public Iterable getSearchersIterable() { return new Iterable(searchers); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroupBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroupBuilder.java index 4ff5fcab347..b489c5b9242 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroupBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/DispatchGroupBuilder.java @@ -1,8 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.search; -import com.yahoo.config.application.api.DeployLogger; -import com.yahoo.vespa.model.HostResource; import com.yahoo.vespa.model.SimpleConfigProducer; import com.yahoo.vespa.model.content.DispatchSpec; @@ -30,49 +28,28 @@ public class DispatchGroupBuilder { this.searchCluster = searchCluster; } - public void build(DeployLogger deployLogger, List<DispatchSpec.Group> groupsSpec, List<SearchNode> searchNodes) { + public void build(List<DispatchSpec.Group> groupsSpec, List<SearchNode> searchNodes) { Map<Integer, SearchNode> searchNodeMap = buildSearchNodeMap(searchNodes); for (int partId = 0; partId < groupsSpec.size(); ++partId) { DispatchSpec.Group groupSpec = groupsSpec.get(partId); DispatchGroup group = new DispatchGroup(searchCluster); - populateDispatchGroup(deployLogger, group, groupSpec.getNodes(), searchNodeMap, partId); + populateDispatchGroup(group, groupSpec.getNodes(), searchNodeMap, partId); } } - private void populateDispatchGroup(DeployLogger deployLogger, - DispatchGroup group, + private void populateDispatchGroup(DispatchGroup group, List<DispatchSpec.Node> nodeList, Map<Integer, SearchNode> searchNodesMap, int partId) { for (int rowId = 0; rowId < nodeList.size(); ++rowId) { int distributionKey = nodeList.get(rowId).getDistributionKey(); SearchNode searchNode = searchNodesMap.get(distributionKey); - Dispatch dispatch = buildDispatch(deployLogger, group, new NodeSpec(rowId, partId), distributionKey, searchNode.getHostResource()); - group.addDispatcher(dispatch); - rootDispatch.addSearcher(dispatch); // Note: the rowId in this context will be the partId for the underlying search node. group.addSearcher(buildSearchInterface(searchNode, rowId)); } } - /** - * Builds a mid-level dispatcher with a configId containing the same stable distribution-key as the search node it - * is located on. - * - * If this.dispatchParent has subConfigId 'dispatchers', the config ids of the mid-level - * dispatchers are '../dispatchers/dispatch.X' where X is the distribution-key of the search node. - * - * The dispatch group that will contain this mid-level dispatcher is no longer part of the config producer tree, - * but only contains information about the dispatchers and searchers in this group. - */ - private Dispatch buildDispatch(DeployLogger deployLogger, DispatchGroup group, NodeSpec nodeSpec, int distributionKey, HostResource hostResource) { - Dispatch dispatch = Dispatch.createDispatchWithStableConfigId(group, dispatchParent, nodeSpec, distributionKey, 1); - dispatch.setHostResource(hostResource); - dispatch.initService(deployLogger); - return dispatch; - } - private static SearchInterface buildSearchInterface(SearchNode searchNode, int partId) { searchNode.updatePartition(partId); // ensure that search node uses the same partId as dispatch sees return new SearchNodeWrapper(new NodeSpec(0, partId), searchNode); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java index 76617bf1b9f..0b8b2ddde75 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java @@ -1,10 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.model.search; -import com.yahoo.config.application.api.DeployLogger; import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.producer.AbstractConfigProducer; -import com.yahoo.log.LogLevel; import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig; import com.yahoo.search.config.IndexInfoConfig; import com.yahoo.searchdefinition.DocumentOnlySearch; @@ -15,10 +13,6 @@ import com.yahoo.vespa.config.search.DispatchConfig.DistributionPolicy; import com.yahoo.vespa.config.search.RankProfilesConfig; import com.yahoo.vespa.config.search.core.ProtonConfig; import com.yahoo.vespa.configdefinition.IlscriptsConfig; -import com.yahoo.vespa.model.HostResource; -import com.yahoo.vespa.model.SimpleConfigProducer; -import com.yahoo.vespa.model.container.Container; -import com.yahoo.vespa.model.container.ContainerCluster; import com.yahoo.vespa.model.container.docproc.DocprocChain; import com.yahoo.vespa.model.content.DispatchSpec; import com.yahoo.vespa.model.content.SearchCoverage; @@ -29,7 +23,6 @@ import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.logging.Logger; /** * @author baldersheim @@ -85,8 +78,6 @@ public class IndexedSearchCluster extends SearchCluster } } - private static final Logger log = Logger.getLogger(IndexedSearchCluster.class.getName()); - private String indexingClusterName = null; // The name of the docproc cluster to run indexing, by config. private String indexingChainName = null; @@ -103,7 +94,6 @@ public class IndexedSearchCluster extends SearchCluster private int searchableCopies = 1; - private final SimpleConfigProducer dispatchParent; private final DispatchGroup rootDispatch; private DispatchSpec dispatchSpec; private final boolean useAdaptiveDispatch; @@ -122,7 +112,6 @@ public class IndexedSearchCluster extends SearchCluster public IndexedSearchCluster(AbstractConfigProducer parent, String clusterName, int index, DeployState deployState) { super(parent, clusterName, index); unionCfg = new UnionConfiguration(this, documentDbs); - dispatchParent = new SimpleConfigProducer(this, "dispatchers"); rootDispatch = new DispatchGroup(this); useAdaptiveDispatch = deployState.getProperties().useAdaptiveDispatch(); } @@ -183,46 +172,6 @@ public class IndexedSearchCluster extends SearchCluster return this; } - public Dispatch addTld(DeployLogger deployLogger, AbstractConfigProducer tldParent, HostResource hostResource) { - int index = rootDispatch.getDispatchers().size(); - Dispatch tld = Dispatch.createTld(rootDispatch, tldParent, index); - tld.useAdaptiveDispatch(useAdaptiveDispatch); - tld.setHostResource(hostResource); - tld.initService(deployLogger); - rootDispatch.addDispatcher(tld); - return tld; - } - - /** - * Make sure to allocate tld with same id as container (i.e if container cluster name is 'foo', with containers - * with index 0,1,2 the tlds created will get names ../foo.0.tld.0, ../foo.1.tld.1, ../foo.2.tld.2, so that tld config id is - * stable no matter what changes are done to the number of containers in a container cluster - * @param tldParent the indexed search cluster the tlds to add should be connected to - * @param containerCluster the container cluster that should use the tlds created for searching the indexed search cluster above - */ - public void addTldsWithSameIdsAsContainers(DeployLogger deployLogger, AbstractConfigProducer tldParent, ContainerCluster<? extends Container> containerCluster) { - for (Container container : containerCluster.getContainers()) { - String containerSubId = container.getSubId(); - if ( ! containerSubId.contains(".")) { - throw new RuntimeException("Expected container sub id to be of the form string.number"); - } - int containerIndex = Integer.parseInt(containerSubId.split("\\.")[1]); - String containerClusterName = containerCluster.getName(); - log.log(LogLevel.DEBUG, "Adding tld with index " + containerIndex + " for content cluster " + this.getClusterName() + - ", container cluster " + containerClusterName + " (container id " + containerSubId + - ") on host " + container.getHostResource().getHostname()); - rootDispatch.addDispatcher(createTld(deployLogger, tldParent, container.getHostResource(), containerClusterName, containerIndex).useAdaptiveDispatch(useAdaptiveDispatch)); - } - } - - private Dispatch createTld(DeployLogger deployLogger, AbstractConfigProducer tldParent, HostResource hostResource, String containerClusterName, int containerIndex) { - Dispatch tld = Dispatch.createTldWithContainerIdInName(rootDispatch, tldParent, containerClusterName, containerIndex); - tld.useAdaptiveDispatch(useAdaptiveDispatch); - tld.setHostResource(hostResource); - tld.initService(deployLogger); - return tld; - } - public DispatchGroup getRootDispatch() { return rootDispatch; } public void addSearcher(SearchNode searcher) { @@ -230,8 +179,6 @@ public class IndexedSearchCluster extends SearchCluster rootDispatch.addSearcher(searcher); } - public List<Dispatch> getTLDs() { return rootDispatch.getDispatchers(); } - public List<SearchNode> getSearchNodes() { return Collections.unmodifiableList(searchNodes); } public int getSearchNodeCount() { return searchNodes.size(); } public SearchNode getSearchNode(int index) { return searchNodes.get(index); } @@ -397,18 +344,6 @@ public class IndexedSearchCluster extends SearchCluster return dispatchSpec; } - public boolean useMultilevelDispatchSetup() { - return dispatchSpec != null && dispatchSpec.getGroups() != null && !dispatchSpec.getGroups().isEmpty(); - } - - public void setupDispatchGroups(DeployLogger deployLogger) { - if (!useMultilevelDispatchSetup()) { - return; - } - rootDispatch.clearSearchers(); - new DispatchGroupBuilder(dispatchParent, rootDispatch, this).build(deployLogger, dispatchSpec.getGroups(), getSearchNodes()); - } - @Override public void getConfig(DispatchConfig.Builder builder) { for (SearchNode node : getSearchNodes()) { @@ -435,7 +370,6 @@ public class IndexedSearchCluster extends SearchCluster } } builder.maxNodesDownPerGroup(rootDispatch.getMaxNodesDownPerFixedRow()); - builder.useMultilevelDispatch(useMultilevelDispatchSetup()); builder.useLocalNode(tuning.dispatch.useLocalNode); builder.searchableCopies(rootDispatch.getSearchableCopies()); if (searchCoverage != null) { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java b/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java index b0fe2877386..fac641bd714 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/Tuning.java @@ -2,7 +2,6 @@ package com.yahoo.vespa.model.search; import com.yahoo.config.model.producer.AbstractConfigProducer; -import com.yahoo.vespa.config.search.core.PartitionsConfig; import com.yahoo.vespa.config.search.core.ProtonConfig; import com.yahoo.vespa.model.content.TuningDispatch; @@ -14,47 +13,15 @@ import static com.yahoo.text.Lowercase.toLowerCase; * * @author geirst */ -public class Tuning extends AbstractConfigProducer implements PartitionsConfig.Producer, ProtonConfig.Producer { +public class Tuning extends AbstractConfigProducer implements ProtonConfig.Producer { - public static class Dispatch implements PartitionsConfig.Producer { + public static class Dispatch { public Integer maxHitsPerPartition = null; public TuningDispatch.DispatchPolicy policy = null; public boolean useLocalNode = false; public Double minGroupCoverage = null; public Double minActiveDocsCoverage = null; - - @Override - public void getConfig(PartitionsConfig.Builder builder) { - if (maxHitsPerPartition != null) { - for (PartitionsConfig.Dataset.Builder dataset : builder.dataset) { - dataset.maxhitspernode(maxHitsPerPartition); - } - } - if (minGroupCoverage != null) { - for (PartitionsConfig.Dataset.Builder dataset : builder.dataset) { - dataset.min_group_coverage(minGroupCoverage); - } - } - if (minActiveDocsCoverage != null) { - for (PartitionsConfig.Dataset.Builder dataset : builder.dataset) { - dataset.min_activedocs_coverage(minActiveDocsCoverage); - } - } - if (policy != null) { - for (PartitionsConfig.Dataset.Builder dataset : builder.dataset) { - switch (policy) { - case ADAPTIVE: - dataset.useroundrobinforfixedrow(false); - break; - case ROUNDROBIN: - default: - dataset.useroundrobinforfixedrow(true); - break; - } - } - } - } } public static class SearchNode implements ProtonConfig.Producer { @@ -432,13 +399,6 @@ public class Tuning extends AbstractConfigProducer implements PartitionsConfig.P } @Override - public void getConfig(PartitionsConfig.Builder builder) { - if (dispatch != null) { - dispatch.getConfig(builder); - } - } - - @Override public void getConfig(ProtonConfig.Builder builder) { if (searchNode != null) searchNode.getConfig(builder); } |