summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-07-02 17:02:26 +0200
committerGitHub <noreply@github.com>2020-07-02 17:02:26 +0200
commit5ea9ab0b823b7bf634f07e89ad900cefc301d1e2 (patch)
treeef660e19573d0a55666ff8d7abfc07515dc2e1da
parent12fbf5b3265de130d3374c239a19fe1cd9425e73 (diff)
parent6c765d0f5f2266171beec0c3df620c961fd79b0d (diff)
Merge pull request #13785 from vespa-engine/toregge/require-restart-if-distance-metric-is-changed-without-hnsw-index-enabled
Require restart if distance metric is changed when hnsw index is not enabled.
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidator.java2
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/search/AttributeChangeValidatorTest.java5
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp1
3 files changed, 5 insertions, 3 deletions
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 4f3e100ce75..5d790c74f18 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
@@ -96,8 +96,8 @@ public class AttributeChangeValidator {
validateAttributeSetting(currAttr, nextAttr, Attribute::densePostingListThreshold, "dense-posting-list-threshold", result);
validateAttributeSetting(currAttr, nextAttr, Attribute::isEnabledOnlyBitVector, "rank: filter", result);
validateAttributeSetting(currAttr, nextAttr, AttributeChangeValidator::hasHnswIndex, "indexing: index", result);
+ validateAttributeSetting(currAttr, nextAttr, Attribute::distanceMetric, "distance-metric", result);
if (hasHnswIndex(currAttr) && hasHnswIndex(nextAttr)) {
- validateAttributeSetting(currAttr, nextAttr, Attribute::distanceMetric, "distance-metric", result);
validateAttributeHnswIndexSetting(currAttr, nextAttr, HnswIndexParams::maxLinksPerNode, "max-links-per-node", result);
validateAttributeHnswIndexSetting(currAttr, nextAttr, HnswIndexParams::neighborsToExploreAtInsert, "neighbors-to-explore-at-insert", result);
}
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 5da36d82a62..e00b34d4a79 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
@@ -168,11 +168,12 @@ public class AttributeChangeValidatorTest {
}
@Test
- public void changing_distance_metric_without_hnsw_index_enabled_is_ok() throws Exception {
+ public void changing_distance_metric_without_hnsw_index_enabled_requires_restart() throws Exception {
new Fixture("field f1 type tensor(x[2]) { indexing: attribute }",
"field f1 type tensor(x[2]) { indexing: attribute \n attribute { " +
"distance-metric: geodegrees \n } }").
- assertValidation();
+ assertValidation(newRestartAction("Field 'f1' changed: change property " +
+ "'distance-metric' from 'EUCLIDEAN' to 'GEODEGREES'"));
}
@Test
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp
index 986571d07e1..7f6d47f4ae2 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp
@@ -30,6 +30,7 @@ AttributesConfigScout::adjust(AttributesConfig::Attribute &attr,
attr.huge = liveAttr.huge;
// Note: Predicate attributes only handle changes for the dense-posting-list-threshold config.
attr.densepostinglistthreshold = liveAttr.densepostinglistthreshold;
+ attr.distancemetric = liveAttr.distancemetric;
attr.index = liveAttr.index;
}