aboutsummaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/cluster/ContentCluster.java6
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java43
2 files changed, 46 insertions, 3 deletions
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 c5899655599..0119bced095 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
@@ -597,6 +597,12 @@ public class ContentCluster extends AbstractConfigProducer implements
builder.min_storage_up_ratio(0);
}
builder.enable_multiple_bucket_spaces(enableMultipleBucketSpaces);
+ // Telling the controller whether we actually _have_ global document types lets
+ // it selectively enable or disable constraints that aren't needed when these
+ // are not are present, even if full protocol and backend support is enabled
+ // for multiple bucket spaces. Basically, if you don't use it, you don't
+ // pay for it.
+ builder.cluster_has_global_document_types(enableMultipleBucketSpaces && !globallyDistributedDocuments.isEmpty());
}
@Override
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java
index 89492572873..98177b4ada0 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/content/ContentSearchClusterTest.java
@@ -44,15 +44,29 @@ public class ContentSearchClusterTest {
createSearchDefinitions("global", "regular"));
}
- private static ContentCluster createClusterWithMultipleBucketSpacesEnabled() throws Exception {
- ContentClusterBuilder builder = createClusterBuilderWithGlobalType();
+ private static ContentCluster createClusterFromBuilderAndDocTypes(ContentClusterBuilder builder, String... docTypes) throws Exception {
builder.groupXml(joinLines("<group>",
"<node distribution-key='0' hostalias='mockhost'/>",
"<node distribution-key='1' hostalias='mockhost'/>",
"</group>"));
builder.enableMultipleBucketSpaces(true);
String clusterXml = builder.getXml();
- return createCluster(clusterXml, createSearchDefinitions("global", "regular"));
+ return createCluster(clusterXml, createSearchDefinitions(docTypes));
+ }
+
+ private static ContentCluster createClusterWithMultipleBucketSpacesEnabled() throws Exception {
+ return createClusterFromBuilderAndDocTypes(createClusterBuilderWithGlobalType(), "global", "regular");
+ }
+
+ private static ContentCluster createClusterWithMultipleBucketSpacesEnabledButNoGlobalDocs() throws Exception {
+ return createClusterFromBuilderAndDocTypes(createClusterBuilderWithOnlyDefaultTypes(), "marve", "fleksnes");
+ }
+
+ private static ContentCluster createClusterWithGlobalDocsButNotMultipleSpacesEnabled() throws Exception {
+ return createCluster(createClusterBuilderWithGlobalType()
+ .enableMultipleBucketSpaces(false)
+ .getXml(),
+ createSearchDefinitions("global", "regular"));
}
private static ContentClusterBuilder createClusterBuilderWithGlobalType() {
@@ -60,6 +74,11 @@ public class ContentSearchClusterTest {
.docTypes(Arrays.asList(DocType.indexGlobal("global"), DocType.index("regular")));
}
+ private static ContentClusterBuilder createClusterBuilderWithOnlyDefaultTypes() {
+ return new ContentClusterBuilder()
+ .docTypes(Arrays.asList(DocType.index("marve"), DocType.index("fleksnes")));
+ }
+
private static ProtonConfig getProtonConfig(ContentCluster cluster) {
ProtonConfig.Builder protonCfgBuilder = new ProtonConfig.Builder();
cluster.getSearch().getConfig(protonCfgBuilder);
@@ -178,4 +197,22 @@ public class ContentSearchClusterTest {
}
}
+ @Test
+ public void cluster_with_global_document_types_sets_cluster_controller_global_docs_config_option() throws Exception {
+ ContentCluster cluster = createClusterWithMultipleBucketSpacesEnabled();
+ assertTrue(getFleetcontrollerConfig(cluster).cluster_has_global_document_types());
+ }
+
+ @Test
+ public void cluster_without_global_document_types_unsets_cluster_controller_global_docs_config_option() throws Exception {
+ ContentCluster cluster = createClusterWithMultipleBucketSpacesEnabledButNoGlobalDocs();
+ assertFalse(getFleetcontrollerConfig(cluster).cluster_has_global_document_types());
+ }
+
+ @Test
+ public void controller_global_documents_config_forced_to_false_if_multiple_spaces_not_enabled() throws Exception {
+ ContentCluster cluster = createClusterWithGlobalDocsButNotMultipleSpacesEnabled();
+ assertFalse(getFleetcontrollerConfig(cluster).cluster_has_global_document_types());
+ }
+
}