summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-12-16 10:07:30 +0100
committerJon Bratseth <bratseth@verizonmedia.com>2019-12-16 10:07:30 +0100
commitbaa6a81aa07f37a543c836710b4c65b7831fd9db (patch)
tree7e0724c298a1b45f356956b897133c07b618dff5 /config-model
parent45992cec4b915513372b1d8e777e505aaee3f4a1 (diff)
parent65dd6eb4932a7c29cbad7d717bc34da73d0bb723 (diff)
Merge with master
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/DocumentReferenceResolver.java4
-rw-r--r--config-model/src/main/java/com/yahoo/searchdefinition/MapEvaluationTypeContext.java9
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidator.java8
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/configserver/option/CloudConfigOptions.java2
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java49
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/DocumentDatabaseChangeValidatorTest.java3
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/StructFieldAttributeChangeValidatorTestCase.java14
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/configserver/TestOptions.java6
9 files changed, 68 insertions, 30 deletions
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentReferenceResolver.java b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentReferenceResolver.java
index b0bc376de81..14f8a0a9d37 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/DocumentReferenceResolver.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/DocumentReferenceResolver.java
@@ -52,8 +52,8 @@ public class DocumentReferenceResolver {
Search search = searchMapping.get(targetDocumentName);
if (search == null) {
throw new IllegalArgumentException(
- String.format("The field '%s' is an invalid document reference. " +
- "Could not find document with '%s' in any search definitions", field.getName(), targetDocumentName));
+ String.format("Invalid document reference '%s': " +
+ "Could not find document type '%s'", field.getName(), targetDocumentName));
}
return new DocumentReference(field, search);
}
diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/MapEvaluationTypeContext.java b/config-model/src/main/java/com/yahoo/searchdefinition/MapEvaluationTypeContext.java
index 2be3022ce6e..7c4edd4cdfb 100644
--- a/config-model/src/main/java/com/yahoo/searchdefinition/MapEvaluationTypeContext.java
+++ b/config-model/src/main/java/com/yahoo/searchdefinition/MapEvaluationTypeContext.java
@@ -89,9 +89,10 @@ public class MapEvaluationTypeContext extends FunctionReferenceContext implement
currentResolutionCallStack.stream().map(Reference::toString).collect(Collectors.joining(" -> ")) +
" -> " + reference);
- // A reference to a function argument?
+
+ // Bound toi a function argument, and not to a same-named identifier (which would lead to a loop)?
Optional<String> binding = boundIdentifier(reference);
- if (binding.isPresent()) {
+ if (binding.isPresent() && ! binding.get().equals(reference.toString())) {
try {
// This is not pretty, but changing to bind expressions rather
// than their string values requires deeper changes
@@ -125,8 +126,8 @@ public class MapEvaluationTypeContext extends FunctionReferenceContext implement
return featureTensorType.get();
}
- // We do not know what this is - since we do not have complete knowledge abut the match features
- // in Java we must assume this is a match feature and return the double type - which is the type of all
+ // We do not know what this is - since we do not have complete knowledge about the match features
+ // in Java we must assume this is a match feature and return the double type - which is the type of
// all match features
return TensorType.empty;
}
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 4dfeb808e31..e3f9610d0a4 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
@@ -12,7 +12,7 @@ import com.yahoo.searchdefinition.derived.AttributeFields;
import com.yahoo.searchdefinition.document.Attribute;
import com.yahoo.searchdefinition.document.ComplexAttributeFieldUtils;
import com.yahoo.vespa.model.application.validation.change.VespaConfigChangeAction;
-import com.yahoo.vespa.model.application.validation.change.VespaRefeedAction;
+import com.yahoo.vespa.model.application.validation.change.VespaRestartAction;
import java.time.Instant;
import java.util.ArrayList;
@@ -65,11 +65,9 @@ public class StructFieldAttributeChangeValidator {
return next.structFieldAttributes.stream()
.filter(nextAttr -> current.hasFieldForStructFieldAttribute(nextAttr) &&
!current.hasStructFieldAttribute(nextAttr))
- .map(nextAttr -> VespaRefeedAction.of("field-type-change",
- overrides,
+ .map(nextAttr -> new VespaRestartAction(
new ChangeMessageBuilder(nextAttr.getName())
- .addChange("add attribute aspect").build(),
- now))
+ .addChange("add attribute aspect").build()))
.collect(Collectors.toList());
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/configserver/option/CloudConfigOptions.java b/config-model/src/main/java/com/yahoo/vespa/model/container/configserver/option/CloudConfigOptions.java
index 8c1450d9111..fff1e162a6c 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/configserver/option/CloudConfigOptions.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/configserver/option/CloudConfigOptions.java
@@ -31,12 +31,10 @@ public interface CloudConfigOptions {
Optional<Long> zookeeperBarrierTimeout(); //in seconds
Optional<Integer> zookeeperElectionPort();
Optional<Integer> zookeeperQuorumPort();
- Optional<String> payloadCompressionType(); // TODO: Remove when 7.146 is the oldest version in use
Optional<String> environment();
Optional<String> region();
Optional<String> system();
Optional<Boolean> useVespaVersionInRequest();
- Optional<Integer> numParallelTenantLoaders(); // TODO: Remove when 7.146 is the oldest version in use
Optional<String> loadBalancerAddress();
Optional<String> athenzDnsSuffix();
Optional<String> ztsUrl();
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java
index 9803bd2f55d..8378ec811a5 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java
@@ -69,8 +69,7 @@ public class DocumentReferenceResolverTest {
exceptionRule.expect(IllegalArgumentException.class);
exceptionRule.expectMessage(
- "The field 'bar_ref' is an invalid document reference. " +
- "Could not find document with 'bar' in any search definitions");
+ "Invalid document reference 'bar_ref': Could not find document type 'bar'");
resolver.resolveReferences(fooDocument);
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java
index 9a0dcc7dd07..78484d0c889 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/RankingExpressionLoopDetectionTestCase.java
@@ -194,4 +194,53 @@ public class RankingExpressionLoopDetectionTestCase {
builder.build();
}
+ @Test
+ public void testNoLoopWithTheSameNestedIdentifierWhichIsUnbound() throws ParseException {
+ RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
+ SearchBuilder builder = new SearchBuilder(rankProfileRegistry);
+ builder.importString(
+ "search test {\n" +
+ " document test { \n" +
+ " }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo()\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: bar(x)\n" +
+ " }\n" +
+ " function bar(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
+ builder.build();
+ }
+
+ @Test
+ public void testNoLoopWithTheSameAlternatingNestedIdentifierWhichIsUnbound() throws ParseException {
+ RankProfileRegistry rankProfileRegistry = new RankProfileRegistry();
+ SearchBuilder builder = new SearchBuilder(rankProfileRegistry);
+ builder.importString(
+ "search test {\n" +
+ " document test { \n" +
+ " }\n" +
+ " rank-profile test {\n" +
+ " first-phase {\n" +
+ " expression: foo()\n" +
+ " }\n" +
+ " function foo() {\n" +
+ " expression: bar(x)\n" +
+ " }\n" +
+ " function bar(y) {\n" +
+ " expression: baz(y)\n" +
+ " }\n" +
+ " function baz(x) {\n" +
+ " expression: x + x\n" +
+ " }\n" +
+ " }\n" +
+ "}\n");
+ builder.build();
+ }
+
}
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 43db1c65d37..c24b5250a5d 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
@@ -43,8 +43,7 @@ public class DocumentDatabaseChangeValidatorTest {
"field f4 type array<s> { struct-field s1 { indexing: attribute } }");
f.assertValidation(Arrays.asList(
newRestartAction("Field 'f1' changed: add attribute aspect"),
- newRefeedAction("field-type-change",
- "Field 'f4.s1' changed: add attribute aspect"),
+ newRestartAction("Field 'f4.s1' changed: add attribute aspect"),
newRefeedAction("indexing-change",
ValidationOverrides.empty,
"Field 'f2' changed: add index aspect, indexing script: '{ input f2 | summary f2; }' -> " +
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 c224e801fa3..2d68284c9a5 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
@@ -9,7 +9,7 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
-import static com.yahoo.vespa.model.application.validation.change.ConfigChangeTestUtils.newRefeedAction;
+import static com.yahoo.vespa.model.application.validation.change.ConfigChangeTestUtils.newRestartAction;
/**
* @author geirst
@@ -47,24 +47,24 @@ public class StructFieldAttributeChangeValidatorTestCase {
}
@Test
- public void adding_attribute_aspect_to_struct_field_requires_refeed() throws Exception {
+ public void adding_attribute_aspect_to_struct_field_requires_restart() throws Exception {
validate(arrayOfStruct(oneFieldStruct(), ""),
arrayOfStruct(oneFieldStruct(), structAttribute("s1")),
- newRefeedAction("field-type-change", "Field 'f1.s1' changed: add attribute aspect"));
+ newRestartAction("Field 'f1.s1' changed: add attribute aspect"));
validate(mapOfStruct(oneFieldStruct(), ""),
mapOfStruct(oneFieldStruct(), structAttribute("key")),
- newRefeedAction("field-type-change", "Field 'f1.key' changed: add attribute aspect"));
+ newRestartAction("Field 'f1.key' changed: add attribute aspect"));
validate(mapOfStruct(oneFieldStruct(), ""),
mapOfStruct(oneFieldStruct(), structAttribute("value.s1")),
- newRefeedAction("field-type-change", "Field 'f1.value.s1' changed: add attribute aspect"));
+ newRestartAction("Field 'f1.value.s1' changed: add attribute aspect"));
validate(mapOfPrimitive(""), mapOfPrimitive(structAttribute("key")),
- newRefeedAction("field-type-change", "Field 'f1.key' changed: add attribute aspect"));
+ newRestartAction("Field 'f1.key' changed: add attribute aspect"));
validate(mapOfPrimitive(""), mapOfPrimitive(structAttribute("value")),
- newRefeedAction("field-type-change", "Field 'f1.value' changed: add attribute aspect"));
+ newRestartAction("Field 'f1.value' changed: add attribute aspect"));
}
@Test
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/TestOptions.java b/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/TestOptions.java
index 8064c093e95..8da7386e067 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/TestOptions.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/configserver/TestOptions.java
@@ -82,9 +82,6 @@ public class TestOptions implements CloudConfigOptions {
}
@Override
- public Optional<String> payloadCompressionType() { return Optional.empty(); }
-
- @Override
public Optional<String> environment() { return environment; }
@Override
@@ -97,9 +94,6 @@ public class TestOptions implements CloudConfigOptions {
public Optional<Boolean> useVespaVersionInRequest() { return useVespaVersionInRequest; }
@Override
- public Optional<Integer> numParallelTenantLoaders() { return Optional.of(4); }
-
- @Override
public Optional<String> loadBalancerAddress() { return Optional.empty(); }
@Override