diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-03-14 09:32:35 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-03-14 19:55:00 +0100 |
commit | 3c1d192192f903b0dffc81b2f3503830a705f0eb (patch) | |
tree | ba2c490cf64c36f7af94f00b72545597202b2194 /config-model | |
parent | b18fce14bf06de85aa9663ba182eb9db0f77d781 (diff) |
Revert "Revert "Balder/single searchcluster""
Diffstat (limited to 'config-model')
9 files changed, 96 insertions, 245 deletions
diff --git a/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java b/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java index 421f3d5a1d1..a7f66966538 100644 --- a/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java +++ b/config-model/src/main/java/com/yahoo/schema/derived/DerivedConfiguration.java @@ -166,7 +166,11 @@ public class DerivedConfiguration { } public void getConfig(AttributesConfig.Builder builder) { - getConfig(builder, AttributeFields.FieldSet.ALL); + if (isStreaming()) { + getConfig(builder, AttributeFields.FieldSet.FAST_ACCESS); + } else { + getConfig(builder, AttributeFields.FieldSet.ALL); + } } public void getConfig(AttributesConfig.Builder builder, AttributeFields.FieldSet fs) { diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java index 4d6f454f7e0..e2fe660cbe9 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java @@ -21,7 +21,6 @@ import com.yahoo.vespa.model.search.NodeSpec; import com.yahoo.vespa.model.search.SchemaDefinitionXMLHandler; import com.yahoo.vespa.model.search.SearchCluster; import com.yahoo.vespa.model.search.SearchNode; -import com.yahoo.vespa.model.search.StreamingSearchCluster; import com.yahoo.vespa.model.search.TransactionLogServer; import com.yahoo.vespa.model.search.Tuning; import org.w3c.dom.Element; @@ -31,7 +30,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.LinkedHashMap; -import java.util.Optional; import java.util.Objects; import java.util.TreeMap; import java.util.function.Predicate; @@ -104,12 +102,12 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> Boolean syncTransactionLog = clusterElem.childAsBoolean("engine.proton.sync-transactionlog"); var search = new ContentSearchCluster(ancestor, clusterName, - deployState.getProperties().featureFlags(), - documentDefinitions, - globallyDistributedDocuments, - getFlushOnShutdown(flushOnShutdownElem), - syncTransactionLog, - fractionOfMemoryReserved); + deployState.getProperties().featureFlags(), + documentDefinitions, + globallyDistributedDocuments, + getFlushOnShutdown(flushOnShutdownElem), + syncTransactionLog, + fractionOfMemoryReserved); ModelElement tuning = clusterElem.childByPath("engine.proton.tuning"); if (tuning != null) { @@ -117,8 +115,7 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> } search.setResourceLimits(resourceLimits); - buildAllStreamingSearchClusters(deployState, clusterElem, clusterName, search); - buildIndexedSearchCluster(deployState, clusterElem, clusterName, search); + buildSearchCluster(deployState, clusterElem, clusterName, search); return search; } @@ -130,73 +127,18 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> return clusterElem.childAsDouble("engine.proton.query-timeout"); } - private static Schema findResponsibleSchema(DeployState deployState, String docTypeName) { - var schemas = deployState.getSchemas(); - for (var candidate : schemas) { - if (candidate.getName().equals(docTypeName)) { - return candidate; - } - } - return null; - } - - private void buildAllStreamingSearchClusters(DeployState deployState, ModelElement clusterElem, String clusterName, ContentSearchCluster search) { + private void buildSearchCluster(DeployState deployState, ModelElement clusterElem, + String clusterName, ContentSearchCluster search) { ModelElement docElem = clusterElem.child("documents"); + if (docElem == null) return; - if (docElem == null) { - return; + Double visibilityDelay = clusterElem.childAsDouble("engine.proton.visibility-delay"); + if (visibilityDelay != null) { + search.setVisibilityDelay(visibilityDelay); } - for (ModelElement docType : docElem.subElements("document")) { - String docTypeName = docType.stringAttribute("type"); - String mode = docType.stringAttribute("mode"); - var schema = findResponsibleSchema(deployState, docTypeName); - if ("streaming".equals(mode) && schema != null && !schema.isDocumentsOnly()) { - buildStreamingSearchCluster(deployState, clusterElem, clusterName, search, docType); - } - } - } - - private void buildStreamingSearchCluster(DeployState deployState, ModelElement clusterElem, String clusterName, - ContentSearchCluster search, ModelElement docType) { - String docTypeName = docType.stringAttribute("type"); - StreamingSearchCluster cluster = new StreamingSearchCluster(search, - clusterName + "." + docTypeName, - 0, - docTypeName, - clusterName); - search.addSearchCluster(deployState, cluster, getQueryTimeout(clusterElem), List.of(docType)); - } - - private void buildIndexedSearchCluster(DeployState deployState, ModelElement clusterElem, - String clusterName, ContentSearchCluster search) { - List<ModelElement> indexedDefs = getIndexedSchemas(clusterElem); - if (!indexedDefs.isEmpty()) { - IndexedSearchCluster isc = new IndexedSearchCluster(search, clusterName, 0, search, deployState.featureFlags()); - - Double visibilityDelay = clusterElem.childAsDouble("engine.proton.visibility-delay"); - if (visibilityDelay != null) { - search.setVisibilityDelay(visibilityDelay); - } - - search.addSearchCluster(deployState, isc, getQueryTimeout(clusterElem), indexedDefs); - } - } - - private List<ModelElement> getIndexedSchemas(ModelElement clusterElem) { - List<ModelElement> indexedDefs = new ArrayList<>(); - ModelElement docElem = clusterElem.child("documents"); - if (docElem == null) { - return indexedDefs; - } - - for (ModelElement docType : docElem.subElements("document")) { - String mode = docType.stringAttribute("mode"); - if ("index".equals(mode)) { - indexedDefs.add(docType); - } - } - return indexedDefs; + IndexedSearchCluster isc = new IndexedSearchCluster(search, clusterName, 0, search, deployState.featureFlags()); + search.addSearchCluster(deployState, isc, getQueryTimeout(clusterElem), docElem.subElements("document")); } } @@ -247,9 +189,12 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> cluster.setQueryTimeout(queryTimeout); } cluster.deriveFromSchemas(deployState); - addCluster(cluster); + if ( ! cluster.schemas().values().stream().allMatch(schemaInfo -> schemaInfo.getIndexMode() == SchemaInfo.IndexMode.STORE_ONLY)) { + addCluster(cluster); + } } + private void addSchemas(DeployState deployState, List<ModelElement> searchDefs, SearchCluster sc) { for (ModelElement e : searchDefs) { SchemaDefinitionXMLHandler schemaDefinitionXMLHandler = new SchemaDefinitionXMLHandler(e); @@ -257,6 +202,7 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> if (schema == null) throw new IllegalArgumentException("Schema '" + schemaDefinitionXMLHandler.getName() + "' referenced in " + this + " does not exist"); + if (schema.isDocumentsOnly()) continue; sc.add(new SchemaInfo(schema, e.stringAttribute("mode"), deployState.rankProfileRegistry(), null)); } @@ -282,14 +228,9 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> * with indexing, null if it has both or none. */ public Boolean isStreaming() { - boolean hasStreaming = false; - boolean hasIndexed = false; - for (var cluster : clusters.values()) { - if (cluster.hasStreaming()) - hasStreaming = true; - else - hasIndexed = true; - } + if (indexedCluster == null) return false; + boolean hasStreaming = indexedCluster.schemas().values().stream().anyMatch(schema -> schema.getIndexMode() == SchemaInfo.IndexMode.STREAMING); + boolean hasIndexed = indexedCluster.schemas().values().stream().anyMatch(schema -> schema.getIndexMode() == SchemaInfo.IndexMode.INDEX); if (hasIndexed == hasStreaming) return null; return hasStreaming; } @@ -356,21 +297,6 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> this.redundancy = redundancy; } - private Optional<StreamingSearchCluster> findStreamingCluster(String docType) { - return getClusters().values().stream() - .filter(StreamingSearchCluster.class::isInstance) - .map(StreamingSearchCluster.class::cast) - .filter(ssc -> ssc.schemas().get(docType) != null) - .findFirst(); - } - - public List<StreamingSearchCluster> getStreamingClusters() { - return getClusters().values().stream() - .filter(StreamingSearchCluster.class::isInstance) - .map(StreamingSearchCluster.class::cast) - .toList(); - } - public List<NewDocumentType> getDocumentTypesWithStreamingCluster() { return documentTypes(this::hasIndexingModeStreaming); } public List<NewDocumentType> getDocumentTypesWithIndexedCluster() { return documentTypes(this::hasIndexingModeIndexed); } public List<NewDocumentType> getDocumentTypesWithStoreOnly() { return documentTypes(this::hasIndexingModeStoreOnly); } @@ -382,13 +308,13 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> } private boolean hasIndexingModeStreaming(NewDocumentType type) { - return findStreamingCluster(type.getFullName().getName()).isPresent(); + if (indexedCluster == null) return false; + return indexedCluster.schemas().get(type.getName()).getIndexMode() == SchemaInfo.IndexMode.STREAMING; } private boolean hasIndexingModeIndexed(NewDocumentType type) { - return !hasIndexingModeStreaming(type) - && hasIndexedCluster() - && getIndexed().hasDocumentDB(type.getFullName().getName()); + if (indexedCluster == null) return false; + return indexedCluster.schemas().get(type.getName()).getIndexMode() == SchemaInfo.IndexMode.INDEX; } private boolean hasIndexingModeStoreOnly(NewDocumentType type) { @@ -397,7 +323,7 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> @Override public void getConfig(ProtonConfig.Builder builder) { - boolean hasAnyNonIndexedCluster = false; + boolean hasAnyNonIndexedSchema = false; for (NewDocumentType type : TopologicalDocumentTypeSorter.sort(documentDefinitions.values())) { ProtonConfig.Documentdb.Builder ddbB = new ProtonConfig.Documentdb.Builder(); String docTypeName = type.getFullName().getName(); @@ -409,13 +335,13 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> ddbB.allocation.max_compact_buffers(defaultMaxCompactBuffers); if (hasIndexingModeStreaming(type)) { - hasAnyNonIndexedCluster = true; - findStreamingCluster(docTypeName).get().fillDocumentDBConfig(type.getFullName().getName(), ddbB); + hasAnyNonIndexedSchema = true; + indexedCluster.fillDocumentDBConfig(type.getFullName().getName(), ddbB); ddbB.mode(ProtonConfig.Documentdb.Mode.Enum.STREAMING); } else if (hasIndexingModeIndexed(type)) { - getIndexed().fillDocumentDBConfig(type.getFullName().getName(), ddbB); + indexedCluster.fillDocumentDBConfig(type.getFullName().getName(), ddbB); } else { - hasAnyNonIndexedCluster = true; + hasAnyNonIndexedSchema = true; ddbB.mode(ProtonConfig.Documentdb.Mode.Enum.STORE_ONLY); } if (globalDocType) { @@ -424,7 +350,7 @@ public class ContentSearchCluster extends TreeConfigProducer<AnyConfigProducer> builder.documentdb(ddbB); } - if (hasAnyNonIndexedCluster) { + if (hasAnyNonIndexedSchema) { builder.feeding.concurrency(Math.min(1.0, defaultFeedConcurrency*2)); } else { builder.feeding.concurrency(defaultFeedConcurrency); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchCluster.java index fc4b96ec384..2b37ef58f9b 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/SearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/SearchCluster.java @@ -8,11 +8,20 @@ import com.yahoo.schema.derived.SchemaInfo; import com.yahoo.vespa.config.search.AttributesConfig; import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig; import com.yahoo.search.config.IndexInfoConfig; +import com.yahoo.vespa.config.search.RankProfilesConfig; +import com.yahoo.vespa.config.search.SummaryConfig; +import com.yahoo.vespa.config.search.core.OnnxModelsConfig; import com.yahoo.vespa.config.search.core.ProtonConfig; +import com.yahoo.vespa.config.search.core.RankingConstantsConfig; +import com.yahoo.vespa.config.search.core.RankingExpressionsConfig; +import com.yahoo.vespa.config.search.summary.JuniperrcConfig; +import com.yahoo.vespa.config.search.vsm.VsmfieldsConfig; +import com.yahoo.vespa.config.search.vsm.VsmsummaryConfig; import com.yahoo.vespa.configdefinition.IlscriptsConfig; import com.yahoo.config.model.producer.AnyConfigProducer; import com.yahoo.config.model.producer.TreeConfigProducer; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.LinkedHashMap; @@ -36,6 +45,35 @@ public abstract class SearchCluster extends TreeConfigProducer<AnyConfigProducer private Double visibilityDelay = 0.0; private final Map<String, SchemaInfo> schemas = new LinkedHashMap<>(); private final Map<String, DocumentDatabase> documentDbs = new LinkedHashMap<>(); + private final List<LegacyStreamingproxy> legacyproxy = new ArrayList<>(); + + private static class LegacyStreamingproxy extends TreeConfigProducer<AnyConfigProducer> implements + AttributesConfig.Producer, + RankProfilesConfig.Producer, + RankingConstantsConfig.Producer, + RankingExpressionsConfig.Producer, + OnnxModelsConfig.Producer, + JuniperrcConfig.Producer, + SummaryConfig.Producer, + VsmsummaryConfig.Producer, + VsmfieldsConfig.Producer + { + private final DocumentDatabase db; + LegacyStreamingproxy(TreeConfigProducer<AnyConfigProducer> parent, String clusterName, DocumentDatabase db) { + super(parent, "cluster." + clusterName + "." + db.getName()); + this.db = new DocumentDatabase(this, db.getName(), db.getDerivedConfiguration()); + } + @Override public void getConfig(SummaryConfig.Builder builder) { db.getConfig(builder); } + @Override public void getConfig(AttributesConfig.Builder builder) { db.getConfig(builder); } + @Override public void getConfig(OnnxModelsConfig.Builder builder) { db.getConfig(builder); } + @Override public void getConfig(RankingConstantsConfig.Builder builder) { db.getConfig(builder); } + @Override public void getConfig(RankProfilesConfig.Builder builder) { db.getConfig(builder); } + @Override public void getConfig(RankingExpressionsConfig.Builder builder) { db.getConfig(builder); } + @Override public void getConfig(JuniperrcConfig.Builder builder) { db.getConfig(builder); } + @Override public void getConfig(VsmfieldsConfig.Builder builder) { db.getConfig(builder); } + @Override public void getConfig(VsmsummaryConfig.Builder builder) { db.getConfig(builder); } + + } public SearchCluster(TreeConfigProducer<?> parent, String clusterName, int index) { super(parent, "cluster." + clusterName); @@ -49,6 +87,9 @@ public abstract class SearchCluster extends TreeConfigProducer<AnyConfigProducer schemas.put(schema.name(), schema); } public void add(DocumentDatabase db) { + if (db.getDerivedConfiguration().isStreaming()) { + legacyproxy.add(new LegacyStreamingproxy((TreeConfigProducer<AnyConfigProducer>) getParent(), clusterName, db)); + } documentDbs.put(db.getName(), db); } diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/StreamingSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/StreamingSearchCluster.java deleted file mode 100644 index e188a086614..00000000000 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/StreamingSearchCluster.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.model.search; - -import com.yahoo.config.model.deploy.DeployState; -import com.yahoo.config.model.producer.AnyConfigProducer; -import com.yahoo.config.model.producer.TreeConfigProducer; -import com.yahoo.schema.Schema; -import com.yahoo.schema.derived.AttributeFields; -import com.yahoo.schema.derived.DerivedConfiguration; -import com.yahoo.schema.derived.SchemaInfo; -import com.yahoo.vespa.config.search.AttributesConfig; -import com.yahoo.vespa.config.search.RankProfilesConfig; -import com.yahoo.vespa.config.search.SummaryConfig; -import com.yahoo.vespa.config.search.core.OnnxModelsConfig; -import com.yahoo.vespa.config.search.core.ProtonConfig; -import com.yahoo.vespa.config.search.core.RankingConstantsConfig; -import com.yahoo.vespa.config.search.core.RankingExpressionsConfig; -import com.yahoo.vespa.config.search.summary.JuniperrcConfig; -import com.yahoo.vespa.config.search.vsm.VsmfieldsConfig; -import com.yahoo.vespa.config.search.vsm.VsmsummaryConfig; - -/** - * A search cluster of type streaming. - * - * @author baldersheim - * @author vegardh - */ -public class StreamingSearchCluster extends SearchCluster implements - AttributesConfig.Producer, - RankProfilesConfig.Producer, - RankingConstantsConfig.Producer, - RankingExpressionsConfig.Producer, - OnnxModelsConfig.Producer, - JuniperrcConfig.Producer, - SummaryConfig.Producer, - VsmsummaryConfig.Producer, - VsmfieldsConfig.Producer -{ - private final String storageRouteSpec; - private final AttributesProducer attributesConfig; - private final String docTypeName; - - public StreamingSearchCluster(TreeConfigProducer<AnyConfigProducer> parent, String clusterName, int index, - String docTypeName, String storageRouteSpec) { - super(parent, clusterName, index); - attributesConfig = new AttributesProducer(parent, docTypeName); - this.docTypeName = docTypeName; - this.storageRouteSpec = storageRouteSpec; - } - - @Override - protected IndexingMode getIndexingMode() { return IndexingMode.STREAMING; } - public final String getStorageRouteSpec() { return storageRouteSpec; } - - public String getDocTypeName() { return docTypeName; } - - public DerivedConfiguration derived() { return db().getDerivedConfiguration(); } - - @Override - public void deriveFromSchemas(DeployState deployState) { - if (schemas().isEmpty()) return; - if (schemas().size() > 1) throw new IllegalArgumentException("Only a single schema is supported, got " + schemas().size()); - - Schema schema = schemas().values().stream().findAny().get().fullSchema(); - if ( ! schema.getName().equals(docTypeName)) - throw new IllegalArgumentException("Document type name '" + docTypeName + - "' must be the same as the schema name '" + schema.getName() + "'"); - add(new DocumentDatabase(this, docTypeName, new DerivedConfiguration(deployState, schema, SchemaInfo.IndexMode.STREAMING))); - } - - protected void fillDocumentDBConfig(DocumentDatabase sdoc, ProtonConfig.Documentdb.Builder ddbB) { - super.fillDocumentDBConfig(sdoc, ddbB); - ddbB.configid(attributesConfig.getConfigId()); // Temporary until fully cleaned up - } - - private DocumentDatabase db() { return getDocumentDbs().get(0); } - - // These are temporary until backend uses correct config id. - @Override public void getConfig(SummaryConfig.Builder builder) { db().getConfig(builder); } - @Override public void getConfig(OnnxModelsConfig.Builder builder) { db().getConfig(builder); } - @Override public void getConfig(RankingConstantsConfig.Builder builder) { db().getConfig(builder); } - @Override public void getConfig(RankProfilesConfig.Builder builder) { db().getConfig(builder); } - @Override public void getConfig(RankingExpressionsConfig.Builder builder) { db().getConfig(builder); } - @Override public void getConfig(JuniperrcConfig.Builder builder) { db().getConfig(builder); } - @Override public void getConfig(VsmfieldsConfig.Builder builder) { db().getConfig(builder); } - @Override public void getConfig(VsmsummaryConfig.Builder builder) { db().getConfig(builder);} - - private class AttributesProducer extends AnyConfigProducer implements AttributesConfig.Producer { - - AttributesProducer(TreeConfigProducer<AnyConfigProducer> parent, String docType) { - super(parent, docType); - } - - @Override - public void getConfig(AttributesConfig.Builder builder) { - derived().getConfig(builder, AttributeFields.FieldSet.FAST_ACCESS); - } - } - -} diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/StreamingValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/StreamingValidatorTest.java index d3e62dae947..2879baf7b88 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/StreamingValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/StreamingValidatorTest.java @@ -29,7 +29,7 @@ public class StreamingValidatorTest { new VespaModelCreatorWithFilePkg("src/test/cfg/application/validation/document_references_validation/") .create(); }); - assertTrue(exception.getMessage().contains("For search cluster 'content.ad', streaming schema 'ad': Attribute 'campaign_ref' has type 'Reference<campaign>'. " + + assertTrue(exception.getMessage().contains("For search cluster 'content', streaming schema 'ad': Attribute 'campaign_ref' has type 'Reference<campaign>'. " + "Document references and imported fields are not allowed in streaming search.")); } @@ -52,7 +52,7 @@ public class StreamingValidatorTest { "attribute { distance-metric: euclidean } }"); var warnings = filter(logger.warnings); assertEquals(1, warnings.size()); - assertEquals("For search cluster 'content.test', streaming schema 'test', SD field 'nn': hnsw index is not relevant and not supported, ignoring setting", + assertEquals("For search cluster 'content', streaming schema 'test', SD field 'nn': hnsw index is not relevant and not supported, ignoring setting", warnings.get(0)); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSchemaClusterChangeValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSchemaClusterChangeValidatorTest.java index ee64ceb6969..28eabd18539 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSchemaClusterChangeValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/StreamingSchemaClusterChangeValidatorTest.java @@ -92,9 +92,9 @@ public class StreamingSchemaClusterChangeValidatorTest { private static final String ATTRIBUTE_INT_FIELD = "field f1 type int { indexing: attribute | summary }"; private static final String ATTRIBUTE_FAST_ACCESS_INT_FIELD = "field f1 type int { indexing: attribute | summary \n attribute: fast-access }"; private static final List<ServiceInfo> FOO_SERVICE = - List.of(new ServiceInfo("searchnode", "null", null, null, "foo/search/0", "null")); + List.of(new ServiceInfo("searchnode", "null", null, null, "foo/search/cluster.foo/0", "null")); private static final List<ServiceInfo> BAR_SERVICE = - List.of(new ServiceInfo("searchnode2", "null", null, null, "bar/search/0", "null")); + List.of(new ServiceInfo("searchnode2", "null", null, null, "bar/search/cluster.bar/0", "null")); @Test void changing_field_type_requires_refeed() { diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java index d3e69e64fe6..327b169a629 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java @@ -196,11 +196,10 @@ public class ContentBuilderTest extends DomBuilderTest { ContentSearchCluster s; s = cluster.getSearch(); - assertFalse(s.hasIndexedCluster()); + assertTrue(s.hasIndexedCluster()); assertEquals(1, s.getClusters().size()); - assertNull(s.getIndexed()); - SearchCluster sc = s.getClusters().get(musicClusterId + ".music"); - assertEquals(musicClusterId + ".music", sc.getClusterName()); + SearchCluster sc = s.getClusters().get(musicClusterId); + assertEquals(musicClusterId, sc.getClusterName()); assertEquals(musicClusterId, sc.getStorageRouteSpec()); assertTrue(cluster.getPersistence() instanceof ProtonEngine.Factory); @@ -236,24 +235,11 @@ public class ContentBuilderTest extends DomBuilderTest { " <node hostalias=\"mockhost\" distribution-key=\"0\"/>" + " </group>" + "</content>"); - ContentSearchCluster s; - - s = cluster.getSearch(); - assertFalse(s.hasIndexedCluster()); - assertEquals(2, s.getClusters().size()); - assertNull(s.getIndexed()); - { - String id = musicClusterId + ".book"; - SearchCluster sc = s.getClusters().get(id); - assertEquals(id, sc.getClusterName()); - assertEquals(musicClusterId, sc.getStorageRouteSpec()); - } - { - String id = musicClusterId + ".music"; - SearchCluster sc = s.getClusters().get(id); - assertEquals(id, sc.getClusterName()); - assertEquals(musicClusterId, sc.getStorageRouteSpec()); - } + ContentSearchCluster s = cluster.getSearch(); + assertTrue(s.hasIndexedCluster()); + assertEquals(2, s.getIndexed().getDocumentDbs().size()); + assertTrue(s.getIndexed().hasDocumentDB("book")); + assertTrue(s.getIndexed().hasDocumentDB("music")); assertTrue(cluster.getPersistence() instanceof ProtonEngine.Factory); assertEquals(1, cluster.getStorageCluster().getChildren().size()); @@ -362,9 +348,7 @@ public class ContentBuilderTest extends DomBuilderTest { " <node hostalias=\"mockhost\" distribution-key=\"0\" />" + " </group>" + "</content>", new TestProperties().setEnvironmentVariables(List.of("MY_1_ENV=xyz abc", "MY_2_ENV=2"))); - ContentSearchCluster s; - - s = b.getSearch(); + ContentSearchCluster s = b.getSearch(); assertTrue(s.hasIndexedCluster()); assertNotNull(s.getIndexed()); assertEquals(1, b.getStorageCluster().getChildren().size()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java index 6f9127779db..ae08f78c404 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/content/IndexedTest.java @@ -163,7 +163,6 @@ public class IndexedTest extends ContentBaseTest { // "transactionlogserver"}; // DomContentBuilderTest.assertServices(h, expectedServices); ContentCluster s = model.getContentClusters().get("test"); - assertFalse(s.getSearch().hasIndexedCluster()); StorServerConfig.Builder builder = new StorServerConfig.Builder(); s.getStorageCluster().getConfig(builder); @@ -175,7 +174,6 @@ public class IndexedTest extends ContentBaseTest { VespaModel model = getStreamingVespaModel(); ContentCluster s = model.getContentClusters().get("test"); assertNotNull(s); - assertFalse(s.getSearch().hasIndexedCluster()); ClusterListConfig config = model.getConfig(ClusterListConfig.class, VespaModel.ROOT_CONFIGID); assertEquals(1, config.storage().size()); assertEquals("test", config.storage(0).name()); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java index d3741405c15..fc7a10b6368 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/DocumentDatabaseTestCase.java @@ -309,7 +309,7 @@ public class DocumentDatabaseTestCase { var tester = new SchemaTester(); var model = tester.createModelWithMode(mode, sds); - DocumentdbInfoConfig dcfg = model.getConfig(DocumentdbInfoConfig.class, "test/search/cluster.test.type"); + DocumentdbInfoConfig dcfg = model.getConfig(DocumentdbInfoConfig.class, "test/search/cluster.test"); assertEquals(1, dcfg.documentdb().size()); DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(0); assertEquals("type", db.name()); @@ -328,13 +328,11 @@ public class DocumentDatabaseTestCase { var tester = new SchemaTester(); var model = tester.createModel(sds, ""); DocumentdbInfoConfig indexed_cfg = model.getConfig(DocumentdbInfoConfig.class, "test/search/cluster.test"); - assertEquals(1, indexed_cfg.documentdb().size()); + assertEquals(2, indexed_cfg.documentdb().size()); var db = indexed_cfg.documentdb(0); assertEquals("a", db.name()); assertEquals(DocumentdbInfoConfig.Documentdb.Mode.INDEX, db.mode()); - DocumentdbInfoConfig streaming_cfg = model.getConfig(DocumentdbInfoConfig.class, "test/search/cluster.test.b"); - assertEquals(1, streaming_cfg.documentdb().size()); - db = streaming_cfg.documentdb(0); + db = indexed_cfg.documentdb(1); assertEquals("b", db.name()); assertEquals(DocumentdbInfoConfig.Documentdb.Mode.STREAMING, db.mode()); } @@ -390,7 +388,7 @@ public class DocumentDatabaseTestCase { @Test void testThatAttributesConfigIsProducedForStreamingForFastAccessFields() { assertAttributesConfigIndependentOfMode("streaming", List.of("type1"), - List.of("test/search/type1"), + List.of("test/search/cluster.test/type1"), Map.of("type1", List.of("f2"))); } |