summaryrefslogtreecommitdiffstats
path: root/config-model/src
diff options
context:
space:
mode:
authorJon Marius Venstad <jonmv@users.noreply.github.com>2021-01-15 14:39:20 +0100
committerGitHub <noreply@github.com>2021-01-15 14:39:20 +0100
commit03801fa884fd8e3f351de2364526cc3170fb5a38 (patch)
tree1eeaeb1da08a10d2e95a309821a783e688e456af /config-model/src
parent67eb281db24723ce60e8f830614d564e2b29462c (diff)
parent3f6247f7d7c29d181282fb381106fb5e34ed8089 (diff)
Merge pull request #16056 from vespa-engine/jonmv/reindex-only-documents-with-real-indexing
Jonmv/reindex only documents with real indexing
Diffstat (limited to 'config-model/src')
-rw-r--r--config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java9
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/VespaModel.java19
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexedSearchClusterChangeValidator.java20
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidator.java5
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidator.java18
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidator.java6
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidator.java7
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java2
10 files changed, 31 insertions, 59 deletions
diff --git a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
index df9f72b2182..38d831a0b28 100644
--- a/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
+++ b/config-model/src/main/java/com/yahoo/documentmodel/NewDocumentType.java
@@ -34,15 +34,14 @@ public final class NewDocumentType extends StructuredDataType implements DataTyp
public static final class Name {
- // TODO: privatize
- final String name;
- final int id;
+ private final String name;
+ private final int id;
public Name(String name) {
- this(name.hashCode(),name);
+ this(name.hashCode(), name);
}
- public Name(int id,String name) {
+ public Name(int id, String name) {
this.id = id;
this.name = name;
}
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 9f9c5def406..acb4f58655d 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
@@ -404,25 +404,6 @@ public final class VespaModel extends AbstractConfigProducerRoot implements Seri
/**
* Resolve config for a given key and config definition
*
- * @param configKey The key to resolve.
- * @param targetDef The config definition to use for the schema
- * @return The payload as a list of strings
- */
- @Deprecated // TODO: Remove after December 2020
- @Override
- public ConfigPayload getConfig(ConfigKey<?> configKey, com.yahoo.vespa.config.buildergen.ConfigDefinition targetDef) {
- Objects.requireNonNull(targetDef, "config definition cannot be null");
-
- ConfigInstance.Builder builder = resolveToBuilder(configKey);
- log.log(Level.FINE, () -> "Found builder for " + configKey);
- InnerCNode innerCNode = targetDef.getCNode();
- ConfigPayload payload = getConfigFromBuilder(builder, innerCNode);
- return (innerCNode != null) ? payload.applyDefaultsFromDef(innerCNode) : payload;
- }
-
- /**
- * Resolve config for a given key and config definition
- *
* @param configKey the key to resolve.
* @param targetDef the config definition to use for the schema
* @return the resolved config instance
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 58cea8c23e5..2fbf4359121 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
@@ -32,23 +32,19 @@ public class IndexedSearchClusterChangeValidator implements ChangeValidator {
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, overrides, now));
+ result.addAll(validateContentCluster(currentEntry.getValue(), nextCluster));
}
}
return result;
}
private static List<ConfigChangeAction> validateContentCluster(ContentCluster currentCluster,
- ContentCluster nextCluster,
- ValidationOverrides overrides,
- Instant now) {
- return validateDocumentDatabases(currentCluster, nextCluster, overrides, now);
+ ContentCluster nextCluster) {
+ return validateDocumentDatabases(currentCluster, nextCluster);
}
private static List<ConfigChangeAction> validateDocumentDatabases(ContentCluster currentCluster,
- ContentCluster nextCluster,
- ValidationOverrides overrides,
- Instant now) {
+ ContentCluster nextCluster) {
List<ConfigChangeAction> result = new ArrayList<>();
for (DocumentDatabase currentDb : getDocumentDbs(currentCluster.getSearch())) {
String docTypeName = currentDb.getName();
@@ -56,7 +52,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(), overrides, now));
+ currentDb, nextDb.get()));
}
}
return result;
@@ -66,13 +62,11 @@ public class IndexedSearchClusterChangeValidator implements ChangeValidator {
ContentCluster nextCluster,
String docTypeName,
DocumentDatabase currentDb,
- DocumentDatabase nextDb,
- ValidationOverrides overrides,
- Instant now) {
+ DocumentDatabase nextDb) {
NewDocumentType currentDocType = currentCluster.getDocumentDefinitions().get(docTypeName);
NewDocumentType nextDocType = nextCluster.getDocumentDefinitions().get(docTypeName);
List<VespaConfigChangeAction> result =
- new DocumentDatabaseChangeValidator(currentCluster.id(), currentDb, currentDocType, nextDb, nextDocType).validate(overrides, now);
+ new DocumentDatabaseChangeValidator(currentCluster.id(), currentDb, currentDocType, nextDb, nextDocType).validate();
return modifyActions(result, getSearchNodeServices(nextCluster.getSearch().getIndexed()), docTypeName);
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidator.java b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidator.java
index 385a678d452..b83c345efd3 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidator.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/IndexingModeChangeValidator.java
@@ -35,13 +35,12 @@ public class IndexingModeChangeValidator implements ChangeValidator {
for (Map.Entry<String, ContentCluster> currentEntry : currentModel.getContentClusters().entrySet()) {
ContentCluster nextCluster = nextModel.getContentClusters().get(currentEntry.getKey());
if (nextCluster == null) continue;
- actions.addAll(validateContentCluster(currentEntry.getValue(), nextCluster, overrides, now));
+ actions.addAll(validateContentCluster(currentEntry.getValue(), nextCluster));
}
return actions;
}
- private static List<ConfigChangeAction> validateContentCluster(
- ContentCluster currentCluster, ContentCluster nextCluster, ValidationOverrides overrides, Instant now) {
+ private static List<ConfigChangeAction> validateContentCluster(ContentCluster currentCluster, ContentCluster nextCluster) {
List<ConfigChangeAction> actions = new ArrayList<>();
ContentSearchCluster currentSearchCluster = currentCluster.getSearch();
ContentSearchCluster nextSearchCluster = nextCluster.getSearch();
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 ce435a4c157..5596169958a 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
@@ -36,12 +36,12 @@ public class DocumentDatabaseChangeValidator {
this.nextDocType = nextDocType;
}
- public List<VespaConfigChangeAction> validate(ValidationOverrides overrides, Instant now) {
+ public List<VespaConfigChangeAction> validate() {
List<VespaConfigChangeAction> result = new ArrayList<>();
result.addAll(validateAttributeChanges());
- result.addAll(validateStructFieldAttributeChanges(overrides, now));
- result.addAll(validateIndexingScriptChanges(overrides, now));
- result.addAll(validateDocumentTypeChanges(overrides, now));
+ result.addAll(validateStructFieldAttributeChanges());
+ result.addAll(validateIndexingScriptChanges());
+ result.addAll(validateDocumentTypeChanges());
return result;
}
@@ -54,23 +54,23 @@ public class DocumentDatabaseChangeValidator {
.validate();
}
- private List<VespaConfigChangeAction> validateStructFieldAttributeChanges(ValidationOverrides overrides, Instant now) {
+ private List<VespaConfigChangeAction> validateStructFieldAttributeChanges() {
return new StructFieldAttributeChangeValidator(id,
currentDocType,
currentDatabase.getDerivedConfiguration().getAttributeFields(),
nextDocType,
nextDatabase.getDerivedConfiguration().getAttributeFields())
- .validate(overrides, now);
+ .validate();
}
- private List<VespaConfigChangeAction> validateIndexingScriptChanges(ValidationOverrides overrides, Instant now) {
+ private List<VespaConfigChangeAction> validateIndexingScriptChanges() {
return new IndexingScriptChangeValidator(id,
currentDatabase.getDerivedConfiguration().getSearch(),
nextDatabase.getDerivedConfiguration().getSearch())
- .validate(overrides, now);
+ .validate();
}
- private List<VespaConfigChangeAction> validateDocumentTypeChanges(ValidationOverrides overrides, Instant now) {
+ private List<VespaConfigChangeAction> validateDocumentTypeChanges() {
return new DocumentTypeChangeValidator(id, currentDocType, nextDocType)
.validate();
}
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 e3f3abf0747..91e370211f1 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
@@ -35,7 +35,7 @@ public class IndexingScriptChangeValidator {
this.nextSearch = nextSearch;
}
- public List<VespaConfigChangeAction> validate(ValidationOverrides overrides, Instant now) {
+ public List<VespaConfigChangeAction> validate() {
List<VespaConfigChangeAction> result = new ArrayList<>();
for (ImmutableSDField nextField : nextSearch.allConcreteFields()) {
String fieldName = nextField.getName();
@@ -68,8 +68,8 @@ public class IndexingScriptChangeValidator {
return removeOutputExpressions(currentScript).equals(removeOutputExpressions(nextScript));
}
- private static ScriptExpression removeOutputExpressions(ScriptExpression script) {
- return (ScriptExpression) new OutputExpressionRemover().convert(script);
+ private static Expression removeOutputExpressions(ScriptExpression script) {
+ return new OutputExpressionRemover().convert(script);
}
private static class OutputExpressionRemover extends ExpressionConverter {
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 e8b2d593de6..a86277dded8 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
@@ -52,20 +52,19 @@ public class StructFieldAttributeChangeValidator {
this.nextAttributes = nextAttributes;
}
- public List<VespaConfigChangeAction> validate(ValidationOverrides overrides, Instant now) {
+ public List<VespaConfigChangeAction> validate() {
List<VespaConfigChangeAction> result = new ArrayList();
for (Field currentField : currentDocType.getAllFields()) {
Field nextField = nextDocType.getField(currentField.getName());
if (nextField != null) {
result.addAll(validateAddAttributeAspect(new Context(currentField, currentAttributes),
- new Context(nextField, nextAttributes),
- overrides, now));
+ new Context(nextField, nextAttributes)));
}
}
return result;
}
- private List<VespaConfigChangeAction> validateAddAttributeAspect(Context current, Context next, ValidationOverrides overrides, Instant now) {
+ private List<VespaConfigChangeAction> validateAddAttributeAspect(Context current, Context next) {
return next.structFieldAttributes.stream()
.filter(nextAttr -> current.hasFieldForStructFieldAttribute(nextAttr) &&
!current.hasStructFieldAttribute(nextAttr))
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 1f64d41e371..27a32f3e754 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
@@ -31,7 +31,7 @@ public class DocumentDatabaseChangeValidatorTest {
@Override
public List<VespaConfigChangeAction> validate() {
- return validator.validate(ValidationOverrides.empty, Instant.now());
+ return validator.validate();
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
index 2e1ec53f886..20f5a9c841c 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/IndexingScriptChangeValidatorTest.java
@@ -29,7 +29,7 @@ public class IndexingScriptChangeValidatorTest {
@Override
public List<VespaConfigChangeAction> validate() {
- return validator.validate(ValidationOverrides.empty, Instant.now());
+ return validator.validate();
}
}
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java
index 0bc4ecbfdfd..d37ab8be9a2 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java
@@ -35,7 +35,7 @@ public class StructFieldAttributeChangeValidatorTestCase {
@Override
public List<VespaConfigChangeAction> validate() {
List<VespaConfigChangeAction> result = new ArrayList<>();
- result.addAll(structFieldAttributeValidator.validate(ValidationOverrides.empty, Instant.now()));
+ result.addAll(structFieldAttributeValidator.validate());
result.addAll(docTypeValidator.validate());
return result;
}