summaryrefslogtreecommitdiffstats
path: root/config-model/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/main')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java2
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java38
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java6
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/OnnxModels.java7
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java22
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java26
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankingConstant.java5
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/RankingConstants.java6
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/Schema.java7
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java10
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/ConfigProducerRoot.java5
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java7
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java5
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/Content.java1
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileReferencesRepository.java16
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java21
-rw-r--r--config-model/src/main/javacc/SDParser.jj67
22 files changed, 109 insertions, 170 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java b/config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java
index 6be829b6e49..b29ff1ee58b 100644
--- a/config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java
+++ b/config-model/src/main/java/com/yahoo/config/model/test/MockRoot.java
@@ -66,7 +66,7 @@ public class MockRoot extends AbstractConfigProducerRoot {
super(rootConfigId);
hostSystem = new HostSystem(this, "hostsystem", deployState.getProvisioner(), deployState.getDeployLogger());
this.deployState = deployState;
- fileReferencesRepository = new FileReferencesRepository();
+ fileReferencesRepository = new FileReferencesRepository(deployState.getFileRegistry());
}
public FileDistributionConfigProducer getFileDistributionConfigProducer() {
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java b/config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java
index 08194c578e7..245288c283e 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DistributableResource.java
@@ -4,65 +4,57 @@ package com.yahoo.searchdefinition;
import com.yahoo.config.FileReference;
import com.yahoo.config.application.api.FileRegistry;
import com.yahoo.path.Path;
-import com.yahoo.vespa.model.AbstractService;
-import com.yahoo.vespa.model.utils.FileSender;
import java.nio.ByteBuffer;
-import java.util.Collection;
import java.util.Objects;
public class DistributableResource {
- public enum PathType { FILE, URI, BLOB };
+ public enum PathType { FILE, URI, BLOB }
/** The search definition-unique name of this constant */
private final String name;
- private final ByteBuffer blob;
+ //TODO Make path/pathType final
+ private PathType pathType;
private String path;
private FileReference fileReference = new FileReference("");
- private PathType pathType = PathType.FILE;
public PathType getPathType() {
return pathType;
}
public DistributableResource(String name) {
- this.name = name;
- blob = null;
+ this(name, null, PathType.FILE);
}
public DistributableResource(String name, String path) {
+ this(name, path, PathType.FILE);
+ }
+ public DistributableResource(String name, String path, PathType type) {
this.name = name;
this.path = path;
- blob = null;
+ this.pathType = type;
}
public DistributableResource(String name, ByteBuffer blob) {
- Objects.requireNonNull(name, "Blob name cannot be null");
- Objects.requireNonNull(blob, "Blob cannot be null");
this.name = name;
- this.blob = blob;
path = name + ".lz4";
pathType = PathType.BLOB;
}
+ //TODO Remove and make path/pathType final
public void setFileName(String fileName) {
Objects.requireNonNull(fileName, "Filename cannot be null");
this.path = fileName;
this.pathType = PathType.FILE;
}
+ //TODO Remove and make path/pathType final
public void setUri(String uri) {
Objects.requireNonNull(uri, "uri cannot be null");
this.path = uri;
this.pathType = PathType.URI;
}
- /** Initiate sending of this constant to some services over file distribution */
- public void sendTo(Collection<? extends AbstractService> services) {
- FileSender.send(fileReference, services);
- }
-
public String getName() { return name; }
- public ByteBuffer getBlob() { return blob; }
public String getFileName() { return path; }
public Path getFilePath() { return Path.fromString(path); }
public String getUri() { return path; }
@@ -75,9 +67,6 @@ public class DistributableResource {
if (path == null || path.isEmpty())
throw new IllegalArgumentException("Distributable URI/FILE resource must have a file or uri.");
break;
- case BLOB:
- if (blob == null)
- throw new IllegalArgumentException("Distributable BLOB can not be null.");
}
}
@@ -89,14 +78,15 @@ public class DistributableResource {
case URI:
fileReference = fileRegistry.addUri(path);
break;
- case BLOB:
- fileReference = fileRegistry.addBlob(path, blob);
- break;
default:
throw new IllegalArgumentException("Unknown path type " + pathType);
}
}
+ protected void register(FileRegistry fileRegistry, ByteBuffer blob) {
+ fileReference = fileRegistry.addBlob(path, blob);
+ }
+
@Override
public String toString() {
return "resource '" + name + " of type '" + pathType + "' with ref '" + fileReference + "'";
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java b/config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java
index c33400fdcc1..3fdea71da2c 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/LargeRankExpressions.java
@@ -2,9 +2,7 @@
package com.yahoo.searchdefinition;
import com.yahoo.config.application.api.FileRegistry;
-import com.yahoo.vespa.model.AbstractService;
-import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -37,8 +35,4 @@ public class LargeRankExpressions {
return Collections.unmodifiableMap(expressions);
}
- /** Initiate sending of these constants to some services over file distribution */
- public void sendTo(Collection<? extends AbstractService> services) {
- expressions.values().forEach(constant -> constant.sendTo(services));
- }
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/OnnxModels.java b/config-model/src/main/java/com/yahoo/searchdefinition/OnnxModels.java
index e249fe59f14..c9c12100552 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/OnnxModels.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/OnnxModels.java
@@ -2,9 +2,7 @@
package com.yahoo.searchdefinition;
import com.yahoo.config.application.api.FileRegistry;
-import com.yahoo.vespa.model.AbstractService;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -66,9 +64,4 @@ public class OnnxModels {
return Collections.unmodifiableMap(allModels);
}
- /** Initiate sending of these models to some services over file distribution */
- public void sendTo(Collection<? extends AbstractService> services) {
- asMap().values().forEach(model -> model.sendTo(services));
- }
-
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java
index b3dec554cdc..815e4bbf359 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankExpressionBody.java
@@ -1,11 +1,29 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchdefinition;
+import com.yahoo.config.application.api.FileRegistry;
+
import java.nio.ByteBuffer;
+import java.util.Objects;
public class RankExpressionBody extends DistributableResource {
- public RankExpressionBody(String name, ByteBuffer body) {
- super(name, body);
+ private final ByteBuffer blob;
+
+ public RankExpressionBody(String name, ByteBuffer blob) {
+ super(name, blob);
+ Objects.requireNonNull(blob, "Blob cannot be null");
+ this.blob = blob;
+ }
+ public ByteBuffer getBlob() { return blob; }
+ public void validate() {
+ // Remove once pathType is final
+ if (getPathType() != PathType.BLOB) {
+ throw new IllegalArgumentException("PathType must be BLOB.");
+ }
+ }
+
+ void register(FileRegistry fileRegistry) {
+ register(fileRegistry, blob);
}
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
index b5d86f5bb38..52fd5286bcf 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankProfile.java
@@ -98,6 +98,8 @@ public class RankProfile implements Cloneable {
private String inheritedSummaryFeatures;
private Set<ReferenceNode> matchFeatures;
+ private String inheritedMatchFeatures;
+
private Set<ReferenceNode> rankFeatures;
/** The properties of this - a multimap */
@@ -519,8 +521,30 @@ public class RankProfile implements Cloneable {
this.inheritedSummaryFeatures = parentProfile;
}
+ /**
+ * Sets the name of a profile this should inherit the match features of.
+ * Without setting this, this will either have the match features of the parent,
+ * or if match features are set in this, only have the match features in this.
+ * With this set the resulting match features of this will be the superset of those defined in this and
+ * the final (with inheritance included) match features of the given parent.
+ * The profile must be the profile which is directly inherited by this.
+ *
+ */
+ public void setInheritedMatchFeatures(String parentProfile) {
+ if ( ! parentProfile.equals(inheritedName))
+ throw new IllegalArgumentException("This rank profile ("+name+") can only inherit the match features of its parent, '" +
+ inheritedName + ", but attemtping to inherit '" + parentProfile);
+ this.inheritedMatchFeatures = parentProfile;
+ }
+
/** Returns a read-only view of the match features to use in this profile. This is never null */
public Set<ReferenceNode> getMatchFeatures() {
+ if (inheritedMatchFeatures != null && matchFeatures != null) {
+ Set<ReferenceNode> combined = new HashSet<>();
+ combined.addAll(getInherited().getMatchFeatures());
+ combined.addAll(matchFeatures);
+ return Collections.unmodifiableSet(combined);
+ }
if (matchFeatures != null) return Collections.unmodifiableSet(matchFeatures);
if (getInherited() != null) return getInherited().getMatchFeatures();
return Set.of();
@@ -532,7 +556,7 @@ public class RankProfile implements Cloneable {
matchFeatures.add(feature);
}
- /** Adds the content of the given feature list to the internal list of summary features. */
+ /** Adds the content of the given feature list to the internal list of match features. */
public void addMatchFeatures(FeatureList features) {
for (ReferenceNode feature : features) {
addMatchFeature(feature);
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankingConstant.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankingConstant.java
index 7f29034157b..377e19eedf2 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankingConstant.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankingConstant.java
@@ -19,7 +19,10 @@ public class RankingConstant extends DistributableResource {
}
public RankingConstant(String name, TensorType type, String fileName) {
- super(name, fileName);
+ this(name, type, fileName, PathType.FILE);
+ }
+ public RankingConstant(String name, TensorType type, String fileName, PathType pathType) {
+ super(name, fileName, pathType);
this.tensorType = type;
validate();
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/RankingConstants.java b/config-model/src/main/java/com/yahoo/searchdefinition/RankingConstants.java
index 1e0eacaea16..5020e9a061c 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/RankingConstants.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/RankingConstants.java
@@ -2,9 +2,7 @@
package com.yahoo.searchdefinition;
import com.yahoo.config.application.api.FileRegistry;
-import com.yahoo.vespa.model.AbstractService;
-import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -77,8 +75,4 @@ public class RankingConstants {
return Collections.unmodifiableMap(allConstants);
}
- /** Initiate sending of these constants to some services over file distribution */
- public void sendTo(Collection<? extends AbstractService> services) {
- asMap().values().forEach(constant -> constant.sendTo(services));
- }
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java
index 36d4ba9699e..512d908ce5b 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/Schema.java
@@ -21,7 +21,6 @@ import com.yahoo.searchdefinition.document.TemporaryImportedFields;
import com.yahoo.searchdefinition.document.annotation.SDAnnotationType;
import com.yahoo.vespa.documentmodel.DocumentSummary;
import com.yahoo.vespa.documentmodel.SummaryField;
-import com.yahoo.vespa.model.AbstractService;
import java.io.Reader;
import java.util.ArrayList;
@@ -219,12 +218,6 @@ public class Schema implements ImmutableSchema {
@Override
public OnnxModels onnxModels() { return onnxModels; }
- public void sendTo(Collection<? extends AbstractService> services) {
- rankingConstants.sendTo(services);
- largeRankExpressions.sendTo(services);
- onnxModels.sendTo(services);
- }
-
public Optional<TemporaryImportedFields> temporaryImportedFields() {
return temporaryImportedFields;
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java
index faee6d67dbf..3081637c975 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/RankProfileList.java
@@ -16,10 +16,8 @@ import com.yahoo.searchdefinition.Schema;
import com.yahoo.vespa.config.search.core.OnnxModelsConfig;
import com.yahoo.vespa.config.search.core.RankingConstantsConfig;
import com.yahoo.vespa.config.search.core.RankingExpressionsConfig;
-import com.yahoo.vespa.model.AbstractService;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -144,12 +142,6 @@ public class RankProfileList extends Derived implements RankProfilesConfig.Produ
return rankProfiles.get(name);
}
- public void sendTo(Collection<? extends AbstractService> services) {
- rankingConstants.sendTo(services);
- largeRankExpressions.sendTo(services);
- onnxModels.sendTo(services);
- }
-
@Override
public String getDerivedName() { return "rank-profiles"; }
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java b/config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java
index fa510d15673..73b106ed393 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/AbstractService.java
@@ -1,7 +1,6 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model;
-import com.yahoo.config.FileReference;
import com.yahoo.config.application.api.DeployLogger;
import com.yahoo.config.model.api.PortInfo;
import com.yahoo.config.model.api.ServiceInfo;
@@ -453,15 +452,6 @@ public abstract class AbstractService extends AbstractConfigProducer<AbstractCon
return initialized;
}
- /**
- * Add the given file to the application's file distributor.
- *
- * @param reference file reference (hash)
- */
- public void send(FileReference reference) {
- getRoot().fileReferencesRepository().add(reference);
- }
-
/** The service HTTP port for health status */
public int getHealthPort() { return -1;}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/ConfigProducerRoot.java b/config-model/src/main/java/com/yahoo/vespa/model/ConfigProducerRoot.java
index 55bcadf4848..8c4b7fa23aa 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/ConfigProducerRoot.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/ConfigProducerRoot.java
@@ -4,7 +4,6 @@ package com.yahoo.vespa.model;
import com.yahoo.config.ConfigInstance;
import com.yahoo.config.model.producer.AbstractConfigProducer;
import com.yahoo.vespa.model.admin.Admin;
-import com.yahoo.vespa.model.filedistribution.FileReferencesRepository;
import java.util.Set;
@@ -37,9 +36,7 @@ public interface ConfigProducerRoot extends ConfigProducer {
* @param configId The config id
* @return A config instance of the given type
*/
- public <CONFIGTYPE extends ConfigInstance> CONFIGTYPE getConfig(Class<CONFIGTYPE> clazz, String configId);
-
- FileReferencesRepository fileReferencesRepository();
+ <CONFIGTYPE extends ConfigInstance> CONFIGTYPE getConfig(Class<CONFIGTYPE> clazz, String configId);
Admin getAdmin();
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
index 362b3f3a75c..d6c66a635d4 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java
@@ -131,7 +131,7 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
/** The validation overrides of this. This is never null. */
private final ValidationOverrides validationOverrides;
- private final FileReferencesRepository fileReferencesRepository = new FileReferencesRepository();
+ private final FileReferencesRepository fileReferencesRepository;
private final Provisioned provisioned;
@@ -171,6 +171,7 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
throws IOException, SAXException {
super("vespamodel");
version = deployState.getVespaVersion();
+ fileReferencesRepository = new FileReferencesRepository(deployState.getFileRegistry());
rankingConstants = new RankingConstants(deployState.getFileRegistry(), Optional.empty());
validationOverrides = deployState.validationOverrides();
applicationPackage = deployState.getApplicationPackage();
@@ -384,9 +385,6 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
.collect(Collectors.toCollection(LinkedHashSet::new));
}
- @Override
- public FileReferencesRepository fileReferencesRepository() { return fileReferencesRepository; }
-
public Set<FileReference> fileReferences() { return fileReferencesRepository.allFileReferences(); }
/** Returns this models Vespa instance */
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
index c9d41b7dc2d..c3897f49c44 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java
@@ -114,15 +114,12 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
@Override
protected void doPrepare(DeployState deployState) {
addAndSendApplicationBundles(deployState);
- if (modelEvaluation != null)
- modelEvaluation.prepare(containers);
sendUserConfiguredFiles(deployState);
}
private void addAndSendApplicationBundles(DeployState deployState) {
for (ComponentInfo component : deployState.getApplicationPackage().getComponentsInfo(deployState.getVespaVersion())) {
FileReference reference = deployState.getFileRegistry().addFile(component.getPathRelativeToAppDir());
- FileSender.send(reference, containers);
applicationBundles.add(reference);
}
}
@@ -166,7 +163,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
return servletGroup.getComponentMap();
}
- public final void addServlet(Servlet servlet) {
+ public void addServlet(Servlet servlet) {
servletGroup.addComponent(servlet.getGlobalComponentId(), servlet);
}
@@ -282,7 +279,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat
this.mbusParams = mbusParams;
}
- public final void setMessageBusEnabled(boolean messageBusEnabled) { this.messageBusEnabled = messageBusEnabled; }
+ public void setMessageBusEnabled(boolean messageBusEnabled) { this.messageBusEnabled = messageBusEnabled; }
protected boolean messageBusEnabled() { return messageBusEnabled; }
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java
index b7d3a726aff..40df899c94d 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ContainerModelEvaluation.java
@@ -12,7 +12,6 @@ import com.yahoo.vespa.model.container.component.Handler;
import com.yahoo.vespa.model.container.component.SystemBindingPattern;
import java.nio.file.Path;
-import java.util.List;
import java.util.Objects;
/**
@@ -45,10 +44,6 @@ public class ContainerModelEvaluation implements
cluster.addComponent(ContainerModelEvaluation.getHandler());
}
- public void prepare(List<ApplicationContainer> containers) {
- rankProfileList.sendTo(containers);
- }
-
@Override
public void getConfig(RankProfilesConfig.Builder builder) {
rankProfileList.getConfig(builder);
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 75043041c0f..533364d80c3 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
@@ -179,7 +179,6 @@ public class Content extends ConfigModel {
s.setVespaMallocDebugStackTrace(cluster.getRootGroup().getVespaMallocDebugStackTrace().get());
}
}
- cluster.prepare();
}
private void setCpuSocketAffinity() {
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 917b1d42146..b8de1845834 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
@@ -74,10 +74,6 @@ public class ContentSearchCluster extends AbstractConfigProducer<SearchCluster>
/** Whether the nodes of this cluster also hosts a container cluster in a hosted system */
private final boolean combined;
- public void prepare() {
- clusters.values().forEach(cluster -> cluster.prepareToDistributeFiles(getSearchNodes()));
- }
-
public static class Builder extends VespaDomBuilder.DomConfigProducerBuilder<ContentSearchCluster> {
private final Map<String, NewDocumentType> documentDefinitions;
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 1f65d239d18..0c0b2b80d79 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
@@ -408,10 +408,6 @@ public class ContentCluster extends AbstractConfigProducer<AbstractConfigProduce
public ClusterSpec.Id id() { return ClusterSpec.Id.from(clusterId); }
- public void prepare() {
- search.prepare();
- }
-
public DistributionMode getDistributionMode() {
if (distributionMode != null) return distributionMode;
return getPersistence().getDefaultDistributionMode();
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileReferencesRepository.java b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileReferencesRepository.java
index b2c0538e77b..ac5c456a7b1 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileReferencesRepository.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/filedistribution/FileReferencesRepository.java
@@ -2,9 +2,11 @@
package com.yahoo.vespa.model.filedistribution;
import com.yahoo.config.FileReference;
+import com.yahoo.config.application.api.FileRegistry;
import java.util.LinkedHashSet;
import java.util.Set;
+import java.util.stream.Collectors;
/**
* Keeps track of what files to send with file distribution
@@ -14,13 +16,13 @@ import java.util.Set;
*/
public class FileReferencesRepository {
- /** A set of file references that should be distributed */
- private final Set<FileReference> fileReferences = new LinkedHashSet<>();
+ private final FileRegistry fileRegistry;
+ public FileReferencesRepository(FileRegistry fileRegistry) {
+ this.fileRegistry = fileRegistry;
+ }
- public FileReferencesRepository() { }
-
- public void add(FileReference reference) { fileReferences.add(reference); }
-
- public Set<FileReference> allFileReferences() { return Set.copyOf(fileReferences); }
+ public Set<FileReference> allFileReferences() {
+ return fileRegistry.export().stream().map(e -> e.reference).collect(Collectors.toUnmodifiableSet());
+ }
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
index 82e8ecec543..19b1f39c87d 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/search/AbstractSearchCluster.java
@@ -37,12 +37,6 @@ public abstract class AbstractSearchCluster extends AbstractConfigProducer<Abstr
this.index = index;
}
- public void prepareToDistributeFiles(List<SearchNode> backends) {
- for (SchemaSpec sds : localSDS) {
- sds.getSearchDefinition().getSearch().sendTo(backends);
- }
- }
-
public void addDocumentNames(NamedSchema searchDefinition) {
String dName = searchDefinition.getSearch().getDocument().getDocumentName().getName();
documentNames.add(dName);
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java b/config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java
index f683db48e97..ad10e15930b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/utils/FileSender.java
@@ -36,25 +36,6 @@ public class FileSender implements Serializable {
}
/**
- * Send the given file to all given services.
- *
- * @param fileReference The file reference to send.
- * @param services The services to send the file to.
- * @throws IllegalStateException if services is empty.
- */
- public static void send(FileReference fileReference, Collection<? extends AbstractService> services) {
- if (services.isEmpty()) {
- throw new IllegalStateException("No service instances. Probably a standalone cluster setting up <nodes> " +
- "using 'count' instead of <node> tags.");
- }
-
- for (AbstractService service : services) {
- // The same reference will be returned from each call.
- service.send(fileReference);
- }
- }
-
- /**
* Sends all user configured files for a producer to all given services.
*/
public <PRODUCER extends AbstractConfigProducer<?>> void sendUserConfiguredFiles(PRODUCER producer) {
@@ -149,9 +130,7 @@ public class FileSender implements Serializable {
String path = builder.getValue();
FileReference reference = sentFiles.get(path);
if (reference == null) {
-
reference = fileRegistry.addFile(path);
- send(reference, services);
sentFiles.put(path, reference);
}
builder.setValue(reference.value());
diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj
index fe522494baf..07171dea803 100644
--- a/config-model/src/main/javacc/SDParser.jj
+++ b/config-model/src/main/javacc/SDParser.jj
@@ -29,6 +29,7 @@ import com.yahoo.documentmodel.*;
import com.yahoo.compress.Compressor;
import com.yahoo.compress.CompressionType;
import com.yahoo.searchdefinition.Application;
+import com.yahoo.searchdefinition.DistributableResource;
import com.yahoo.searchdefinition.document.*;
import com.yahoo.searchdefinition.document.annotation.SDAnnotationType;
import com.yahoo.searchdefinition.document.annotation.TemporaryAnnotationReferenceDataType;
@@ -357,6 +358,7 @@ TOKEN :
| < MULTITHREADEDINDEXING: "multi-threaded-indexing" >
| < MATCHFEATURES_SL: "match-features" (" ")* ":" (~["}","\n"])* ("\n")? >
| < MATCHFEATURES_ML: "match-features" (<SEARCHLIB_SKIP>)? "{" (~["}"])* "}" >
+| < MATCHFEATURES_ML_INHERITS: "match-features inherits " (<IDENTIFIER>) (<SEARCHLIB_SKIP>)? "{" (~["}"])* "}" >
| < SUMMARYFEATURES_SL: "summary-features" (" ")* ":" (~["}","\n"])* ("\n")? >
| < SUMMARYFEATURES_ML: "summary-features" (<SEARCHLIB_SKIP>)? "{" (~["}"])* "}" >
| < SUMMARYFEATURES_ML_INHERITS: "summary-features inherits " (<IDENTIFIER>) (<SEARCHLIB_SKIP>)? "{" (~["}"])* "}" >
@@ -1945,8 +1947,8 @@ Object onnxModelItem(OnnxModel onnxModel) :
}
{
(
- (<FILE> <COLON> path = filePath() { } (<NL>)*) { onnxModel.setFileName(path); } |
- (<URI> <COLON> path = uriPath() { } (<NL>)*) { onnxModel.setUri(path); } |
+ (path = fileItem()) { onnxModel.setFileName(path); } |
+ (path = uriItem()) { onnxModel.setUri(path); } |
(<ONNX_INPUT_SL>) {
String name = token.image.substring(5, token.image.lastIndexOf(":")).trim();
if (name.startsWith("\"")) { name = name.substring(1, name.length() - 1); }
@@ -1973,56 +1975,42 @@ Object onnxModelItem(OnnxModel onnxModel) :
void rankingConstant(Schema schema) :
{
String name;
- RankingConstant constant;
+ String path = null;
+ DistributableResource.PathType pathType = DistributableResource.PathType.FILE;
+ TensorType type = null;
}
{
- ( <CONSTANT> name = identifier()
- {
- constant = new RankingConstant(name);
- }
- lbrace() (rankingConstantItem(constant) (<NL>)*)+ <RBRACE> )
+ ( <CONSTANT> name = identifier() lbrace()
+ (path = fileItem() { pathType = DistributableResource.PathType.FILE; }
+ | path = uriItem() { pathType = DistributableResource.PathType.URI; }
+ | type = tensorTypeWithPrefix(rankingConstantErrorMessage(name)) (<NL>)*
+ )+
+ <RBRACE>
+ )
{
if (documentsOnly) return;
- schema.rankingConstants().add(constant);
+ schema.rankingConstants().add(new RankingConstant(name, type, path, pathType));
}
}
-/**
- * This rule consumes a constant block.
- *
- * @param constant The constant to modify.
- * @return Null.
- */
-Object rankingConstantItem(RankingConstant constant) :
+String fileItem() :
{
- String path = null;
- TensorType type = null;
+ String path;
}
{
- ( (<FILE> <COLON> path = filePath() { } (<NL>)*) { constant.setFileName(path); }
- | (<URI> <COLON> path = uriPath() { } (<NL>)*) { constant.setUri(path); }
- | type = tensorTypeWithPrefix(rankingConstantErrorMessage(constant.getName())) (<NL>)* { constant.setType(type); }
- )
- {
- return null;
- }
+ (<FILE> <COLON> ( <FILE_PATH> | <STRING> | <IDENTIFIER>) { path = token.image; } { } (<NL>)*) { return path; }
}
-
-String rankingConstantErrorMessage(String name) : {}
+String uriItem() :
{
- { return "For ranking constant ' " + name + "'"; }
+ String path;
}
-
-String filePath() : { }
{
- ( <FILE_PATH> | <STRING> | <IDENTIFIER>)
- { return token.image; }
+ (<URI> <COLON> ( <URI_PATH> ) { path = token.image; } (<NL>)*) { return path; }
}
-String uriPath() : { }
+String rankingConstantErrorMessage(String name) : {}
{
- ( <URI_PATH> )
- { return token.image; }
+ { return "For ranking constant ' " + name + "'"; }
}
/**
@@ -2335,7 +2323,14 @@ Object matchFeatures(RankProfile profile) :
{
( <MATCHFEATURES_SL> { features = token.image.substring(token.image.indexOf(":") + 1).trim(); } |
<MATCHFEATURES_ML> { features = token.image.substring(token.image.indexOf("{") + 1,
- token.image.lastIndexOf("}")).trim(); } )
+ token.image.lastIndexOf("}")).trim(); } |
+ <MATCHFEATURES_ML_INHERITS> {
+ int inheritsIndex = token.image.indexOf("inherits ");
+ String rest = token.image.substring(inheritsIndex + "inherits ".length());
+ profile.setInheritedMatchFeatures(rest.substring(0, rest.indexOf(" ")).trim());
+ features = token.image.substring(token.image.indexOf("{") + 1, token.image.lastIndexOf("}")).trim();
+ }
+ )
{
profile.addMatchFeatures(getFeatureList(features));
return null;