aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2021-12-09 22:04:59 +0100
committerGitHub <noreply@github.com>2021-12-09 22:04:59 +0100
commit63772511a352f1619b4602a91bfb22f858eeba9a (patch)
treed247ed9c732b326cd61d727eb4b99afa1208eab8 /config-model
parent68dbb0d83a1846fc729cef36985956b002f6d7e4 (diff)
parent9712b54640a3d29c62ed51432272adfe21395c21 (diff)
Merge pull request #20427 from vespa-engine/bratseth/paged-removal-validation
Add validation override for 'paged' removal
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java4
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/processing/PagedAttributeValidator.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java29
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidator.java62
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/ChangeMessageBuilder.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidator.java11
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java9
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidator.java3
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidator.java6
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java24
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java6
11 files changed, 114 insertions, 54 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java
index 0a51ce3dda5..5ac6dd46102 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java
@@ -114,6 +114,7 @@ public final class Attribute implements Cloneable, Serializable {
public String getName() { return myName; }
public String getExportAttributeTypeName() { return exportAttributeTypeName; }
+ @Override
public String toString() {
return "type: " + myName;
}
@@ -134,9 +135,11 @@ public final class Attribute implements Cloneable, Serializable {
public String getName() { return name; }
+ @Override
public String toString() {
return "collectiontype: " + name;
}
+
}
/** Creates an attribute with default settings */
@@ -406,6 +409,7 @@ public final class Attribute implements Cloneable, Serializable {
}
}
+ @Override
public String toString() {
return "attribute '" + name + "' (" + type + ")";
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/PagedAttributeValidator.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/PagedAttributeValidator.java
index d108a620fd9..2a4f4f18759 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/PagedAttributeValidator.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/PagedAttributeValidator.java
@@ -16,7 +16,6 @@ import com.yahoo.vespa.model.container.search.QueryProfiles;
*/
public class PagedAttributeValidator extends Processor {
-
public PagedAttributeValidator(Schema schema,
DeployLogger deployLogger,
RankProfileRegistry rankProfileRegistry,
@@ -40,8 +39,8 @@ public class PagedAttributeValidator extends Processor {
private void validatePagedSetting(Field field, Attribute attribute) {
var tensorType = attribute.tensorType();
- if (!tensorType.isPresent() ||
- !isDenseTensorType(tensorType.get())) {
+ if (tensorType.isEmpty()
+ || !isDenseTensorType(tensorType.get())) {
fail(schema, field, "The 'paged' attribute setting is only supported for dense tensor types");
}
}
@@ -49,4 +48,5 @@ public class PagedAttributeValidator extends Processor {
private boolean isDenseTensorType(TensorType type) {
return type.dimensions().stream().allMatch(d -> d.isIndexed());
}
+
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java
index a43c5b71903..8c333a099d0 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java
@@ -27,24 +27,29 @@ import java.util.stream.Collectors;
public class IndexedSearchClusterChangeValidator implements ChangeValidator {
@Override
- public List<ConfigChangeAction> validate(VespaModel current, VespaModel next, ValidationOverrides overrides, Instant now) {
+ public List<ConfigChangeAction> validate(VespaModel current, VespaModel next,
+ ValidationOverrides overrides, Instant now) {
List<ConfigChangeAction> result = new ArrayList<>();
for (Map.Entry<String, ContentCluster> currentEntry : current.getContentClusters().entrySet()) {
ContentCluster nextCluster = next.getContentClusters().get(currentEntry.getKey());
if (nextCluster != null && nextCluster.getSearch().hasIndexedCluster()) {
- result.addAll(validateContentCluster(currentEntry.getValue(), nextCluster));
+ result.addAll(validateContentCluster(currentEntry.getValue(), nextCluster, overrides, now));
}
}
return result;
}
private static List<ConfigChangeAction> validateContentCluster(ContentCluster currentCluster,
- ContentCluster nextCluster) {
- return validateDocumentDatabases(currentCluster, nextCluster);
+ ContentCluster nextCluster,
+ ValidationOverrides overrides,
+ Instant now) {
+ return validateDocumentDatabases(currentCluster, nextCluster, overrides, now);
}
private static List<ConfigChangeAction> validateDocumentDatabases(ContentCluster currentCluster,
- ContentCluster nextCluster) {
+ ContentCluster nextCluster,
+ ValidationOverrides overrides,
+ Instant now) {
List<ConfigChangeAction> result = new ArrayList<>();
for (DocumentDatabase currentDb : getDocumentDbs(currentCluster.getSearch())) {
String docTypeName = currentDb.getName();
@@ -52,7 +57,7 @@ public class IndexedSearchClusterChangeValidator implements ChangeValidator {
filter(db -> db.getName().equals(docTypeName)).findFirst();
if (nextDb.isPresent()) {
result.addAll(validateDocumentDatabase(currentCluster, nextCluster, docTypeName,
- currentDb, nextDb.get()));
+ currentDb, nextDb.get(), overrides, now));
}
}
return result;
@@ -62,11 +67,19 @@ public class IndexedSearchClusterChangeValidator implements ChangeValidator {
ContentCluster nextCluster,
String docTypeName,
DocumentDatabase currentDb,
- DocumentDatabase nextDb) {
+ DocumentDatabase nextDb,
+ ValidationOverrides overrides,
+ Instant now) {
NewDocumentType currentDocType = currentCluster.getDocumentDefinitions().get(docTypeName);
NewDocumentType nextDocType = nextCluster.getDocumentDefinitions().get(docTypeName);
List<VespaConfigChangeAction> result =
- new DocumentDatabaseChangeValidator(currentCluster.id(), currentDb, currentDocType, nextDb, nextDocType).validate();
+ new DocumentDatabaseChangeValidator(currentCluster.id(),
+ currentDb,
+ currentDocType,
+ nextDb,
+ nextDocType,
+ overrides,
+ now).validate();
return modifyActions(result, getSearchNodeServices(nextCluster.getSearch().getIndexed()), docTypeName);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidator.java
index 431bca3fb5a..1957c52e841 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidator.java
@@ -1,6 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.application.validation.change.search;
+import com.yahoo.config.application.api.ValidationId;
+import com.yahoo.config.application.api.ValidationOverrides;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.documentmodel.NewDocumentType;
import com.yahoo.searchdefinition.derived.AttributeFields;
@@ -12,6 +14,7 @@ import com.yahoo.searchdefinition.document.HnswIndexParams;
import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction;
import com.yahoo.vespa.model.application.validation.change.VespaRestartAction;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -33,6 +36,8 @@ public class AttributeChangeValidator {
private final AttributeFields nextFields;
private final IndexSchema nextIndexSchema;
private final NewDocumentType nextDocType;
+ private final ValidationOverrides overrides;
+ private final Instant now;
public AttributeChangeValidator(ClusterSpec.Id id,
AttributeFields currentFields,
@@ -40,7 +45,9 @@ public class AttributeChangeValidator {
NewDocumentType currentDocType,
AttributeFields nextFields,
IndexSchema nextIndexSchema,
- NewDocumentType nextDocType) {
+ NewDocumentType nextDocType,
+ ValidationOverrides overrides,
+ Instant now) {
this.id = id;
this.currentFields = currentFields;
this.currentIndexSchema = currentIndexSchema;
@@ -48,6 +55,8 @@ public class AttributeChangeValidator {
this.nextFields = nextFields;
this.nextIndexSchema = nextIndexSchema;
this.nextDocType = nextDocType;
+ this.overrides = overrides;
+ this.now = now;
}
public List<VespaConfigChangeAction> validate() {
@@ -97,23 +106,23 @@ public class AttributeChangeValidator {
private List<VespaConfigChangeAction> validateAttributeSettings() {
List<VespaConfigChangeAction> result = new ArrayList<>();
- for (Attribute nextAttr : nextFields.attributes()) {
- Attribute currAttr = currentFields.getAttribute(nextAttr.getName());
- if (currAttr != null) {
- validateAttributeSetting(id, currAttr, nextAttr, Attribute::isFastSearch, "fast-search", result);
- validateAttributeSetting(id, currAttr, nextAttr, Attribute::isFastAccess, "fast-access", result);
- validateAttributeSetting(id, currAttr, nextAttr, AttributeChangeValidator::extractDictionaryType, "dictionary: btree/hash", result);
- validateAttributeSetting(id, currAttr, nextAttr, AttributeChangeValidator::extractDictionaryCase, "dictionary: cased/uncased", result);
- validateAttributeSetting(id, currAttr, nextAttr, Attribute::isHuge, "huge", result);
- validateAttributeSetting(id, currAttr, nextAttr, Attribute::isPaged, "paged", result);
- validateAttributeSetting(id, currAttr, nextAttr, Attribute::densePostingListThreshold, "dense-posting-list-threshold", result);
- validateAttributeSetting(id, currAttr, nextAttr, Attribute::isEnabledOnlyBitVector, "rank: filter", result);
- validateAttributeSetting(id, currAttr, nextAttr, Attribute::distanceMetric, "distance-metric", result);
-
- validateAttributeSetting(id, currAttr, nextAttr, AttributeChangeValidator::hasHnswIndex, "indexing: index", result);
- if (hasHnswIndex(currAttr) && hasHnswIndex(nextAttr)) {
- validateAttributeHnswIndexSetting(id, currAttr, nextAttr, HnswIndexParams::maxLinksPerNode, "max-links-per-node", result);
- validateAttributeHnswIndexSetting(id, currAttr, nextAttr, HnswIndexParams::neighborsToExploreAtInsert, "neighbors-to-explore-at-insert", result);
+ for (Attribute next : nextFields.attributes()) {
+ Attribute current = currentFields.getAttribute(next.getName());
+ if (current != null) {
+ validateAttributeSetting(id, current, next, Attribute::isFastSearch, "fast-search", result);
+ validateAttributeSetting(id, current, next, Attribute::isFastAccess, "fast-access", result);
+ validateAttributeSetting(id, current, next, AttributeChangeValidator::extractDictionaryType, "dictionary: btree/hash", result);
+ validateAttributeSetting(id, current, next, AttributeChangeValidator::extractDictionaryCase, "dictionary: cased/uncased", result);
+ validateAttributeSetting(id, current, next, Attribute::isHuge, "huge", result);
+ validateAttributeSetting(id, current, next, Attribute::isPaged, "paged", result);
+ validatePagedAttributeRemoval(current, next);
+ validateAttributeSetting(id, current, next, Attribute::densePostingListThreshold, "dense-posting-list-threshold", result);
+ validateAttributeSetting(id, current, next, Attribute::isEnabledOnlyBitVector, "rank: filter", result);
+ validateAttributeSetting(id, current, next, Attribute::distanceMetric, "distance-metric", result);
+ validateAttributeSetting(id, current, next, AttributeChangeValidator::hasHnswIndex, "indexing: index", result);
+ if (hasHnswIndex(current) && hasHnswIndex(next)) {
+ validateAttributeHnswIndexSetting(id, current, next, HnswIndexParams::maxLinksPerNode, "max-links-per-node", result);
+ validateAttributeHnswIndexSetting(id, current, next, HnswIndexParams::neighborsToExploreAtInsert, "neighbors-to-explore-at-insert", result);
}
}
}
@@ -132,14 +141,14 @@ public class AttributeChangeValidator {
}
private static <T> void validateAttributeSetting(ClusterSpec.Id id,
- Attribute currentAttr, Attribute nextAttr,
+ Attribute current, Attribute next,
Function<Attribute, T> settingValueProvider, String setting,
List<VespaConfigChangeAction> result) {
- T currentValue = settingValueProvider.apply(currentAttr);
- T nextValue = settingValueProvider.apply(nextAttr);
+ T currentValue = settingValueProvider.apply(current);
+ T nextValue = settingValueProvider.apply(next);
if ( ! Objects.equals(currentValue, nextValue)) {
String message = String.format("change property '%s' from '%s' to '%s'", setting, currentValue, nextValue);
- result.add(new VespaRestartAction(id, new ChangeMessageBuilder(nextAttr.getName()).addChange(message).build()));
+ result.add(new VespaRestartAction(id, new ChangeMessageBuilder(next.getName()).addChange(message).build()));
}
}
@@ -156,4 +165,13 @@ public class AttributeChangeValidator {
}
}
+ private void validatePagedAttributeRemoval(Attribute current, Attribute next) {
+ if (current.isPaged() && !next.isPaged()) {
+ overrides.invalid(ValidationId.pagedSettingRemoval,
+ current + "' has setting 'paged' removed. " +
+ "This may cause content nodes to run out of memory as the entire attribute is loaded into memory",
+ now);
+ }
+ }
+
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/ChangeMessageBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/ChangeMessageBuilder.java
index ba0e0717c07..3481d2ce219 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/ChangeMessageBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/ChangeMessageBuilder.java
@@ -5,10 +5,9 @@ import java.util.ArrayList;
import java.util.List;
/**
- * Class used to build a message describing the changes in a given field.
+ * Builder of a message describing the changes in a given field.
*
* @author geirst
- * @since 2014-12-09
*/
public class ChangeMessageBuilder {
@@ -20,10 +19,7 @@ public class ChangeMessageBuilder {
}
public String build() {
- StringBuilder retval = new StringBuilder();
- retval.append("Field '" + fieldName + "' changed: ");
- retval.append(String.join(", ", changes));
- return retval.toString();
+ return "Field '" + fieldName + "' changed: " + String.join(", ", changes);
}
public ChangeMessageBuilder addChange(String component, String from, String to) {
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidator.java
index be2f49085b2..bff337adfb6 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidator.java
@@ -23,17 +23,23 @@ public class DocumentDatabaseChangeValidator {
private final NewDocumentType currentDocType;
private final DocumentDatabase nextDatabase;
private final NewDocumentType nextDocType;
+ private final ValidationOverrides overrides;
+ private final Instant now;
public DocumentDatabaseChangeValidator(ClusterSpec.Id id,
DocumentDatabase currentDatabase,
NewDocumentType currentDocType,
DocumentDatabase nextDatabase,
- NewDocumentType nextDocType) {
+ NewDocumentType nextDocType,
+ ValidationOverrides overrides,
+ Instant now) {
this.id = id;
this.currentDatabase = currentDatabase;
this.currentDocType = currentDocType;
this.nextDatabase = nextDatabase;
this.nextDocType = nextDocType;
+ this.overrides = overrides;
+ this.now = now;
}
public List<VespaConfigChangeAction> validate() {
@@ -50,7 +56,8 @@ public class DocumentDatabaseChangeValidator {
currentDatabase.getDerivedConfiguration().getAttributeFields(),
currentDatabase.getDerivedConfiguration().getIndexSchema(), currentDocType,
nextDatabase.getDerivedConfiguration().getAttributeFields(),
- nextDatabase.getDerivedConfiguration().getIndexSchema(), nextDocType)
+ nextDatabase.getDerivedConfiguration().getIndexSchema(), nextDocType,
+ overrides, now)
.validate();
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java
index ce8347b66c1..5e258fde821 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeMessageBuilder.java
@@ -14,7 +14,6 @@ import com.yahoo.vespa.documentmodel.SummaryTransform;
* This message should be more descriptive for the end-user than just seeing the changed indexing script.
*
* @author geirst
- * @since 2014-12-09
*/
public class IndexingScriptChangeMessageBuilder {
@@ -57,7 +56,7 @@ public class IndexingScriptChangeMessageBuilder {
private void checkStemming(ChangeMessageBuilder builder) {
Stemming currentStemming = currentField.getStemming(currentSchema);
Stemming nextStemming = nextField.getStemming(nextSchema);
- if (!currentStemming.equals(nextStemming)) {
+ if (currentStemming != nextStemming) {
builder.addChange("stemming", currentStemming.getName(), nextStemming.getName());
}
}
@@ -65,7 +64,7 @@ public class IndexingScriptChangeMessageBuilder {
private void checkNormalizing(ChangeMessageBuilder builder) {
NormalizeLevel.Level currentLevel = currentField.getNormalizing().getLevel();
NormalizeLevel.Level nextLevel = nextField.getNormalizing().getLevel();
- if (!currentLevel.equals(nextLevel)) {
+ if (currentLevel != nextLevel) {
builder.addChange("normalizing", currentLevel.toString(), nextLevel.toString());
}
}
@@ -77,7 +76,7 @@ public class IndexingScriptChangeMessageBuilder {
if (currentSummaryField != null) {
SummaryTransform currentTransform = currentSummaryField.getTransform();
SummaryTransform nextTransform = nextSummaryField.getTransform();
- if (!currentSummaryField.getTransform().equals(nextSummaryField.getTransform())) {
+ if (currentSummaryField.getTransform() != nextSummaryField.getTransform()) {
builder.addChange("summary field '" + fieldName + "' transform",
currentTransform.getName(), nextTransform.getName());
}
@@ -88,7 +87,7 @@ public class IndexingScriptChangeMessageBuilder {
private static String toString(Matching matching) {
Matching.Type type = matching.getType();
String retval = type.getName();
- if (type.equals(Matching.Type.GRAM)) {
+ if (type == Matching.Type.GRAM) {
retval += " (size " + matching.getGramSize() + ")";
}
return retval;
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidator.java
index e64a3d44bba..f6f6b6abdee 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidator.java
@@ -64,8 +64,7 @@ public class IndexingScriptChangeValidator {
return Optional.empty();
}
- static boolean equalScripts(ScriptExpression currentScript,
- ScriptExpression nextScript) {
+ static boolean equalScripts(ScriptExpression currentScript, ScriptExpression nextScript) {
// Output expressions are specifying in which context a field value is used (attribute, index, summary),
// and do not affect how the field value is generated in the indexing doc proc.
// The output expressions are therefore removed before doing the comparison.
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidator.java
index acb404a051b..a10d2c36de1 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidator.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.application.validation.change.search;
-import com.yahoo.config.application.api.ValidationOverrides;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.document.ArrayDataType;
import com.yahoo.document.DataType;
@@ -15,7 +14,6 @@ import com.yahoo.searchdefinition.document.ComplexAttributeFieldUtils;
import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction;
import com.yahoo.vespa.model.application.validation.change.VespaRestartAction;
-import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -24,7 +22,7 @@ import java.util.stream.Collectors;
/**
* Validates the changes between the current and next set of struct field attributes in a document database.
-
+ *
* Complex fields of the following types are considered (as they might have struct field attributes):
* - array of simple struct
* - map of simple struct
@@ -53,7 +51,7 @@ public class StructFieldAttributeChangeValidator {
}
public List<VespaConfigChangeAction> validate() {
- List<VespaConfigChangeAction> result = new ArrayList();
+ List<VespaConfigChangeAction> result = new ArrayList<>();
for (Field currentField : currentDocType.getAllFields()) {
Field nextField = nextDocType.getField(currentField.getName());
if (nextField != null) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java
index 87c7c898f96..3cfde4c4d19 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java
@@ -1,13 +1,18 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.application.validation.change.search;
+import com.yahoo.config.application.api.ValidationId;
+import com.yahoo.config.application.api.ValidationOverrides;
import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.test.ManualClock;
import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction;
import org.junit.Test;
import java.util.List;
import static com.yahoo.vespa.model.application.validation.change.ConfigChangeTestUtils.newRestartAction;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
public class AttributeChangeValidatorTest {
@@ -22,7 +27,9 @@ public class AttributeChangeValidatorTest {
currentDocType(),
nextDb().getDerivedConfiguration().getAttributeFields(),
nextDb().getDerivedConfiguration().getIndexSchema(),
- nextDocType());
+ nextDocType(),
+ new ValidationOverrides(List.of()),
+ new ManualClock().instant());
}
@Override
@@ -202,4 +209,19 @@ public class AttributeChangeValidatorTest {
"Field 'f1' changed: change hnsw index property " +
"'neighbors-to-explore-at-insert' from '200' to '100'"));
}
+
+ @Test
+ public void removing_paged_requires_override() throws Exception {
+ try {
+ new Fixture("field f1 type tensor(x[10]) { indexing: attribute \n attribute: paged }",
+ "field f1 type tensor(x[10]) { indexing: attribute }").
+ assertValidation();
+ fail("Expected exception on removal of 'paged'");
+ }
+ catch (ValidationOverrides.ValidationException e) {
+ assertTrue(e.getMessage().contains(ValidationId.pagedSettingRemoval.toString()));
+ }
+ }
+
+
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java
index d5c84be2008..aba5c2aa05c 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java
@@ -2,7 +2,9 @@
package com.yahoo.vespa.model.application.validation.change.search;
import com.yahoo.config.application.api.ValidationId;
+import com.yahoo.config.application.api.ValidationOverrides;
import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.test.ManualClock;
import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction;
import org.junit.Test;
@@ -25,7 +27,9 @@ public class DocumentDatabaseChangeValidatorTest {
currentDb(),
currentDocType(),
nextDb(),
- nextDocType());
+ nextDocType(),
+ new ValidationOverrides(List.of()),
+ new ManualClock().instant());
}
@Override