diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-03-04 12:52:22 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-03-04 13:22:49 +0100 |
commit | af13cee630e45bce9aab9d19956ef680947262fb (patch) | |
tree | 62a5f9ade8219104d7610e802c18a2c39a6d6b61 /config-model | |
parent | d888d06261e427205d95b67a03ee02051e4dad30 (diff) |
Use the redunacy provider.
Diffstat (limited to 'config-model')
6 files changed, 16 insertions, 36 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/VsmSummary.java b/config-model/src/main/java/com/yahoo/schema/derived/VsmSummary.java index a2c220b6cbc..e3d7becd86a 100644 --- a/config-model/src/main/java/com/yahoo/schema/derived/VsmSummary.java +++ b/config-model/src/main/java/com/yahoo/schema/derived/VsmSummary.java @@ -38,7 +38,7 @@ public class VsmSummary extends Derived implements VsmsummaryConfig.Producer { if (doMapField(schema, summaryField)) { SDField sdField = schema.getConcreteField(summaryField.getName()); if (sdField != null && GeoPos.isAnyPos(sdField)) { - summaryMap.put(summaryField, Collections.singletonList(summaryField.getName())); + summaryMap.put(summaryField, List.of(summaryField.getName())); } else { summaryMap.put(summaryField, from); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java index 99630c5f048..a44ce3a3013 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java @@ -160,7 +160,7 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> String clusterName, ContentSearchCluster search) { List<ModelElement> indexedDefs = getIndexedSchemas(clusterElem); if (!indexedDefs.isEmpty()) { - IndexedSearchCluster isc = new IndexedSearchCluster(search, clusterName, 0, deployState.featureFlags()); + IndexedSearchCluster isc = new IndexedSearchCluster(search, clusterName, 0, search, deployState.featureFlags()); Double visibilityDelay = clusterElem.childAsDouble("engine.proton.visibility-delay"); if (visibilityDelay != null) { @@ -296,7 +296,7 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> if (element == null) { searchNode = SearchNode.create(parent, "" + node.getDistributionKey(), node.getDistributionKey(), spec, clusterName, node, flushOnShutdown, tuning, resourceLimits, deployState.isHosted(), - fractionOfMemoryReserved, this, deployState.featureFlags()); + fractionOfMemoryReserved, deployState.featureFlags()); searchNode.setHostResource(node.getHostResource()); searchNode.initService(deployState); @@ -305,7 +305,7 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> tls.initService(deployState); } else { searchNode = new SearchNode.Builder(""+node.getDistributionKey(), spec, clusterName, node, flushOnShutdown, - tuning, resourceLimits, fractionOfMemoryReserved, this) + tuning, resourceLimits, fractionOfMemoryReserved) .build(deployState, parent, element.getXml()); tls = new TransactionLogServer.Builder(clusterName, syncTransactionLog).build(deployState, searchNode, element.getXml()); } @@ -342,11 +342,6 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> } public void handleRedundancy(Redundancy redundancy) { - if (hasIndexedCluster()) { - // Important: these must all be the normalized "within a single leaf group" values, - // _not_ the cluster-wide, cross-group values. - indexedCluster.setRedundancy(redundancy.finalRedundancy()); - } this.redundancy = redundancy; } 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 c9057c16499..885cb53a148 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 @@ -20,6 +20,7 @@ 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.content.DispatchTuning; +import com.yahoo.vespa.model.content.Redundancy; import com.yahoo.vespa.model.content.SearchCoverage; import java.util.ArrayList; @@ -46,16 +47,18 @@ public class IndexedSearchCluster extends SearchCluster private final List<DocumentDatabase> documentDbs = new LinkedList<>(); private final MultipleDocumentDatabasesConfigProducer documentDbsConfigProducer; - private int redundancy = 1; + private final Redundancy.Provider redundancyProvider; private final List<SearchNode> searchNodes = new ArrayList<>(); private final DispatchTuning.DispatchPolicy defaultDispatchPolicy; private final double dispatchWarmup; private final String summaryDecodePolicy; - public IndexedSearchCluster(TreeConfigProducer<AnyConfigProducer> parent, String clusterName, int index, ModelContext.FeatureFlags featureFlags) { + public IndexedSearchCluster(TreeConfigProducer<AnyConfigProducer> parent, String clusterName, int index, + Redundancy.Provider redundancyProvider, ModelContext.FeatureFlags featureFlags) { super(parent, clusterName, index); documentDbsConfigProducer = new MultipleDocumentDatabasesConfigProducer(this, documentDbs); + this.redundancyProvider = redundancyProvider; defaultDispatchPolicy = DispatchTuning.Builder.toDispatchPolicy(featureFlags.queryDispatchPolicy()); dispatchWarmup = featureFlags.queryDispatchWarmup(); summaryDecodePolicy = featureFlags.summaryDecodePolicy(); @@ -150,10 +153,6 @@ public class IndexedSearchCluster extends SearchCluster documentDbsConfigProducer.getConfig(builder); } - public void setRedundancy(int redundancy) { - this.redundancy = redundancy; - } - private static DistributionPolicy.Enum toDistributionPolicy(DispatchTuning.DispatchPolicy tuning) { return switch (tuning) { case ADAPTIVE: yield DistributionPolicy.ADAPTIVE; @@ -189,7 +188,7 @@ public class IndexedSearchCluster extends SearchCluster if (tuning.dispatch.getMaxHitsPerPartition() != null) builder.maxHitsPerNode(tuning.dispatch.getMaxHitsPerPartition()); - builder.redundancy(redundancy); + builder.redundancy(redundancyProvider.redundancy().finalRedundancy()); if (searchCoverage != null) { if (searchCoverage.getMinimum() != null) builder.minSearchCoverage(searchCoverage.getMinimum() * 100.0); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchCluster.java index 9ccc6abfc35..2ab11e31f59 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchCluster.java @@ -58,14 +58,6 @@ public abstract class SearchCluster extends TreeConfigProducer<AnyConfigProducer /** Returns the document databases contained in this cluster */ public abstract List<DocumentDatabase> getDocumentDbs(); - /** Returns a list of the document type names used in this search cluster */ - public List<String> getDocumentNames() { - return schemas.values() - .stream() - .map(schema -> schema.fullSchema().getDocument().getDocumentName().getName()) - .toList(); - } - public String getClusterName() { return clusterName; } public final String getIndexingModeName() { return getIndexingMode().getName(); } public final boolean isStreaming() { return getIndexingMode() == IndexingMode.STREAMING; } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java index dc4f9273868..869753daf06 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchNode.java @@ -21,7 +21,6 @@ import com.yahoo.vespa.model.admin.monitoring.Monitoring; import com.yahoo.vespa.model.application.validation.RestartConfigs; import com.yahoo.vespa.model.builder.xml.dom.VespaDomBuilder; import com.yahoo.vespa.model.content.ContentNode; -import com.yahoo.vespa.model.content.Redundancy; import com.yahoo.vespa.model.content.ResourceLimits; import org.w3c.dom.Element; @@ -67,7 +66,6 @@ public class SearchNode extends AbstractService implements private final Optional<Tuning> tuning; private final Optional<ResourceLimits> resourceLimits; private final double fractionOfMemoryReserved; - private final Redundancy.Provider redundancyProvider; public static class Builder extends VespaDomBuilder.DomConfigProducerBuilderBase<SearchNode> { @@ -79,11 +77,10 @@ public class SearchNode extends AbstractService implements private final Optional<Tuning> tuning; private final Optional<ResourceLimits> resourceLimits; private final double fractionOfMemoryReserved; - private final Redundancy.Provider redundancyProvider; public Builder(String name, NodeSpec nodeSpec, String clusterName, ContentNode node, boolean flushOnShutdown, Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, - double fractionOfMemoryReserved, Redundancy.Provider redundancyprovider) { + double fractionOfMemoryReserved) { this.name = name; this.nodeSpec = nodeSpec; this.clusterName = clusterName; @@ -92,7 +89,6 @@ public class SearchNode extends AbstractService implements this.tuning = tuning; this.resourceLimits = resourceLimits; this.fractionOfMemoryReserved = fractionOfMemoryReserved; - this.redundancyProvider = redundancyprovider; } @Override @@ -100,7 +96,7 @@ public class SearchNode extends AbstractService implements Element producerSpec) { return SearchNode.create(ancestor, name, contentNode.getDistributionKey(), nodeSpec, clusterName, contentNode, flushOnShutdown, tuning, resourceLimits, deployState.isHosted(), - fractionOfMemoryReserved, redundancyProvider, deployState.featureFlags()); + fractionOfMemoryReserved, deployState.featureFlags()); } } @@ -108,10 +104,10 @@ public class SearchNode extends AbstractService implements public static SearchNode create(TreeConfigProducer<?> parent, String name, int distributionKey, NodeSpec nodeSpec, String clusterName, AbstractService serviceLayerService, boolean flushOnShutdown, Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, - boolean isHostedVespa, double fractionOfMemoryReserved, Redundancy.Provider redundancyProvider, + boolean isHostedVespa, double fractionOfMemoryReserved, ModelContext.FeatureFlags featureFlags) { SearchNode node = new SearchNode(parent, name, distributionKey, nodeSpec, clusterName, serviceLayerService, flushOnShutdown, - tuning, resourceLimits, isHostedVespa, fractionOfMemoryReserved, redundancyProvider); + tuning, resourceLimits, isHostedVespa, fractionOfMemoryReserved); if (featureFlags.loadCodeAsHugePages()) { node.addEnvironmentVariable("VESPA_LOAD_CODE_AS_HUGEPAGES", true); } @@ -124,7 +120,7 @@ public class SearchNode extends AbstractService implements private SearchNode(TreeConfigProducer<?> parent, String name, int distributionKey, NodeSpec nodeSpec, String clusterName, AbstractService serviceLayerService, boolean flushOnShutdown, Optional<Tuning> tuning, Optional<ResourceLimits> resourceLimits, boolean isHostedVespa, - double fractionOfMemoryReserved, Redundancy.Provider redundancyProvider) { + double fractionOfMemoryReserved) { super(parent, name); this.distributionKey = distributionKey; this.serviceLayerService = serviceLayerService; @@ -141,7 +137,6 @@ public class SearchNode extends AbstractService implements // Properties are set in DomSearchBuilder this.tuning = tuning; this.resourceLimits = resourceLimits; - this.redundancyProvider = redundancyProvider; setPropertiesElastic(clusterName, distributionKey); addEnvironmentVariable("OMP_NUM_THREADS", 1); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java index 55a55075625..3a39e55b46b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchNodeTest.java @@ -10,7 +10,6 @@ import com.yahoo.vespa.config.search.core.ProtonConfig; import com.yahoo.vespa.defaults.Defaults; import com.yahoo.vespa.model.Host; import com.yahoo.vespa.model.HostResource; -import com.yahoo.vespa.model.content.Redundancy; import com.yahoo.vespa.model.search.NodeSpec; import com.yahoo.vespa.model.search.SearchNode; import com.yahoo.vespa.model.search.TransactionLogServer; @@ -50,7 +49,7 @@ public class SearchNodeTest { private static SearchNode createSearchNode(MockRoot root, String name, int distributionKey, NodeSpec nodeSpec, boolean flushOnShutDown, boolean isHosted, ModelContext.FeatureFlags featureFlags) { return SearchNode.create(root, name, distributionKey, nodeSpec, "mycluster", null, flushOnShutDown, - Optional.empty(), Optional.empty(), isHosted, 0.0, () -> new Redundancy(1,1,1,1,1), featureFlags); + Optional.empty(), Optional.empty(), isHosted, 0.0, featureFlags); } private static SearchNode createSearchNode(MockRoot root) { |