diff options
35 files changed, 287 insertions, 267 deletions
diff --git a/client/go/cmd/test.go b/client/go/cmd/test.go index 7c49703595e..4f01de823ea 100644 --- a/client/go/cmd/test.go +++ b/client/go/cmd/test.go @@ -25,6 +25,7 @@ import ( func init() { rootCmd.AddCommand(testCmd) + testCmd.PersistentFlags().StringVarP(&zoneArg, zoneFlag, "z", "dev.aws-us-east-1c", "The zone to use for deployment") } var testCmd = &cobra.Command{ diff --git a/client/go/cmd/vespa/main.go b/client/go/cmd/vespa/main.go index 5fdf64f5ab4..32828b15aa4 100644 --- a/client/go/cmd/vespa/main.go +++ b/client/go/cmd/vespa/main.go @@ -6,8 +6,11 @@ package main import ( "github.com/vespa-engine/vespa/client/go/cmd" + "os" ) func main() { - cmd.Execute() + if err := cmd.Execute(); err != nil { + os.Exit(1) + } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java index cc08e84ef9d..0a51ce3dda5 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/Attribute.java @@ -332,6 +332,7 @@ public final class Attribute implements Cloneable, Serializable { } } + @SuppressWarnings("deprecation") private DataType createReferenceDataType() { if (!referenceDocumentType.isPresent()) { throw new IllegalStateException("Referenced document type is not set!"); diff --git a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java index 59387c28287..fdbb1d8c8e0 100644 --- a/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java +++ b/config-model/src/main/java/com/yahoo/vespa/configmodel/producers/DocumentManager.java @@ -44,6 +44,7 @@ public class DocumentManager { return documentConfigBuilder; } + @SuppressWarnings("deprecation") private void buildConfig(DataTypeCollection type, DocumentmanagerConfig.Builder documentConfigBuilder, Set<DataType> built) { for (DataType dataType : type.getTypes()) { if (built.contains(dataType)) continue; diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.java index f57c63b440f..30cda8b5f42 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentGraphValidatorTest.java @@ -152,6 +152,7 @@ public class DocumentGraphValidatorTest { return campaignSchema; } + @SuppressWarnings("deprecation") private static void createDocumentReference(Schema from, Schema to, String refFieldName) { SDField refField = new TemporarySDField(refFieldName, ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create(to.getName()))); SDDocumentType fromDocument = from.getDocument(); 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 260b7a98fe7..19964700dd0 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/DocumentReferenceResolverTest.java @@ -56,6 +56,7 @@ public class DocumentReferenceResolverTest { assertSame(fooRefToBarField, fooReferenceMap.get("bar_ref").referenceField()); } + @SuppressWarnings("deprecation") @Test public void throws_user_friendly_exception_if_referenced_document_does_not_exist() { // Create foo document with document reference to non-existing document bar diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java index c6f254df798..b3f2fb62ac2 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SchemaOrdererTestCase.java @@ -88,6 +88,7 @@ public class SchemaOrdererTestCase extends AbstractSchemaTestCase { assertEquals(expectedSearchOrder, actualSearchOrder); } + @SuppressWarnings("deprecation") private static void createDocumentReference(Schema from, Schema to, String refFieldName) { SDField refField = new TemporarySDField(refFieldName, ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create(to.getName()))); SDDocumentType fromDocument = from.getDocument(); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java index 55702c9e1a7..138992477c0 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/VsmFieldsTestCase.java @@ -21,6 +21,7 @@ import static org.junit.Assert.assertEquals; */ public class VsmFieldsTestCase { + @SuppressWarnings("deprecation") @Test public void reference_type_field_is_unsearchable() { Schema schema = new Schema("test", new Application(MockApplicationPackage.createEmpty()), new MockFileRegistry(), new TestableDeployLogger(), new TestProperties()); diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java index a01fdd8725d..74fa7c72554 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/ParentChildSearchModel.java @@ -44,6 +44,7 @@ public class ParentChildSearchModel { return result; } + @SuppressWarnings("deprecation") protected static SDField createRefField(String parentType, String fieldName) { return new TemporarySDField(fieldName, ReferenceDataType.createWithInferredId(TemporaryStructuredDataType.create(parentType))); } diff --git a/config/src/vespa/config/common/configvalue.cpp b/config/src/vespa/config/common/configvalue.cpp index d770c126d38..da1cbfc792c 100644 --- a/config/src/vespa/config/common/configvalue.cpp +++ b/config/src/vespa/config/common/configvalue.cpp @@ -55,7 +55,7 @@ ConfigValue::getLegacyFormat() const return lines; } -const vespalib::string +vespalib::string ConfigValue::asJson() const { if (_payload) { const vespalib::slime::Inspector & payload(_payload->getSlimePayload()); diff --git a/config/src/vespa/config/common/configvalue.h b/config/src/vespa/config/common/configvalue.h index 553a609b9db..bf4c320c061 100644 --- a/config/src/vespa/config/common/configvalue.h +++ b/config/src/vespa/config/common/configvalue.h @@ -35,8 +35,8 @@ public: const vespalib::string & getLine(int i) const { return _lines.at(i); } const std::vector<vespalib::string> & getLines() const { return _lines; } std::vector<vespalib::string> getLegacyFormat() const; - const vespalib::string asJson() const; - const vespalib::string getXxhash64() const { return _xxhash64; } + vespalib::string asJson() const; + const vespalib::string& getXxhash64() const { return _xxhash64; } void serializeV1(::vespalib::slime::Cursor & cursor) const; void serializeV2(::vespalib::slime::Cursor & cursor) const; diff --git a/config/src/vespa/config/frt/frtconfigagent.cpp b/config/src/vespa/config/frt/frtconfigagent.cpp index 2b66e806270..827ef75251b 100644 --- a/config/src/vespa/config/frt/frtconfigagent.cpp +++ b/config/src/vespa/config/frt/frtconfigagent.cpp @@ -71,7 +71,7 @@ FRTConfigAgent::handleUpdatedGeneration(const ConfigKey & key, const ConfigState if (LOG_WOULD_LOG(spam)) { LOG(spam, "updating holder for key %s,", key.toString().c_str()); } - _holder->handle(ConfigUpdate::UP(new ConfigUpdate(_latest, changed, newState.generation))); + _holder->handle(std::make_unique<ConfigUpdate>(_latest, changed, newState.generation)); _numConfigured++; } diff --git a/config/src/vespa/config/subscription/configsubscription.cpp b/config/src/vespa/config/subscription/configsubscription.cpp index 4aaa30323c7..9790541906b 100644 --- a/config/src/vespa/config/subscription/configsubscription.cpp +++ b/config/src/vespa/config/subscription/configsubscription.cpp @@ -31,7 +31,11 @@ ConfigSubscription::nextUpdate(int64_t generation, std::chrono::milliseconds tim if (_closed || !_holder->poll()) { return false; } + auto old = std::move(_next); _next = _holder->provide(); + if (old) { + _next->merge(*old); + } if (isGenerationNewer(_next->getGeneration(), generation)) { return true; } @@ -98,7 +102,7 @@ ConfigSubscription::flip() _current = std::move(_next); _lastGenerationChanged = _current->getGeneration(); } else { - _current.reset(new ConfigUpdate(_current->getValue(), false, _next->getGeneration())); + _current = std::make_unique<ConfigUpdate>(_current->getValue(), false, _next->getGeneration()); } _isChanged = change; } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java index d8295373207..c82f8093f63 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/maintenance/ApplicationPackageMaintainer.java @@ -7,6 +7,7 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.subscription.ConfigSourceSet; import com.yahoo.jrt.Supervisor; import com.yahoo.jrt.Transport; +import com.yahoo.vespa.config.ConnectionPool; import com.yahoo.vespa.config.JRTConnectionPool; import com.yahoo.vespa.config.server.ApplicationRepository; import com.yahoo.vespa.config.server.session.Session; @@ -22,6 +23,7 @@ import com.yahoo.vespa.flags.Flags; import java.io.File; import java.time.Duration; +import java.util.List; import java.util.logging.Logger; import static com.yahoo.vespa.config.server.filedistribution.FileDistributionUtil.fileReferenceExistsOnDisk; @@ -41,9 +43,8 @@ public class ApplicationPackageMaintainer extends ConfigServerMaintainer { private final ApplicationRepository applicationRepository; private final File downloadDirectory; private final ConfigserverConfig configserverConfig; - private final Supervisor supervisor; - private final boolean useFileDistributionConnectionPool; - + private final Supervisor supervisor = new Supervisor(new Transport("filedistribution-pool")).setDropEmptyBuffers(true); + private final FileDownloader fileDownloader; ApplicationPackageMaintainer(ApplicationRepository applicationRepository, Curator curator, @@ -52,9 +53,12 @@ public class ApplicationPackageMaintainer extends ConfigServerMaintainer { super(applicationRepository, curator, flagSource, applicationRepository.clock().instant(), interval, false); this.applicationRepository = applicationRepository; this.configserverConfig = applicationRepository.configserverConfig(); - this.supervisor = new Supervisor(new Transport("filedistribution-pool")).setDropEmptyBuffers(true); this.downloadDirectory = new File(Defaults.getDefaults().underVespaHome(configserverConfig.fileReferencesDir())); - this.useFileDistributionConnectionPool = Flags.USE_FILE_DISTRIBUTION_CONNECTION_POOL.bindTo(flagSource).value(); + boolean useFileDistributionConnectionPool = Flags.USE_FILE_DISTRIBUTION_CONNECTION_POOL.bindTo(flagSource).value(); + this.fileDownloader = createFileDownloader(configserverConfig, + useFileDistributionConnectionPool, + downloadDirectory, + supervisor); } @Override @@ -64,49 +68,56 @@ public class ApplicationPackageMaintainer extends ConfigServerMaintainer { int attempts = 0; int failures = 0; - try (var fileDownloader = createFileDownloader()) { - for (var applicationId : applicationRepository.listApplications()) { - log.finest(() -> "Verifying application package for " + applicationId); - Session session = applicationRepository.getActiveSession(applicationId); - if (session == null) continue; // App might be deleted after call to listApplications() or not activated yet (bootstrap phase) - - FileReference appFileReference = session.getApplicationPackageReference(); - if (appFileReference != null) { - long sessionId = session.getSessionId(); - attempts++; - if (! fileReferenceExistsOnDisk(downloadDirectory, appFileReference)) { - log.fine(() -> "Downloading application package for " + applicationId + " (session " + sessionId + ")"); - - FileReferenceDownload download = new FileReferenceDownload(appFileReference, - false, - this.getClass().getSimpleName()); - if (fileDownloader.getFile(download).isEmpty()) { - failures++; - log.info("Failed downloading application package (" + appFileReference + ")" + - " for " + applicationId + " (session " + sessionId + ")"); - continue; - } + for (var applicationId : applicationRepository.listApplications()) { + log.finest(() -> "Verifying application package for " + applicationId); + Session session = applicationRepository.getActiveSession(applicationId); + if (session == null) + continue; // App might be deleted after call to listApplications() or not activated yet (bootstrap phase) + + FileReference appFileReference = session.getApplicationPackageReference(); + if (appFileReference != null) { + long sessionId = session.getSessionId(); + attempts++; + if (!fileReferenceExistsOnDisk(downloadDirectory, appFileReference)) { + log.fine(() -> "Downloading application package for " + applicationId + " (session " + sessionId + ")"); + + FileReferenceDownload download = new FileReferenceDownload(appFileReference, + false, + this.getClass().getSimpleName()); + if (fileDownloader.getFile(download).isEmpty()) { + failures++; + log.info("Failed downloading application package (" + appFileReference + ")" + + " for " + applicationId + " (session " + sessionId + ")"); + continue; } - createLocalSessionIfMissing(applicationId, sessionId); } + createLocalSessionIfMissing(applicationId, sessionId); } } return asSuccessFactor(attempts, failures); } - private FileDownloader createFileDownloader() { - ConfigSourceSet configSourceSet = new ConfigSourceSet(getOtherConfigServersInCluster(configserverConfig)); - return new FileDownloader(useFileDistributionConnectionPool - ? new FileDistributionConnectionPool(configSourceSet, supervisor) - : new JRTConnectionPool(configSourceSet, supervisor), - supervisor, - downloadDirectory, - Duration.ofSeconds(30)); + private static FileDownloader createFileDownloader(ConfigserverConfig configserverConfig, + boolean useFileDistributionConnectionPool, + File downloadDirectory, + Supervisor supervisor) { + List<String> otherConfigServersInCluster = getOtherConfigServersInCluster(configserverConfig); + ConfigSourceSet configSourceSet = new ConfigSourceSet(otherConfigServersInCluster); + + ConnectionPool connectionPool; + if (otherConfigServersInCluster.isEmpty()) + connectionPool = FileDownloader.emptyConnectionPool(); + else + connectionPool = useFileDistributionConnectionPool + ? new FileDistributionConnectionPool(configSourceSet, supervisor) + : new JRTConnectionPool(configSourceSet, supervisor); + return new FileDownloader(connectionPool, supervisor, downloadDirectory, Duration.ofSeconds(30)); } @Override public void awaitShutdown() { supervisor.transport().shutdown().join(); + fileDownloader.close(); super.awaitShutdown(); } diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java index a6f2923d68f..80ceac457b9 100644 --- a/document/src/main/java/com/yahoo/document/DocumentTypeManager.java +++ b/document/src/main/java/com/yahoo/document/DocumentTypeManager.java @@ -165,6 +165,7 @@ public class DocumentTypeManager { } } + @SuppressWarnings("deprecation") DataType getDataTypeAndReturnTemporary(int code, String detailedType) { if (hasDataType(code)) { return getDataType(code, detailedType); @@ -186,8 +187,15 @@ public class DocumentTypeManager { * * @param type The datatype to register */ + @SuppressWarnings("deprecation") void registerSingleType(DataType type) { if (type instanceof TensorDataType) return; // built-in dynamic: Created on the fly + if (type instanceof TemporaryDataType) { + throw new IllegalArgumentException("TemporaryDataType no longer supported: " + type); + } + if (type instanceof TemporaryStructuredDataType) { + throw new IllegalArgumentException("TemporaryStructuredDataType no longer supported: " + type); + } if (dataTypes.containsKey(type.getId())) { DataType existingType = dataTypes.get(type.getId()); if (((type instanceof TemporaryDataType) || (type instanceof TemporaryStructuredDataType)) @@ -308,91 +316,6 @@ public class DocumentTypeManager { return annotationTypeRegistry; } - void replaceTemporaryTypes() { - for (DataType type : dataTypes.values()) { - List<DataType> seenStructs = new LinkedList<>(); - replaceTemporaryTypes(type, seenStructs); - } - } - - private void replaceTemporaryTypes(DataType type, List<DataType> seenStructs) { - if (type instanceof WeightedSetDataType) { - replaceTemporaryTypesInWeightedSet((WeightedSetDataType) type, seenStructs); - } else if (type instanceof MapDataType) { - replaceTemporaryTypesInMap((MapDataType) type, seenStructs); - } else if (type instanceof CollectionDataType) { - replaceTemporaryTypesInCollection((CollectionDataType) type, seenStructs); - } else if (type instanceof StructDataType) { - replaceTemporaryTypesInStruct((StructDataType) type, seenStructs); - } else if (type instanceof PrimitiveDataType) { - //OK because these types are always present - } else if (type instanceof AnnotationReferenceDataType) { - //OK because this type is always present - } else if (type instanceof DocumentType) { - //OK because this type is always present - } else if (type instanceof TensorDataType) { - //OK because this type is always present - } else if (type instanceof ReferenceDataType) { - replaceTemporaryTypeInReference((ReferenceDataType) type); - } else if (type instanceof TemporaryDataType) { - throw new IllegalStateException("TemporaryDataType registered in DocumentTypeManager, BUG!!"); - } else { - log.warning("Don't know how to replace temporary data types in " + type); - } - } - - @SuppressWarnings("deprecation") - private void replaceTemporaryTypesInStruct(StructDataType structDataType, List<DataType> seenStructs) { - seenStructs.add(structDataType); - for (Field field : structDataType.getFieldsThisTypeOnly()) { - DataType fieldType = field.getDataType(); - if (fieldType instanceof TemporaryDataType) { - field.setDataType(getDataType(fieldType.getCode(), ((TemporaryDataType)fieldType).getDetailedType())); - } else { - if (!seenStructs.contains(fieldType)) { - replaceTemporaryTypes(fieldType, seenStructs); - } - } - } - } - - private void replaceTemporaryTypeInReference(ReferenceDataType referenceDataType) { - if (referenceDataType.getTargetType() instanceof TemporaryStructuredDataType) { - referenceDataType.setTargetType((DocumentType) getDataType(referenceDataType.getTargetType().getId())); - } - // TODO should we recursively invoke replaceTemporaryTypes for the target type? It should only ever be a doc type - } - - private void replaceTemporaryTypesInCollection(CollectionDataType collectionDataType, List<DataType> seenStructs) { - if (collectionDataType.getNestedType() instanceof TemporaryDataType) { - collectionDataType.setNestedType(getDataType(collectionDataType.getNestedType().getCode(), "")); - } else { - replaceTemporaryTypes(collectionDataType.getNestedType(), seenStructs); - } - } - - private void replaceTemporaryTypesInMap(MapDataType mapDataType, List<DataType> seenStructs) { - if (mapDataType.getValueType() instanceof TemporaryDataType) { - mapDataType.setValueType(getDataType(mapDataType.getValueType().getCode(), "")); - } else { - replaceTemporaryTypes(mapDataType.getValueType(), seenStructs); - } - - if (mapDataType.getKeyType() instanceof TemporaryDataType) { - mapDataType.setKeyType(getDataType(mapDataType.getKeyType().getCode(), "")); - } else { - replaceTemporaryTypes(mapDataType.getKeyType(), seenStructs); - } - } - - private void replaceTemporaryTypesInWeightedSet(WeightedSetDataType weightedSetDataType, List<DataType> seenStructs) { - if (weightedSetDataType.getNestedType() instanceof TemporaryDataType) { - weightedSetDataType.setNestedType(getDataType(weightedSetDataType.getNestedType().getCode(), "")); - } else { - replaceTemporaryTypes(weightedSetDataType.getNestedType(), seenStructs); - } - } - public void shutdown() { if (subscriber!=null) subscriber.close(); } diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java index 5ba3f4d6a6a..1f9e494aa29 100644 --- a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java +++ b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java @@ -76,140 +76,199 @@ public class DocumentTypeManagerConfigurer implements ConfigSubscriber.SingleSub } } - private void apply(DocumentmanagerConfig config) { - setupAnnotationTypesWithoutPayloads(config); - setupAnnotationRefTypes(config); - setupDatatypesWithRetry(config); - addStructInheritance(config); - addAnnotationTypePayloads(config); - addAnnotationTypeInheritance(config); - manager.replaceTemporaryTypes(); - } + private Map<Integer, DataType> typesById = new HashMap<>(); + private Map<String, DataType> typesByName = new HashMap<>(); + private Map<Integer, DocumentmanagerConfig.Datatype> configMap = new HashMap<>(); - private void setupDatatypesWithRetry(DocumentmanagerConfig config) { - var tmp = new ArrayList<DocumentmanagerConfig.Datatype>(config.datatype()); - log.log(Level.FINE, "Configuring document manager with " + tmp.size() + " data types."); - while (! tmp.isEmpty()) { - int oldSz = tmp.size(); - var failed = new ArrayList<DocumentmanagerConfig.Datatype>(); - for (DocumentmanagerConfig.Datatype thisDataType : tmp) { - int id = thisDataType.id(); - try { - registerTypeIdMapping(thisDataType, id); - } catch (IllegalArgumentException e) { - failed.add(thisDataType); - } - } - tmp = failed; - if (tmp.size() == oldSz) { - throw new IllegalArgumentException("No progress registering datatypes"); - } + private void inProgress(DataType type) { + var old = typesById.put(type.getId(), type); + if (old != null) { + throw new IllegalArgumentException("Multiple types with same id: "+old+" -> "+type); + } + old = typesByName.put(type.getName(), type); + if (old != null) { + log.warning("Multiple types with same name: "+old+" -> "+type); } } - private void registerTypeIdMapping(DocumentmanagerConfig.Datatype thisDataType, int id) { - for (var o : thisDataType.arraytype()) { - registerArrayType(id, o); - } - for (var o : thisDataType.maptype()) { - registerMapType(id, o); - } - for (var o : thisDataType.weightedsettype()) { - registerWeightedSetType(id, o); - } - for (var o : thisDataType.structtype()) { - registerStructType(id, o); - } - for (var o : thisDataType.documenttype()) { - registerDocumentType(o); + private void startStructsAndDocs(DocumentmanagerConfig config) { + for (var thisDataType : config.datatype()) { + for (var o : thisDataType.structtype()) { + int id = thisDataType.id(); + StructDataType type = new StructDataType(id, o.name()); + inProgress(type); + configMap.remove(id); + } } - for (var o : thisDataType.referencetype()) { - registerReferenceType(id, o); + for (var thisDataType : config.datatype()) { + for (var doc : thisDataType.documenttype()) { + int id = thisDataType.id(); + StructDataType header = (StructDataType) typesById.get(doc.headerstruct()); + var importedFields = doc.importedfield().stream() + .map(f -> f.name()) + .collect(Collectors.toUnmodifiableSet()); + DocumentType type = new DocumentType(doc.name(), header, importedFields); + if (id != type.getId()) { + // really old stuff, should rewrite tests using this: + int alt = (doc.name()+"."+doc.version()).hashCode(); + if (id == alt) { + typesById.put(id, type); + } else { + throw new IllegalArgumentException("Document type "+doc.name()+ + " wanted id "+id+" but got "+ + type.getId()+", alternative id was: "+alt); + } + } + inProgress(type); + configMap.remove(id); + } } } - private void registerArrayType(int id, DocumentmanagerConfig.Datatype.Arraytype array) { - DataType nestedType = manager.getDataType(array.datatype(), ""); + private DataType createArrayType(int id, DocumentmanagerConfig.Datatype.Arraytype array) { + DataType nestedType = getOrCreateType(array.datatype()); ArrayDataType type = new ArrayDataType(nestedType, id); - manager.register(type); + inProgress(type); + return type; } - private void registerMapType(int id, DocumentmanagerConfig.Datatype.Maptype map) { - DataType keyType = manager.getDataType(map.keytype(), ""); - DataType valType = manager.getDataType(map.valtype(), ""); + private DataType createMapType(int id, DocumentmanagerConfig.Datatype.Maptype map) { + DataType keyType = getOrCreateType(map.keytype()); + DataType valType = getOrCreateType(map.valtype()); MapDataType type = new MapDataType(keyType, valType, id); - manager.register(type); + inProgress(type); + return type; } - private void registerWeightedSetType(int id, DocumentmanagerConfig.Datatype.Weightedsettype wset) { - DataType nestedType = manager.getDataType(wset.datatype(), ""); - WeightedSetDataType type = new WeightedSetDataType( - nestedType, wset.createifnonexistant(), wset.removeifzero(), id); - manager.register(type); + private DataType createWeightedSetType(int id, DocumentmanagerConfig.Datatype.Weightedsettype wset) { + DataType nestedType = getOrCreateType(wset.datatype()); + WeightedSetDataType type = + new WeightedSetDataType(nestedType, wset.createifnonexistant(), wset.removeifzero(), id); + inProgress(type); + return type; } - private void registerDocumentType(DocumentmanagerConfig.Datatype.Documenttype doc) { - StructDataType header = (StructDataType) manager.getDataType(doc.headerstruct(), ""); - var importedFields = doc.importedfield().stream() - .map(f -> f.name()) - .collect(Collectors.toUnmodifiableSet()); - DocumentType type = new DocumentType(doc.name(), header, importedFields); - for (var parent : doc.inherits()) { - DataTypeName name = new DataTypeName(parent.name()); - DocumentType parentType = manager.getDocumentType(name); - if (parentType == null) { - throw new IllegalArgumentException("Could not find document type '" + name + "'."); - } - type.inherit(parentType); + private DataType createReferenceType(int id, DocumentmanagerConfig.Datatype.Referencetype refType) { + int targetId = refType.target_type_id(); + DocumentType targetDocType = (DocumentType) typesById.get(targetId); + var type = new ReferenceDataType(targetDocType, id); + inProgress(type); + return type; + } + + + private DataType getOrCreateType(int id) { + if (typesById.containsKey(id)) { + return typesById.get(id); + } + var config = configMap.remove(id); + if (config == null) { + return manager.getDataType(id); + } + assert(id == config.id()); + for (var o : config.arraytype()) { + return createArrayType(id, o); } - Map<String, Collection<String>> fieldSets = new HashMap<>(doc.fieldsets().size()); - for (Map.Entry<String, DocumentmanagerConfig.Datatype.Documenttype.Fieldsets> entry: doc.fieldsets().entrySet()) { - fieldSets.put(entry.getKey(), entry.getValue().fields()); + for (var o : config.maptype()) { + return createMapType(id, o); } - type.addFieldSets(fieldSets); - manager.register(type); + for (var o : config.weightedsettype()) { + return createWeightedSetType(id, o); + } + for (var o : config.referencetype()) { + return createReferenceType(id, o); + } + throw new IllegalArgumentException("Could not create type from config: "+config); } - private void registerStructType(int id, DocumentmanagerConfig.Datatype.Structtype struct) { - StructDataType type = new StructDataType(id, struct.name()); + private void createRemainingTypes(DocumentmanagerConfig config) { + for (var thisDataType : config.datatype()) { + int id = thisDataType.id(); + var type = getOrCreateType(id); + assert(type != null); + } + } - for (var field : struct.field()) { - DataType fieldType = (field.datatype() == id) - ? manager.getDataTypeAndReturnTemporary(field.datatype(), field.detailedtype()) - : manager.getDataType(field.datatype(), field.detailedtype()); + private void fillStructs(DocumentmanagerConfig config) { + for (var thisDataType : config.datatype()) { + for (var struct : thisDataType.structtype()) { + int id = thisDataType.id(); + StructDataType type = (StructDataType) typesById.get(id); + for (var parent : struct.inherits()) { + var parentStruct = (StructDataType) typesByName.get(parent.name()); + type.inherit(parentStruct); + } + for (var field : struct.field()) { + if (field.datatype() == id) { + log.fine("Self-referencing struct "+struct.name()+" field: "+field); + } + DataType fieldType = typesById.get(field.datatype()); + if (fieldType == null) { + fieldType = manager.getDataType(field.datatype(), field.detailedtype()); + } + if (field.id().size() == 1) { + type.addField(new Field(field.name(), field.id().get(0).id(), fieldType)); + } else { + type.addField(new Field(field.name(), fieldType)); + } + } + } + } + } - if (field.id().size() == 1) { - type.addField(new Field(field.name(), field.id().get(0).id(), fieldType)); - } else { - type.addField(new Field(field.name(), fieldType)); + private void fillDocuments(DocumentmanagerConfig config) { + for (var thisDataType : config.datatype()) { + for (var doc : thisDataType.documenttype()) { + int id = thisDataType.id(); + DocumentType type = (DocumentType) typesById.get(id); + for (var parent : doc.inherits()) { + DocumentType parentType = (DocumentType) typesByName.get(parent.name()); + if (parentType == null) { + DataTypeName name = new DataTypeName(parent.name()); + parentType = manager.getDocumentType(name); + } + if (parentType == null) { + throw new IllegalArgumentException("Could not find parent document type '" + parent.name() + "'."); + } + type.inherit(parentType); + } + Map<String, Collection<String>> fieldSets = new HashMap<>(doc.fieldsets().size()); + for (Map.Entry<String, DocumentmanagerConfig.Datatype.Documenttype.Fieldsets> entry: doc.fieldsets().entrySet()) { + fieldSets.put(entry.getKey(), entry.getValue().fields()); + } + type.addFieldSets(fieldSets); } } - /* - if (type.equals(PositionDataType.INSTANCE)) { - if (this.usev8geopositions) { - // do something special here + } + + private void splitConfig(DocumentmanagerConfig config) { + for (var dataTypeConfig : config.datatype()) { + int id = dataTypeConfig.id(); + var old = configMap.put(id, dataTypeConfig); + if (old != null) { + throw new IllegalArgumentException + ("Multiple configs for id "+id+" first: "+old+" second: "+dataTypeConfig); } } - */ - manager.register(type); } - private void registerReferenceType(int id, DocumentmanagerConfig.Datatype.Referencetype refType) { - ReferenceDataType referenceType; - if (manager.hasDataType(refType.target_type_id())) { - DocumentType targetDocType = (DocumentType)manager.getDataType(refType.target_type_id()); - referenceType = new ReferenceDataType(targetDocType, id); - } else { - TemporaryStructuredDataType temporaryTargetType = TemporaryStructuredDataType.createById(refType.target_type_id()); - referenceType = new ReferenceDataType(temporaryTargetType, id); + private void apply(DocumentmanagerConfig config) { + splitConfig(config); + setupAnnotationTypesWithoutPayloads(config); + setupAnnotationRefTypes(config); + startStructsAndDocs(config); + createRemainingTypes(config); + fillStructs(config); + fillDocuments(config); + for (DataType type : typesById.values()) { + manager.register(type); } - // Note: can't combine the above new-statements, as they call different constructors. - manager.register(referenceType); + addAnnotationTypePayloads(config); + addAnnotationTypeInheritance(config); } private void setupAnnotationRefTypes(DocumentmanagerConfig config) { - for (int i = 0; i < config.datatype().size(); i++) { - DocumentmanagerConfig.Datatype thisDataType = config.datatype(i); + for (var thisDataType : config.datatype()) { int id = thisDataType.id(); for (var annRefType : thisDataType.annotationreftype()) { AnnotationType annotationType = manager.getAnnotationTypeRegistry().getType(annRefType.annotation()); @@ -217,7 +276,8 @@ public class DocumentTypeManagerConfigurer implements ConfigSubscriber.SingleSub throw new IllegalArgumentException("Found reference to " + annRefType.annotation() + ", which does not exist!"); } AnnotationReferenceDataType type = new AnnotationReferenceDataType(annotationType, id); - manager.register(type); + inProgress(type); + configMap.remove(id); } } } @@ -233,7 +293,7 @@ public class DocumentTypeManagerConfigurer implements ConfigSubscriber.SingleSub for (DocumentmanagerConfig.Annotationtype annType : config.annotationtype()) { AnnotationType annotationType = manager.getAnnotationTypeRegistry().getType(annType.id()); DataType payload = manager.getDataType(annType.datatype(), ""); - if (!payload.equals(DataType.NONE)) { + if (! payload.equals(DataType.NONE)) { annotationType.setDataType(payload); } } @@ -250,21 +310,6 @@ public class DocumentTypeManagerConfigurer implements ConfigSubscriber.SingleSub } } - private void addStructInheritance(DocumentmanagerConfig config) { - for (int i = 0; i < config.datatype().size(); i++) { - DocumentmanagerConfig.Datatype thisDataType = config.datatype(i); - int id = thisDataType.id(); - for (var struct : thisDataType.structtype()) { - StructDataType thisStruct = (StructDataType) manager.getDataType(id, ""); - - for (var parent : struct.inherits()) { - StructDataType parentStruct = (StructDataType) manager.getDataType(parent.name()); - thisStruct.inherit(parentStruct); - } - } - } - } - private final boolean usev8geopositions; private final DocumentTypeManager manager; } diff --git a/document/src/main/java/com/yahoo/document/ReferenceDataType.java b/document/src/main/java/com/yahoo/document/ReferenceDataType.java index 78a30c0fcf2..c3b5f6590b6 100644 --- a/document/src/main/java/com/yahoo/document/ReferenceDataType.java +++ b/document/src/main/java/com/yahoo/document/ReferenceDataType.java @@ -27,6 +27,7 @@ public class ReferenceDataType extends DataType { * of the target document type might not yet be known. The temporary data type should be * replaced later using setTargetType(). */ + @SuppressWarnings("deprecation") public ReferenceDataType(TemporaryStructuredDataType temporaryTargetType, int id) { this((StructuredDataType) temporaryTargetType, id); } @@ -54,6 +55,7 @@ public class ReferenceDataType extends DataType { /** * Creates a new type where the numeric ID is based on the hash of targetType */ + @SuppressWarnings("deprecation") public static ReferenceDataType createWithInferredId(TemporaryStructuredDataType targetType) { return new ReferenceDataType(targetType); } @@ -67,6 +69,7 @@ public class ReferenceDataType extends DataType { * @throws IllegalStateException if the previously stored target type is already a concrete * instance (not TemporaryStructuredDataType). */ + @SuppressWarnings("deprecation") public void setTargetType(StructuredDataType targetType) { if (! (this.targetType instanceof TemporaryStructuredDataType)) { throw new IllegalStateException(String.format( diff --git a/document/src/main/java/com/yahoo/document/TemporaryDataType.java b/document/src/main/java/com/yahoo/document/TemporaryDataType.java index c32e271737c..71f36ecde90 100644 --- a/document/src/main/java/com/yahoo/document/TemporaryDataType.java +++ b/document/src/main/java/com/yahoo/document/TemporaryDataType.java @@ -5,7 +5,9 @@ import com.yahoo.document.datatypes.FieldValue; /** * @author Einar M R Rosenvinge + * @deprecated will be removed soon */ +@Deprecated class TemporaryDataType extends DataType { private final String detailedType; diff --git a/document/src/main/java/com/yahoo/document/TemporaryStructuredDataType.java b/document/src/main/java/com/yahoo/document/TemporaryStructuredDataType.java index 9d648367c4e..865310e7009 100644 --- a/document/src/main/java/com/yahoo/document/TemporaryStructuredDataType.java +++ b/document/src/main/java/com/yahoo/document/TemporaryStructuredDataType.java @@ -5,8 +5,10 @@ package com.yahoo.document; * Internal class, DO NOT USE!! * Only public because it must be used from com.yahoo.searchdefinition.parser. * + * @deprecated will be removed soon * @author Einar M R Rosenvinge */ +@Deprecated // TODO: Remove on Vespa 8 public class TemporaryStructuredDataType extends StructDataType { TemporaryStructuredDataType(String name) { diff --git a/document/src/test/java/com/yahoo/document/DocInDocTestCase.java b/document/src/test/java/com/yahoo/document/DocInDocTestCase.java index f5b6b4ea9bf..57972d20509 100644 --- a/document/src/test/java/com/yahoo/document/DocInDocTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocInDocTestCase.java @@ -21,8 +21,8 @@ public class DocInDocTestCase { @Test public void testDocInDoc() { DocumentTypeManager manager = new DocumentTypeManager(); - DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/documentmanager.docindoc.cfg"); - + var sub = DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/documentmanager.docindoc.cfg"); + sub.close(); Document inner1 = new Document(manager.getDocumentType("docindoc"), "id:inner:docindoc::one"); inner1.setFieldValue("name", new StringFieldValue("Donald Duck")); inner1.setFieldValue("content", new StringFieldValue("Lives in Duckburg")); diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTestCase.java index 144c7d62894..3d7eb49f1f9 100644 --- a/document/src/test/java/com/yahoo/document/DocumentTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentTestCase.java @@ -95,7 +95,8 @@ public class DocumentTestCase extends DocumentTestCaseBase { static DocumentTypeManager setUpDocType(String filename) { DocumentTypeManager dcMan = new DocumentTypeManager(); - DocumentTypeManagerConfigurer.configure(dcMan, filename); + var sub = DocumentTypeManagerConfigurer.configure(dcMan, filename); + sub.close(); return dcMan; } diff --git a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java index 1a0e2ad1e2b..4040f3455da 100644 --- a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java @@ -217,8 +217,8 @@ public class DocumentTypeManagerTestCase { assertNull(banana.getField("newfield")); assertEquals(new Field("arrayfloat", 9489, new ArrayDataType(DataType.FLOAT, 99)), customtypes.getField("arrayfloat")); - DocumentTypeManagerConfigurer.configure(manager, "file:src/test/document/documentmanager.updated.cfg"); - + var sub = DocumentTypeManagerConfigurer.configure(manager, "file:src/test/document/documentmanager.updated.cfg"); + sub.close(); banana = manager.getDocumentType(new DataTypeName("banana")); customtypes = manager.getDocumentType(new DataTypeName("customtypes")); @@ -513,7 +513,8 @@ search annotationsimplicitstruct { private static DocumentTypeManager createConfiguredManager(String configFilePath) { DocumentTypeManager manager = new DocumentTypeManager(); - DocumentTypeManagerConfigurer.configure(manager, configFilePath); + var sub = DocumentTypeManagerConfigurer.configure(manager, configFilePath); + sub.close(); return manager; } @@ -525,6 +526,7 @@ search annotationsimplicitstruct { assertReferenceTypePresentInManager(manager, 87654321, "referenced_type2"); } + @SuppressWarnings("deprecation") @Test public void no_temporary_targets_in_references_or_names() { DocumentTypeManager manager = createConfiguredManager("file:src/test/document/documentmanager.replaced_temporary.cfg"); diff --git a/document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java b/document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java index d44f0880395..53c8a0ecc94 100644 --- a/document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java +++ b/document/src/test/java/com/yahoo/document/ReferenceDataTypeTestCase.java @@ -72,6 +72,7 @@ public class ReferenceDataTypeTestCase { assertTrue(fixture.refType.isValueCompatible(fixture.refTypeClone.createFieldValue())); } + @SuppressWarnings("deprecation") @Test public void reference_type_can_be_constructed_with_temporary_structured_data_type() { TemporaryStructuredDataType tempType = new TemporaryStructuredDataType("cooldoc"); @@ -81,6 +82,7 @@ public class ReferenceDataTypeTestCase { assertEquals(tempType, refType.getTargetType()); } + @SuppressWarnings("deprecation") @Test public void can_replace_temporary_target_data_type() { TemporaryStructuredDataType tempType = new TemporaryStructuredDataType("cooldoc"); diff --git a/document/src/test/java/com/yahoo/document/TemporaryDataTypeTestCase.java b/document/src/test/java/com/yahoo/document/TemporaryDataTypeTestCase.java index 0e85e085316..80154891d83 100644 --- a/document/src/test/java/com/yahoo/document/TemporaryDataTypeTestCase.java +++ b/document/src/test/java/com/yahoo/document/TemporaryDataTypeTestCase.java @@ -10,6 +10,7 @@ import static org.junit.Assert.assertNull; /** * @author Einar M R Rosenvinge */ +@SuppressWarnings("deprecation") public class TemporaryDataTypeTestCase { @Test diff --git a/document/src/test/java/com/yahoo/document/TemporaryStructuredDataTypeTestCase.java b/document/src/test/java/com/yahoo/document/TemporaryStructuredDataTypeTestCase.java index 5e4530d0886..3b5cd29b90d 100644 --- a/document/src/test/java/com/yahoo/document/TemporaryStructuredDataTypeTestCase.java +++ b/document/src/test/java/com/yahoo/document/TemporaryStructuredDataTypeTestCase.java @@ -10,6 +10,7 @@ import static org.junit.Assert.assertNotEquals; * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a> * @since 5.1.10 */ +@SuppressWarnings("deprecation") public class TemporaryStructuredDataTypeTestCase { @Test public void basic() { diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java index 77f0e1a9c20..fcaf96a788f 100644 --- a/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java +++ b/document/src/test/java/com/yahoo/document/annotation/Bug4259784TestCase.java @@ -23,7 +23,9 @@ public class Bug4259784TestCase { @Test public void testSerialize() { DocumentTypeManager manager = new DocumentTypeManager(); - DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4259784.cfg"); + var sub = DocumentTypeManagerConfigurer.configure + (manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4259784.cfg"); + sub.close(); DocumentType type = manager.getDocumentType("blog"); Document doc = new Document(type, "id:this:blog::is:a:test"); diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java index 7692d2643df..ae730ed8cb3 100644 --- a/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java +++ b/document/src/test/java/com/yahoo/document/annotation/Bug4261985TestCase.java @@ -23,7 +23,9 @@ public class Bug4261985TestCase { @Test public void testAnnotate() { DocumentTypeManager manager = new DocumentTypeManager(); - DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4261985.cfg"); + var sub = DocumentTypeManagerConfigurer.configure + (manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4261985.cfg"); + sub.close(); DocumentType type = manager.getDocumentType("blog"); Document doc = new Document(type, "id:this:blog::is:a:test"); diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java index dbbe0cdfedf..69003ebd036 100755 --- a/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java +++ b/document/src/test/java/com/yahoo/document/annotation/Bug4475379TestCase.java @@ -23,7 +23,9 @@ public class Bug4475379TestCase { @Test public void testClone() { DocumentTypeManager manager = new DocumentTypeManager(); - DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4475379.cfg"); + var sub = DocumentTypeManagerConfigurer.configure + (manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.bug4475379.cfg"); + sub.close(); DocumentType type = manager.getDocumentType("blog"); Document doc = new Document(type, "id:this:blog::is:a:test"); diff --git a/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java b/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java index 654965d1ee7..3ec858062be 100644 --- a/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java +++ b/document/src/test/java/com/yahoo/document/annotation/Bug6394548TestCase.java @@ -19,7 +19,9 @@ public class Bug6394548TestCase { @Test public void testSerializeAndDeserializeMultipleAdjacentStructAnnotations() { DocumentTypeManager manager = new DocumentTypeManager(); - DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.6394548.cfg"); + var sub = DocumentTypeManagerConfigurer.configure + (manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.6394548.cfg"); + sub.close(); AnnotationTypeRegistry registry = manager.getAnnotationTypeRegistry(); AnnotationType featureSetType = registry.getType("morty.RICK_FEATURESET"); diff --git a/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java b/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java index 9978fd1b014..678639c89d9 100755 --- a/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java +++ b/document/src/test/java/com/yahoo/document/annotation/SystemTestCase.java @@ -114,7 +114,9 @@ public class SystemTestCase { @Before public void setUp() { manager = new DocumentTypeManager(); - DocumentTypeManagerConfigurer.configure(manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.systemtest.cfg"); + var sub = DocumentTypeManagerConfigurer.configure + (manager, "file:src/test/java/com/yahoo/document/annotation/documentmanager.systemtest.cfg"); + sub.close(); } @Test diff --git a/document/src/test/java/com/yahoo/document/serialization/SerializeAnnotationsTestCase.java b/document/src/test/java/com/yahoo/document/serialization/SerializeAnnotationsTestCase.java index d27a4ed6326..9e58e2540a0 100644 --- a/document/src/test/java/com/yahoo/document/serialization/SerializeAnnotationsTestCase.java +++ b/document/src/test/java/com/yahoo/document/serialization/SerializeAnnotationsTestCase.java @@ -44,9 +44,9 @@ public class SerializeAnnotationsTestCase { @Before public void setUp() { - DocumentTypeManagerConfigurer.configure(docMan, - "file:src/tests/serialization/" + - "annotation.serialize.test.cfg"); + var sub = DocumentTypeManagerConfigurer.configure + (docMan, "file:src/tests/serialization/annotation.serialize.test.cfg"); + sub.close(); } @Test diff --git a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java index 769a73d536d..b2fa7014480 100644 --- a/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java +++ b/document/src/test/java/com/yahoo/vespaxmlparser/VespaXMLReaderTestCase.java @@ -36,7 +36,8 @@ public class VespaXMLReaderTestCase { @Before public void setUp() { - DocumentTypeManagerConfigurer.configure(manager, "file:src/test/vespaxmlparser/documentmanager2.cfg"); + var sub = DocumentTypeManagerConfigurer.configure(manager, "file:src/test/vespaxmlparser/documentmanager2.cfg"); + sub.close(); } @Test diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index a6f1ab292fc..09645880884 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -195,13 +195,13 @@ public class Flags { public static final UnboundListFlag<String> ALLOWED_ATHENZ_PROXY_IDENTITIES = defineListFlag( "allowed-athenz-proxy-identities", List.of(), String.class, - List.of("bjorncs", "tokle"), "2021-02-10", "2021-12-01", + List.of("bjorncs", "tokle"), "2021-02-10", "2022-02-01", "Allowed Athenz proxy identities", "takes effect at redeployment"); public static final UnboundBooleanFlag GENERATE_NON_MTLS_ENDPOINT = defineFeatureFlag( "generate-non-mtls-endpoint", true, - List.of("tokle"), "2021-02-18", "2021-12-01", + List.of("tokle"), "2021-02-18", "2022-02-01", "Whether to generate the non-mtls endpoint", "Takes effect on next internal redeployment", APPLICATION_ID); @@ -230,7 +230,7 @@ public class Flags { public static final UnboundBooleanFlag IGNORE_MERGE_QUEUE_LIMIT = defineFeatureFlag( "ignore-merge-queue-limit", false, - List.of("vekterli", "geirst"), "2021-10-06", "2021-12-01", + List.of("vekterli", "geirst"), "2021-10-06", "2022-03-01", "Specifies if merges that are forwarded (chained) from another content node are always " + "allowed to be enqueued even if the queue is otherwise full.", "Takes effect at redeploy", @@ -245,7 +245,7 @@ public class Flags { public static final UnboundDoubleFlag MIN_NODE_RATIO_PER_GROUP = defineDoubleFlag( "min-node-ratio-per-group", 0.0, - List.of("geirst", "vekterli"), "2021-07-16", "2021-12-01", + List.of("geirst", "vekterli"), "2021-07-16", "2022-03-01", "Minimum ratio of nodes that have to be available (i.e. not Down) in any hierarchic content cluster group for the group to be Up", "Takes effect at redeployment", ZONE_ID, APPLICATION_ID); @@ -313,7 +313,7 @@ public class Flags { public static final UnboundIntFlag DISTRIBUTOR_MERGE_BUSY_WAIT = defineIntFlag( "distributor-merge-busy-wait", 10, - List.of("geirst", "vekterli"), "2021-10-04", "2021-12-31", + List.of("geirst", "vekterli"), "2021-10-04", "2022-03-01", "Number of seconds that scheduling of new merge operations in the distributor should be inhibited " + "towards a content node that has indicated merge busy", "Takes effect at redeploy", diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp index 847ed330fe8..2889dc425db 100644 --- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp +++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp @@ -191,6 +191,7 @@ HnswIndex::remove_link_to(uint32_t remove_from, uint32_t remove_id, uint32_t lev { LinkArray new_links; auto old_links = _graph.get_link_array(remove_from, level); + new_links.reserve(old_links.size()); for (uint32_t id : old_links) { if (id != remove_id) new_links.push_back(id); } diff --git a/vespa_feed_perf/src/test/resources/documentmanager.cfg b/vespa_feed_perf/src/test/resources/documentmanager.cfg index ebb6e767bef..e224aeea1aa 100644 --- a/vespa_feed_perf/src/test/resources/documentmanager.cfg +++ b/vespa_feed_perf/src/test/resources/documentmanager.cfg @@ -34,7 +34,7 @@ datatype[1].structtype[0].field[0].name "my_str" datatype[1].structtype[0].field[0].id[0] datatype[1].structtype[0].inherits[0] datatype[1].weightedsettype[0] -datatype[2].id -1668955062 +datatype[2].id 485659380 datatype[2].annotationreftype[0] datatype[2].arraytype[0] datatype[2].documenttype[1] |