diff options
67 files changed, 257 insertions, 218 deletions
diff --git a/application/src/main/java/com/yahoo/application/Application.java b/application/src/main/java/com/yahoo/application/Application.java index d4b1735e4c1..a2c6e84ecb7 100644 --- a/application/src/main/java/com/yahoo/application/Application.java +++ b/application/src/main/java/com/yahoo/application/Application.java @@ -124,6 +124,7 @@ public final class Application implements AutoCloseable { .applicationPackage(FilesApplicationPackage.fromFile(path.toFile(), true)) .modelImporters(modelImporters) .deployLogger((level, s) -> { }) + .accessLoggingEnabledByDefault(false) .build(); return new VespaModel(new NullConfigModelRegistry(), deployState); } catch (IOException | SAXException e) { diff --git a/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/ca/restapi/ContainerTester.java b/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/ca/restapi/ContainerTester.java index 0eda6bd946b..6783763b210 100644 --- a/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/ca/restapi/ContainerTester.java +++ b/athenz-identity-provider-service/src/test/java/com/yahoo/vespa/hosted/ca/restapi/ContainerTester.java @@ -54,6 +54,7 @@ public class ContainerTester { private static String servicesXml() { return "<container version='1.0'>\n" + + " <accesslog type=\"disabled\"/>\n" + " <config name=\"container.handler.threadpool\">\n" + " <maxthreads>10</maxthreads>\n" + " </config>\n" + diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java index 7c9e930bb4f..a9b4e06ae1b 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java @@ -67,6 +67,7 @@ public class DeployState implements ConfigDefinitionStore { private final Optional<ConfigDefinitionRepo> configDefinitionRepo; private final Optional<ApplicationPackage> permanentApplicationPackage; private final Optional<Model> previousModel; + private final boolean accessLoggingEnabledByDefault; private final ModelContext.Properties properties; private final Version vespaVersion; private final Set<ContainerEndpoint> endpoints; @@ -101,14 +102,15 @@ public class DeployState implements ConfigDefinitionStore { Version vespaVersion, Optional<ApplicationPackage> permanentApplicationPackage, Optional<ConfigDefinitionRepo> configDefinitionRepo, - java.util.Optional<Model> previousModel, + Optional<Model> previousModel, Set<ContainerEndpoint> endpoints, Collection<MlModelImporter> modelImporters, Zone zone, QueryProfiles queryProfiles, SemanticRules semanticRules, Instant now, - Version wantedNodeVespaVersion) { + Version wantedNodeVespaVersion, + boolean accessLoggingEnabledByDefault) { this.logger = deployLogger; this.fileRegistry = fileRegistry; this.rankProfileRegistry = rankProfileRegistry; @@ -116,6 +118,7 @@ public class DeployState implements ConfigDefinitionStore { this.properties = properties; this.vespaVersion = vespaVersion; this.previousModel = previousModel; + this.accessLoggingEnabledByDefault = accessLoggingEnabledByDefault; this.provisioner = hostProvisioner.orElse(getDefaultModelHostProvisioner(applicationPackage)); this.searchDefinitions = searchDocumentModel.getSearchDefinitions(); this.documentModel = searchDocumentModel.getDocumentModel(); @@ -217,6 +220,10 @@ public class DeployState implements ConfigDefinitionStore { return logger; } + public boolean getAccessLoggingEnabledByDefault() { + return accessLoggingEnabledByDefault; + } + public FileRegistry getFileRegistry() { return fileRegistry; } @@ -289,6 +296,7 @@ public class DeployState implements ConfigDefinitionStore { private Zone zone = Zone.defaultZone(); private Instant now = Instant.now(); private Version wantedNodeVespaVersion = Vtag.currentVersion; + private boolean accessLoggingEnabledByDefault = true; public Builder applicationPackage(ApplicationPackage applicationPackage) { this.applicationPackage = applicationPackage; @@ -360,6 +368,15 @@ public class DeployState implements ConfigDefinitionStore { return this; } + /** + * Whether access logging is enabled for an application without an accesslog element in services.xml. + * True by default. + */ + public Builder accessLoggingEnabledByDefault(boolean accessLoggingEnabledByDefault) { + this.accessLoggingEnabledByDefault = accessLoggingEnabledByDefault; + return this; + } + public DeployState build() { return build(new ValidationParameters()); } @@ -386,7 +403,8 @@ public class DeployState implements ConfigDefinitionStore { queryProfiles, semanticRules, now, - wantedNodeVespaVersion); + wantedNodeVespaVersion, + accessLoggingEnabledByDefault); } private SearchDocumentModel createSearchDocumentModel(RankProfileRegistry rankProfileRegistry, diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java b/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java index 9ff749a994c..ade8ae21870 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/FieldOperationApplierForStructs.java @@ -41,7 +41,7 @@ public class FieldOperationApplierForStructs extends FieldOperationApplier { } if (structUsedByField.getName().equals(structType.getName())) { //this field is using this type!! - field.populateWithStructFields(sdoc, field.getName(), field.getDataType(), field.isHeader(), 0); + field.populateWithStructFields(sdoc, field.getName(), field.getDataType(), 0); field.populateWithStructMatching(sdoc, field.getName(), field.getDataType(), field.getMatching()); } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java index 60b8ee78c7b..d8773063053 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/IndexSchema.java @@ -138,11 +138,10 @@ public class IndexSchema extends Derived implements IndexschemaConfig.Producer { return Collections.singletonList(field); } if (fieldType instanceof ArrayDataType) { - boolean header = field.isHeader(); List<Field> ret = new LinkedList<>(); - Field innerField = new Field(field.getName(), ((ArrayDataType)fieldType).getNestedType(), header); + Field innerField = new Field(field.getName(), ((ArrayDataType)fieldType).getNestedType()); for (Field flatField : flattenField(innerField)) { - ret.add(new Field(flatField.getName(), DataType.getArray(flatField.getDataType()), header)); + ret.add(new Field(flatField.getName(), DataType.getArray(flatField.getDataType()))); } return ret; } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java index c657d29033a..4fe6c3a96f2 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/SDField.java @@ -38,9 +38,8 @@ import java.util.TreeMap; /** * The field class represents a document field. It is used in - * the Document class to get and set fields. Each SDField has - * a name, a numeric ID, a data type, and a boolean that says whether it's - * a header field. The numeric ID is used when the fields are stored + * the Document class to get and set fields. Each SDField has a name, a numeric ID, + * a data type. The numeric ID is used when the fields are stored * in serialized form. * * @author bratseth @@ -120,15 +119,14 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer, * Creates a new field. This method is only used to create reserved fields * @param name The name of the field * @param dataType The datatype of the field - * @param isHeader Whether this is a "header" field or a "content" field (true = "header"). */ - protected SDField(SDDocumentType repo, String name, int id, DataType dataType, boolean isHeader, boolean populate) { - super(name, id, dataType, isHeader); - populate(populate, repo, name, dataType, isHeader); + protected SDField(SDDocumentType repo, String name, int id, DataType dataType, boolean populate) { + super(name, id, dataType); + populate(populate, repo, name, dataType); } - public SDField(SDDocumentType repo, String name, int id, DataType dataType, boolean isHeader) { - this(repo, name, id, dataType, isHeader, true); + public SDField(SDDocumentType repo, String name, int id, DataType dataType) { + this(repo, name, id, dataType, true); } /** @@ -136,41 +134,35 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer, @param name The name of the field @param dataType The datatype of the field - @param isHeader Whether this is a "header" field or a "content" field - (true = "header"). */ - public SDField(SDDocumentType repo, String name, DataType dataType, boolean isHeader, boolean populate) { - super(name,dataType,isHeader); - populate(populate, repo, name, dataType, isHeader); + public SDField(SDDocumentType repo, String name, DataType dataType, boolean populate) { + super(name,dataType); + populate(populate, repo, name, dataType); } - private void populate(boolean populate, SDDocumentType repo, String name, DataType dataType, boolean isHeader) { - populate(populate,repo, name, dataType, isHeader, null, 0); + private void populate(boolean populate, SDDocumentType repo, String name, DataType dataType) { + populate(populate,repo, name, dataType, null, 0); } - private void populate(boolean populate, SDDocumentType repo, String name, DataType dataType, boolean isHeader, Matching fieldMatching, int recursion) { + private void populate(boolean populate, SDDocumentType repo, String name, DataType dataType, Matching fieldMatching, int recursion) { if (populate || (dataType instanceof MapDataType)) { - populateWithStructFields(repo, name, dataType, isHeader, recursion); + populateWithStructFields(repo, name, dataType, recursion); populateWithStructMatching(repo, name, dataType, fieldMatching); } } - public SDField(String name, DataType dataType, boolean isHeader) { - this(null, name, dataType, isHeader, true); - } /** * Creates a new field. * * @param name The name of the field * @param dataType The datatype of the field - * @param isHeader Whether this is a "header" field or a "content" field (true = "header"). * @param owner the owning document (used to check for id collisions) */ - protected SDField(SDDocumentType repo, String name, DataType dataType, boolean isHeader, SDDocumentType owner, boolean populate) { - super(name, dataType, isHeader, owner == null ? null : owner.getDocumentType()); + protected SDField(SDDocumentType repo, String name, DataType dataType, SDDocumentType owner, boolean populate) { + super(name, dataType, owner == null ? null : owner.getDocumentType()); this.ownerDocType=owner; - populate(populate, repo, name, dataType, isHeader); + populate(populate, repo, name, dataType); } /** @@ -178,27 +170,25 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer, * * @param name The name of the field * @param dataType The datatype of the field - * @param isHeader Whether this is a "header" field or a "content" field (true = "header"). * @param owner The owning document (used to check for id collisions) * @param fieldMatching The matching object to set for the field */ - protected SDField(SDDocumentType repo, String name, DataType dataType, boolean isHeader, SDDocumentType owner, + protected SDField(SDDocumentType repo, String name, DataType dataType, SDDocumentType owner, Matching fieldMatching, boolean populate, int recursion) { - super(name, dataType, isHeader, owner == null ? null : owner.getDocumentType()); + super(name, dataType, owner == null ? null : owner.getDocumentType()); this.ownerDocType=owner; if (fieldMatching != null) this.setMatching(fieldMatching); - populate(populate, repo, name, dataType, isHeader, fieldMatching, recursion); + populate(populate, repo, name, dataType, fieldMatching, recursion); } /** - * Constructor for <b>header</b> fields * * @param name The name of the field * @param dataType The datatype of the field */ public SDField(SDDocumentType repo, String name, DataType dataType) { - this(repo, name,dataType,true, true); + this(repo, name,dataType, true); } public SDField(String name, DataType dataType) { this(null, name,dataType); @@ -277,7 +267,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer, } } - public void populateWithStructFields(SDDocumentType sdoc, String name, DataType dataType, boolean isHeader, int recursion) { + public void populateWithStructFields(SDDocumentType sdoc, String name, DataType dataType, int recursion) { DataType dt = getFirstStructOrMapRecursive(); if (dt == null) { return; @@ -286,11 +276,11 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer, MapDataType mdt = (MapDataType) dataType; SDField keyField = new SDField(sdoc, name.concat(".key"), mdt.getKeyType(), - isHeader, getOwnerDocType(), new Matching(), true, recursion + 1); + getOwnerDocType(), new Matching(), true, recursion + 1); structFields.put("key", keyField); SDField valueField = new SDField(sdoc, name.concat(".value"), mdt.getValueType(), - isHeader, getOwnerDocType(), new Matching(), true, recursion + 1); + getOwnerDocType(), new Matching(), true, recursion + 1); structFields.put("value", valueField); } else { if (recursion >= 10) { @@ -306,7 +296,7 @@ public class SDField extends Field implements TypedKey, FieldOperationContainer, } for (Field field : subType.fieldSet()) { SDField subField = new SDField(sdoc, name.concat(".").concat(field.getName()), field.getDataType(), - isHeader, subType, new Matching(), true, recursion + 1); + subType, new Matching(), true, recursion + 1); structFields.put(field.getName(), subField); } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java b/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java index 886bf777d3a..04d11792379 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/document/TemporarySDField.java @@ -8,12 +8,12 @@ import com.yahoo.document.DataType; */ public class TemporarySDField extends SDField { - public TemporarySDField(String name, DataType dataType, boolean isHeader, SDDocumentType owner) { - super(owner, name, dataType, isHeader, owner, false); + public TemporarySDField(String name, DataType dataType, SDDocumentType owner) { + super(owner, name, dataType, owner, false); } public TemporarySDField(String name, DataType dataType) { - super(null, name, dataType, true, false); + super(null, name, dataType, false); } } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java index d1eb18c4916..0ffd13927b4 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/AddExtraFieldsToDocument.java @@ -71,7 +71,7 @@ public class AddExtraFieldsToDocument extends Processor { if (docField == null) { ImmutableSDField existingField = search.getField(field.getName()); if (existingField == null) { - SDField newField = new SDField(document, field.getName(), field.getDataType(), field.isHeader(), true); + SDField newField = new SDField(document, field.getName(), field.getDataType(), true); newField.setIsExtraField(true); document.addField(newField); } else if (!existingField.isImportedField()) { diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java index d0a0bbfb748..d6398bc348c 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/UriHack.java @@ -61,7 +61,7 @@ public class UriHack extends Processor { String partName = uriName + "." + suffix; // I wonder if this is explicit in qrs or implicit in backend? // search.addFieldSetItem(uriName, partName); - SDField partField = new SDField(partName, generatedType, true); + SDField partField = new SDField(partName, generatedType); partField.setIndexStructureField(uriField.doesIndexing()); partField.setRankType(uriField.getRankType()); partField.setStemming(Stemming.NONE); diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java index d09f23da64e..9d7274f1bbf 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/xml/ContainerModelBuilder.java @@ -302,7 +302,7 @@ public class ContainerModelBuilder extends ConfigModelBuilder<ContainerModel> { AccessLogBuilder.buildIfNotDisabled(deployState, cluster, accessLog).ifPresent(cluster::addComponent); } - if (accessLogElements.isEmpty()) + if (accessLogElements.isEmpty() && deployState.getAccessLoggingEnabledByDefault()) cluster.addDefaultSearchAccessLog(); } diff --git a/config-model/src/main/javacc/SDParser.jj b/config-model/src/main/javacc/SDParser.jj index 3c09a521715..eb7d7763cd1 100644 --- a/config-model/src/main/javacc/SDParser.jj +++ b/config-model/src/main/javacc/SDParser.jj @@ -637,7 +637,7 @@ void field(SDDocumentType document, Search search) : if (name != null && com.yahoo.searchdefinition.Search.isReservedName(name.toLowerCase())) { throw new IllegalArgumentException("Reserved name '" + name + "' can not be used as a field name."); } - field = new TemporarySDField(name, type, true, document); + field = new TemporarySDField(name, type, document); } lbrace() (fieldBody(field, search, document) (<NL>)*)* <RBRACE> { @@ -931,7 +931,7 @@ void structFieldDefinition(SDDocumentType struct) : if (name != null && com.yahoo.searchdefinition.Search.isReservedName(name.toLowerCase())) { throw new IllegalArgumentException("Reserved name '" + name + "' can not be used as a field name."); } - field = new TemporarySDField(name, type, true, struct); + field = new TemporarySDField(name, type, struct); struct.addField(field); } lbrace() (id(field,struct) (<NL>)*)? (match(field) (<NL>)*)* <RBRACE> { diff --git a/container-integration-test/src/test/java/com/yahoo/search/query/gui/GUIHandlerTest.java b/container-integration-test/src/test/java/com/yahoo/search/query/gui/GUIHandlerTest.java index 00272778a2b..7ca5d2a6b10 100644 --- a/container-integration-test/src/test/java/com/yahoo/search/query/gui/GUIHandlerTest.java +++ b/container-integration-test/src/test/java/com/yahoo/search/query/gui/GUIHandlerTest.java @@ -72,6 +72,7 @@ public class GUIHandlerTest { private String servicesXml() { return "<container version='1.0'>\n" + + " <accesslog type='disabled'/>\n" + " <handler id='com.yahoo.search.query.gui.GUIHandler'>\n" + " <binding>http://*/querybuilder/*</binding>\n" + " </handler>\n" + diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcPing.java b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcPing.java index ba3b050149c..5e04f1d7a3e 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcPing.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/rpc/RpcPing.java @@ -15,7 +15,6 @@ import com.yahoo.search.dispatch.searchcluster.PongHandler; import com.yahoo.search.result.ErrorMessage; import com.yahoo.yolean.Exceptions; -import java.util.concurrent.atomic.AtomicReference; import java.util.logging.Logger; public class RpcPing implements Pinger, Client.ResponseReceiver { @@ -91,7 +90,8 @@ public class RpcPing implements Pinger, Client.ResponseReceiver { pongHandler.handle(toPong(response)); } else { //TODO Reduce to debug or remove once we have enumerated what happens here. - log.info("Pong " + pingSequenceId + " received too late, latest is " + node.getLastReceivedPongId()); + log.info("Pong " + pingSequenceId + " from node " + node.key() + " in group " + node.group() + + " with hostname " + node.hostname() + " received too late, latest is " + node.getLastReceivedPongId()); } } } diff --git a/docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java b/docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java index 6868bc8ecd4..4160f366fdb 100644 --- a/docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java +++ b/docproc/src/test/java/com/yahoo/docproc/ProcessingUpdateTestCase.java @@ -37,8 +37,8 @@ public class ProcessingUpdateTestCase { @Test public void testProcessingUpdates() { DocumentType articleType = new DocumentType("article"); - Field bodyField = new Field("body", DataType.STRING, true); - Field titleField = new Field("title", DataType.STRING, true); + Field bodyField = new Field("body", DataType.STRING); + Field titleField = new Field("title", DataType.STRING); articleType.addField(bodyField); articleType.addField(titleField); dtm = new DocumentTypeManager(); diff --git a/document/abi-spec.json b/document/abi-spec.json index af1dbdea56d..abbf03bc228 100644 --- a/document/abi-spec.json +++ b/document/abi-spec.json @@ -1495,8 +1495,10 @@ ], "methods": [ "public void <init>(java.lang.String, int, com.yahoo.document.DataType, boolean)", + "public void <init>(java.lang.String, int, com.yahoo.document.DataType)", "public void <init>(java.lang.String)", "public void <init>(java.lang.String, com.yahoo.document.DataType, boolean, com.yahoo.document.DocumentType)", + "public void <init>(java.lang.String, com.yahoo.document.DataType, com.yahoo.document.DocumentType)", "public void <init>(java.lang.String, com.yahoo.document.DataType, boolean)", "public void <init>(java.lang.String, com.yahoo.document.DataType)", "public void <init>(java.lang.String, com.yahoo.document.Field)", diff --git a/document/src/main/java/com/yahoo/document/DocumentType.java b/document/src/main/java/com/yahoo/document/DocumentType.java index 17c525f7cae..23559878fbb 100755 --- a/document/src/main/java/com/yahoo/document/DocumentType.java +++ b/document/src/main/java/com/yahoo/document/DocumentType.java @@ -199,8 +199,7 @@ public class DocumentType extends StructuredDataType { if (isRegistered()) { throw new IllegalStateException("You cannot add fields to a document type that is already registered."); } - StructDataType struct = (field.isHeader() ? headerType : bodyType); - struct.addField(field); + headerType.addField(field); } // Do not use, public only for testing @@ -239,8 +238,8 @@ public class DocumentType extends StructuredDataType { if (isRegistered()) { throw new IllegalStateException("You cannot add fields to a document type that is already registered."); } - Field field = new Field(name, type, false); - bodyType.addField(field); + Field field = new Field(name, type); + headerType.addField(field); return field; } @@ -252,13 +251,9 @@ public class DocumentType extends StructuredDataType { * @return The field created * TODO Fix searchdefinition so that exception can be thrown if filed is already registerd */ + @Deprecated public Field addHeaderField(String name, DataType type) { - if (isRegistered()) { - throw new IllegalStateException("You cannot add fields to a document type that is already registered."); - } - Field field = new Field(name, type, true); - headerType.addField(field); - return field; + return addField(name, type); } /** diff --git a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java index 9582f7d0e7f..21a163aa2b9 100644 --- a/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java +++ b/document/src/main/java/com/yahoo/document/DocumentTypeManagerConfigurer.java @@ -185,9 +185,9 @@ public class DocumentTypeManagerConfigurer implements ConfigSubscriber.SingleSub : manager.getDataType(field.datatype(), field.detailedtype()); if (field.id().size() == 1) { - type.addField(new Field(field.name(), field.id().get(0).id(), fieldType, true)); + type.addField(new Field(field.name(), field.id().get(0).id(), fieldType)); } else { - type.addField(new Field(field.name(), fieldType, true)); + type.addField(new Field(field.name(), fieldType)); } } manager.register(type); diff --git a/document/src/main/java/com/yahoo/document/Field.java b/document/src/main/java/com/yahoo/document/Field.java index 671c8c7f763..9be4036174c 100644 --- a/document/src/main/java/com/yahoo/document/Field.java +++ b/document/src/main/java/com/yahoo/document/Field.java @@ -21,7 +21,6 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab protected DataType dataType; protected int fieldId; - private boolean isHeader; private boolean forcedId; /** @@ -32,11 +31,14 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab * @param isHeader Whether this is a "header" field or a "content" field * (true = "header"). */ + @Deprecated public Field(String name, int id, DataType dataType, boolean isHeader) { + this(name, id, dataType); + } + public Field(String name, int id, DataType dataType) { super(name); this.fieldId = id; this.dataType = dataType; - this.isHeader = isHeader; this.forcedId = true; validateId(id, null); } @@ -55,8 +57,13 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab * (true = "header"). * @param owner the owning document (used to check for id collisions) */ + @Deprecated public Field(String name, DataType dataType, boolean isHeader, DocumentType owner) { - this(name, 0, dataType, isHeader); + this(name, dataType, owner); + } + + public Field(String name, DataType dataType, DocumentType owner) { + this(name, 0, dataType); this.fieldId = calculateIdV7(owner); this.forcedId = false; } @@ -69,8 +76,9 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab * @param isHeader Whether this is a "header" field or a "content" field * (true = "header"). */ + @Deprecated public Field(String name, DataType dataType, boolean isHeader) { - this(name, dataType, isHeader, null); + this(name, dataType); } /** @@ -80,7 +88,7 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab * @param dataType The datatype of the field */ public Field(String name, DataType dataType) { - this(name, dataType, true); + this(name, dataType, null); } /** @@ -89,7 +97,7 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab */ // TODO: Decide on one copy/clone idiom and do it for this and all it is calling public Field(String name, Field field) { - this(name, field.dataType, field.isHeader, null); + this(name, field.dataType, null); } public int compareTo(Object o) { @@ -196,14 +204,12 @@ public class Field extends FieldBase implements FieldSet, Comparable, Serializab /** @deprecated this has no longer any semantic meaning as this is no longer an aspect with a field */ @Deprecated // TODO: Remove on Vespa 8 public boolean isHeader() { - return isHeader; + return true; } /** @deprecated this has no longer any semantic meaning as this is no longer an aspect with a field */ @Deprecated // TODO: Remove on Vespa 8 - public void setHeader(boolean header) { - this.isHeader = header; - } + public void setHeader(boolean header) { } /** Two fields are equal if they have the same name and the same data type */ @Override diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java index c2111edfd10..630f204c44d 100644 --- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java +++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentSerializer6.java @@ -82,7 +82,7 @@ public class VespaDocumentSerializer6 extends BufferSerializer implements Docume } public void write(Document doc) { - write(new Field(doc.getDataType().getName(), 0, doc.getDataType(), true), doc); + write(new Field(doc.getDataType().getName(), 0, doc.getDataType()), doc); } @SuppressWarnings("deprecation") diff --git a/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java b/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java index 0d6b0cae926..5db98f26141 100644 --- a/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java +++ b/document/src/main/java/com/yahoo/document/serialization/XmlDocumentWriter.java @@ -320,7 +320,7 @@ public final class XmlDocumentWriter implements DocumentWriter { buffer = new XmlStream(); buffer.setIndent(indent); optionalWrapperMarker.clear(); - write(new Field(document.getDataType().getName(), 0, document.getDataType(), true), document); + write(new Field(document.getDataType().getName(), 0, document.getDataType()), document); } @Override diff --git a/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java b/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java index fb2d478d38b..36cc18ebd6b 100755 --- a/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentCalculatorTestCase.java @@ -27,11 +27,11 @@ public class DocumentCalculatorTestCase { docMan = new DocumentTypeManager(); testDocType = new DocumentType("testdoc"); - testDocType.addHeaderField("byteattr", DataType.BYTE); - testDocType.addHeaderField("intattr", DataType.INT); - testDocType.addHeaderField("longattr", DataType.LONG); - testDocType.addHeaderField("doubleattr", DataType.DOUBLE); - testDocType.addHeaderField("missingattr", DataType.INT); + testDocType.addField("byteattr", DataType.BYTE); + testDocType.addField("intattr", DataType.INT); + testDocType.addField("longattr", DataType.LONG); + testDocType.addField("doubleattr", DataType.DOUBLE); + testDocType.addField("missingattr", DataType.INT); docMan.registerDocumentType(testDocType); doc = new Document(testDocType, new DocumentId("id:ns:testdoc::testdoc:http://www.ntnu.no/")); diff --git a/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java b/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java index 08abd6e6a2d..fea3b265b6d 100644 --- a/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentIdTestCase.java @@ -34,11 +34,11 @@ public class DocumentIdTestCase { public void setUp() { DocumentType testDocType = new DocumentType("testdoc"); - testDocType.addHeaderField("intattr", DataType.INT); + testDocType.addField("intattr", DataType.INT); testDocType.addField("rawattr", DataType.RAW); testDocType.addField("floatattr", DataType.FLOAT); - testDocType.addHeaderField("stringattr", DataType.STRING); - testDocType.addHeaderField("Minattr", DataType.INT); + testDocType.addField("stringattr", DataType.STRING); + testDocType.addField("Minattr", DataType.INT); manager.registerDocumentType(testDocType); } diff --git a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java index bc1224ca8ea..fa47c80c6fb 100644 --- a/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentSerializationTestCase.java @@ -62,25 +62,25 @@ public class DocumentSerializationTestCase extends AbstractTypesTest { public void testSerializationAllVersions() throws IOException { DocumentType docInDocType = new DocumentType("docindoc"); - docInDocType.addField(new Field("stringindocfield", DataType.STRING, false)); + docInDocType.addField(new Field("stringindocfield", DataType.STRING)); DocumentType docType = new DocumentType("serializetest"); - docType.addField(new Field("floatfield", DataType.FLOAT, true)); - docType.addField(new Field("stringfield", DataType.STRING, true)); - docType.addField(new Field("longfield", DataType.LONG, true)); - docType.addField(new Field("urifield", DataType.URI, true)); - docType.addField(new Field("intfield", DataType.INT, false)); - docType.addField(new Field("rawfield", DataType.RAW, false)); - docType.addField(new Field("doublefield", DataType.DOUBLE, false)); - docType.addField(new Field("bytefield", DataType.BYTE, false)); - docType.addField(new Field("boolfield", DataType.BOOL, false)); + docType.addField(new Field("floatfield", DataType.FLOAT)); + docType.addField(new Field("stringfield", DataType.STRING)); + docType.addField(new Field("longfield", DataType.LONG)); + docType.addField(new Field("urifield", DataType.URI)); + docType.addField(new Field("intfield", DataType.INT)); + docType.addField(new Field("rawfield", DataType.RAW)); + docType.addField(new Field("doublefield", DataType.DOUBLE)); + docType.addField(new Field("bytefield", DataType.BYTE)); + docType.addField(new Field("boolfield", DataType.BOOL)); DataType arrayOfFloatDataType = new ArrayDataType(DataType.FLOAT); - docType.addField(new Field("arrayoffloatfield", arrayOfFloatDataType, false)); + docType.addField(new Field("arrayoffloatfield", arrayOfFloatDataType)); DataType arrayOfArrayOfFloatDataType = new ArrayDataType(arrayOfFloatDataType); - docType.addField(new Field("arrayofarrayoffloatfield", arrayOfArrayOfFloatDataType, false)); - docType.addField(new Field("docfield", DataType.DOCUMENT, false)); + docType.addField(new Field("arrayofarrayoffloatfield", arrayOfArrayOfFloatDataType)); + docType.addField(new Field("docfield", DataType.DOCUMENT)); DataType weightedSetDataType = DataType.getWeightedSet(DataType.STRING, false, false); - docType.addField(new Field("wsfield", weightedSetDataType, false)); + docType.addField(new Field("wsfield", weightedSetDataType)); DocumentTypeManager docMan = new DocumentTypeManager(); docMan.register(docInDocType); diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTestCase.java index 141a74a24fe..dcd4622b3f4 100644 --- a/document/src/test/java/com/yahoo/document/DocumentTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentTestCase.java @@ -107,26 +107,26 @@ public class DocumentTestCase extends DocumentTestCaseBase { docMan = new DocumentTypeManager(); DocumentType docInDocType = new DocumentType("docindoc"); - docInDocType.addField(new Field("tull", 2, docMan.getDataType(2), true)); + docInDocType.addField(new Field("tull", 2, docMan.getDataType(2))); docMan.registerDocumentType(docInDocType); DocumentType sertestDocType = new DocumentType("sertest"); - sertestDocType.addField(new Field("mailid", 2, docMan.getDataType(2), true)); - sertestDocType.addField(new Field("date", 3, docMan.getDataType(0), true)); - sertestDocType.addField(new Field("from", 4, docMan.getDataType(2), true)); - sertestDocType.addField(new Field("to", 6, docMan.getDataType(2), true)); - sertestDocType.addField(new Field("subject", 9, docMan.getDataType(2), true)); - sertestDocType.addField(new Field("body", 10, docMan.getDataType(2), false)); - sertestDocType.addField(new Field("attachmentcount", 11, docMan.getDataType(0), false)); - sertestDocType.addField(new Field("attachments", 1081629685, DataType.getArray(docMan.getDataType(2)), false)); - sertestDocType.addField(new Field("rawfield", 879, DataType.RAW, false)); - sertestDocType.addField(new Field("weightedfield", 880, DataType.getWeightedSet(DataType.STRING), false)); - sertestDocType.addField(new Field("weightedfieldCreate", 881, DataType.getWeightedSet(DataType.STRING, true, false), false)); - sertestDocType.addField(new Field("docindoc", 882, docInDocType, false)); - sertestDocType.addField(new Field("mapfield", 883, new MapDataType(DataType.STRING, DataType.STRING), false)); - sertestDocType.addField(new Field("myposfield", 884, PositionDataType.INSTANCE, false)); - sertestDocType.addField(new Field("myboolfield", 885, DataType.BOOL, false)); + sertestDocType.addField(new Field("mailid", 2, docMan.getDataType(2))); + sertestDocType.addField(new Field("date", 3, docMan.getDataType(0))); + sertestDocType.addField(new Field("from", 4, docMan.getDataType(2))); + sertestDocType.addField(new Field("to", 6, docMan.getDataType(2))); + sertestDocType.addField(new Field("subject", 9, docMan.getDataType(2))); + sertestDocType.addField(new Field("body", 10, docMan.getDataType(2))); + sertestDocType.addField(new Field("attachmentcount", 11, docMan.getDataType(0))); + sertestDocType.addField(new Field("attachments", 1081629685, DataType.getArray(docMan.getDataType(2)))); + sertestDocType.addField(new Field("rawfield", 879, DataType.RAW)); + sertestDocType.addField(new Field("weightedfield", 880, DataType.getWeightedSet(DataType.STRING))); + sertestDocType.addField(new Field("weightedfieldCreate", 881, DataType.getWeightedSet(DataType.STRING, true, false))); + sertestDocType.addField(new Field("docindoc", 882, docInDocType)); + sertestDocType.addField(new Field("mapfield", 883, new MapDataType(DataType.STRING, DataType.STRING))); + sertestDocType.addField(new Field("myposfield", 884, PositionDataType.INSTANCE)); + sertestDocType.addField(new Field("myboolfield", 885, DataType.BOOL)); docMan.registerDocumentType(sertestDocType); } @@ -880,13 +880,13 @@ public class DocumentTestCase extends DocumentTestCaseBase { public void testInheritance() { // Create types that inherit each other.. And test that it works.. DocumentType parentType = new DocumentType("parent"); - parentType.addField(new Field("parentbodyint", DataType.INT, false)); - parentType.addField(new Field("parentheaderint", DataType.INT, true)); - parentType.addField(new Field("overwritten", DataType.INT, true)); + parentType.addField(new Field("parentbodyint", DataType.INT)); + parentType.addField(new Field("parentheaderint", DataType.INT)); + parentType.addField(new Field("overwritten", DataType.INT)); DocumentType childType = new DocumentType("child"); - childType.addField(new Field("childbodyint", DataType.INT, false)); - childType.addField(new Field("childheaderint", DataType.INT, true)); - childType.addField(new Field("overwritten", DataType.INT, true)); + childType.addField(new Field("childbodyint", DataType.INT)); + childType.addField(new Field("childheaderint", DataType.INT)); + childType.addField(new Field("overwritten", DataType.INT)); childType.inherit(parentType); DocumentTypeManager manager = new DocumentTypeManager(); @@ -914,13 +914,13 @@ public class DocumentTestCase extends DocumentTestCaseBase { @Test public void testInheritanceTypeMismatch() { DocumentType parentType = new DocumentType("parent"); - parentType.addField(new Field("parentbodyint", DataType.INT, false)); - parentType.addField(new Field("parentheaderint", DataType.INT, true)); - parentType.addField(new Field("overwritten", DataType.STRING, true)); + parentType.addField(new Field("parentbodyint", DataType.INT)); + parentType.addField(new Field("parentheaderint", DataType.INT)); + parentType.addField(new Field("overwritten", DataType.STRING)); DocumentType childType = new DocumentType("child"); - childType.addField(new Field("childbodyint", DataType.INT, false)); - childType.addField(new Field("childheaderint", DataType.INT, true)); - childType.addField(new Field("overwritten", DataType.INT, true)); + childType.addField(new Field("childbodyint", DataType.INT)); + childType.addField(new Field("childheaderint", DataType.INT)); + childType.addField(new Field("overwritten", DataType.INT)); try { childType.inherit(parentType); fail("Inheritance with conflicting types worked."); @@ -934,7 +934,7 @@ public class DocumentTestCase extends DocumentTestCaseBase { public void testFieldValueImplementations() { docMan = new DocumentTypeManager(); DocumentType docType = new DocumentType("impl"); - docType.addField(new Field("something", DataType.getArray(DataType.STRING), false)); + docType.addField(new Field("something", DataType.getArray(DataType.STRING))); docMan.register(docType); //just checks that isAssignableFrom() in Document.setFieldValue() goes the right way @@ -1276,9 +1276,9 @@ public class DocumentTestCase extends DocumentTestCaseBase { public void testDocumentComparisonDoesNotCorruptStateBug6394548() { DocumentTypeManager docMan = new DocumentTypeManager(); DocumentType docType = new DocumentType("bug2354045"); - docType.addField(new Field("string", 2, DataType.STRING, true)); - docType.addField(new Field("int", 1, DataType.INT, true)); - docType.addField(new Field("float", 0, DataType.FLOAT, true)); + docType.addField(new Field("string", 2, DataType.STRING)); + docType.addField(new Field("int", 1, DataType.INT)); + docType.addField(new Field("float", 0, DataType.FLOAT)); docMan.register(docType); Document doc1 = new Document(docType, new DocumentId("id:ns:bug2354045::bug6394548")); diff --git a/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java b/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java index 68fe1c8cc57..6f95f77f08c 100644 --- a/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java +++ b/document/src/test/java/com/yahoo/document/DocumentTestCaseBase.java @@ -23,14 +23,14 @@ public class DocumentTestCaseBase { docMan = new DocumentTypeManager(); testDocType = new DocumentType("testdoc"); - testDocType.addHeaderField("byteattr", DataType.BYTE); - testDocType.addHeaderField("intattr", DataType.INT); + testDocType.addField("byteattr", DataType.BYTE); + testDocType.addField("intattr", DataType.INT); testDocType.addField("rawattr", DataType.RAW); testDocType.addField("floatattr", DataType.FLOAT); - testDocType.addHeaderField("stringattr", DataType.STRING); - testDocType.addHeaderField("Minattr", DataType.INT); - testDocType.addHeaderField("Minattr2", DataType.INT); - testDocType.addHeaderField("primitive1", DataType.INT); + testDocType.addField("stringattr", DataType.STRING); + testDocType.addField("Minattr", DataType.INT); + testDocType.addField("Minattr2", DataType.INT); + testDocType.addField("primitive1", DataType.INT); StructDataType sdt = new StructDataType("struct1"); sdt.addField(new Field("primitive1", DataType.INT)); diff --git a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java index 3dff90e888e..57b36d9758f 100644 --- a/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentTypeManagerTestCase.java @@ -31,7 +31,7 @@ public class DocumentTypeManagerTestCase { DocumentType newDocType = new DocumentType("testdoc"); newDocType.addField("Fjomp", DataType.INT); - newDocType.addHeaderField("Fjols", DataType.STRING); + newDocType.addField("Fjols", DataType.STRING); manager.registerDocumentType(newDocType); @@ -41,7 +41,6 @@ public class DocumentTypeManagerTestCase { assertEquals("Fjomp", fetched4.getName()); assertEquals(fetched4.getDataType(), DataType.INT); - assertEquals(fetched4.isHeader(), false); } @Test @@ -65,8 +64,8 @@ public class DocumentTypeManagerTestCase { StructDataType struct = new StructDataType("mystruct"); DataType wset1 = DataType.getWeightedSet(DataType.getArray(DataType.INT)); DataType wset2 = DataType.getWeightedSet(DataType.getArray(DataType.TAG)); - struct.addField(new Field("foo", wset1, true)); - struct.addField(new Field("bar", wset2, false)); + struct.addField(new Field("foo", wset1)); + struct.addField(new Field("bar", wset2)); DataType array = DataType.getArray(struct); DocumentType docType = new DocumentType("mydoc"); docType.addField("hmm", array); @@ -149,7 +148,6 @@ public class DocumentTypeManagerTestCase { assertTrue(type.hasField("foobarfield1")); Field foobarfield0 = type.getField("foobarfield0"); - assertTrue(!foobarfield0.isHeader()); assertTrue(foobarfield0.getDataType().getCode() == 2); Field foobarfield1 = type.getField("foobarfield1"); @@ -191,7 +189,6 @@ public class DocumentTypeManagerTestCase { assertTrue(type.hasField("arrayarrayfloat")); Field arrayfloat = type.getField("arrayfloat"); - assertTrue(!arrayfloat.isHeader()); ArrayDataType dataType = (ArrayDataType) arrayfloat.getDataType(); assertTrue(dataType.getCode() == 99); assertTrue(dataType.getValueClass().equals(Array.class)); @@ -201,7 +198,6 @@ public class DocumentTypeManagerTestCase { Field arrayarrayfloat = type.getField("arrayarrayfloat"); ArrayDataType subType = (ArrayDataType) arrayarrayfloat.getDataType(); - assertTrue(!arrayarrayfloat.isHeader()); assertTrue(subType.getCode() == 4003); assertTrue(subType.getValueClass().equals(Array.class)); assertTrue(subType.getNestedType().getCode() == 99); @@ -219,14 +215,14 @@ public class DocumentTypeManagerTestCase { DocumentType customtypes = manager.getDocumentType(new DataTypeName("customtypes")); assertNull(banana.getField("newfield")); - assertEquals(new Field("arrayfloat", 9489, new ArrayDataType(DataType.FLOAT, 99), false), customtypes.getField("arrayfloat")); + assertEquals(new Field("arrayfloat", 9489, new ArrayDataType(DataType.FLOAT, 99)), customtypes.getField("arrayfloat")); DocumentTypeManagerConfigurer.configure(manager, "file:src/test/document/documentmanager.updated.cfg"); banana = manager.getDocumentType(new DataTypeName("banana")); customtypes = manager.getDocumentType(new DataTypeName("customtypes")); - assertEquals(new Field("newfield", 12345, DataType.STRING, true), banana.getField("newfield")); + assertEquals(new Field("newfield", 12345, DataType.STRING), banana.getField("newfield")); assertNull(customtypes.getField("arrayfloat")); } diff --git a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java index c381a093b4e..9f05a4441b2 100644 --- a/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java +++ b/document/src/test/java/com/yahoo/document/DocumentUpdateTestCase.java @@ -799,8 +799,8 @@ public class DocumentUpdateTestCase { public TensorUpdateSerializeFixture() { docMan = new DocumentTypeManager(); docType = new DocumentType("test"); - docType.addHeaderField("sparse_tensor", new TensorDataType(TensorType.fromSpec("tensor(x{})"))); - docType.addHeaderField("dense_tensor", new TensorDataType(TensorType.fromSpec("tensor(x[4])"))); + docType.addField("sparse_tensor", new TensorDataType(TensorType.fromSpec("tensor(x{})"))); + docType.addField("dense_tensor", new TensorDataType(TensorType.fromSpec("tensor(x[4])"))); docMan.registerDocumentType(docType); } diff --git a/document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java b/document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java index 286f7d72b24..7cf0adf6ed1 100644 --- a/document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java +++ b/document/src/test/java/com/yahoo/document/IncompatibleFieldTypesTest.java @@ -17,9 +17,9 @@ public class IncompatibleFieldTypesTest { public void setUp() { arrayOfStrings = new ArrayDataType(DataType.STRING); struct = new StructDataType("fancypants"); - struct.addField(new Field("stringarray", arrayOfStrings, false)); + struct.addField(new Field("stringarray", arrayOfStrings)); DataType weightedSetOfStrings = DataType.getWeightedSet(DataType.STRING, false, false); - struct.addField(new Field("stringws", weightedSetOfStrings, false)); + struct.addField(new Field("stringws", weightedSetOfStrings)); root = struct.createFieldValue(); root.setFieldValue("stringarray", arrayOfStrings.createFieldValue()); diff --git a/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java b/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java index 4197938f0ee..295cfa37e89 100644 --- a/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java +++ b/document/src/test/java/com/yahoo/document/datatypes/StructTestCase.java @@ -20,14 +20,14 @@ public class StructTestCase { @Test public void testBasicStuff() throws Exception { StructDataType type = new StructDataType("teststr"); - type.addField(new Field("int", 0, DataType.INT, true)); - type.addField(new Field("flt", 1, DataType.FLOAT, true)); - type.addField(new Field("str", 2, DataType.STRING, true)); - type.addField(new Field("raw", 3, DataType.RAW, true)); - type.addField(new Field("lng", 4, DataType.LONG, true)); - type.addField(new Field("dbl", 5, DataType.DOUBLE, true)); - type.addField(new Field("uri", 6, DataType.URI, true)); - type.addField(new Field("byt", 8, DataType.BYTE, true)); + type.addField(new Field("int", 0, DataType.INT)); + type.addField(new Field("flt", 1, DataType.FLOAT)); + type.addField(new Field("str", 2, DataType.STRING)); + type.addField(new Field("raw", 3, DataType.RAW)); + type.addField(new Field("lng", 4, DataType.LONG)); + type.addField(new Field("dbl", 5, DataType.DOUBLE)); + type.addField(new Field("uri", 6, DataType.URI)); + type.addField(new Field("byt", 8, DataType.BYTE)); Struct struct = new Struct(type); { @@ -236,7 +236,7 @@ public class StructTestCase { @Test public void testSetUnknownType() { StructDataType type = new StructDataType("teststr"); - type.addField(new Field("int", 0, DataType.INT, true)); + type.addField(new Field("int", 0, DataType.INT)); Struct struct = new Struct(type); try { @@ -251,9 +251,9 @@ public class StructTestCase { public void testCompareToDoesNotMutateStateBug6394548() { StructDataType type = new StructDataType("test"); // NOTE: non-increasing ID order! - type.addField(new Field("int", 2, DataType.INT, true)); - type.addField(new Field("flt", 1, DataType.FLOAT, true)); - type.addField(new Field("str", 0, DataType.STRING, true)); + type.addField(new Field("int", 2, DataType.INT)); + type.addField(new Field("flt", 1, DataType.FLOAT)); + type.addField(new Field("str", 0, DataType.STRING)); Struct a = new Struct(type); a.setFieldValue("int", new IntegerFieldValue(123)); diff --git a/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java b/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java index c11c58ff729..404b069277b 100644 --- a/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java +++ b/document/src/test/java/com/yahoo/document/fieldset/FieldSetTestCase.java @@ -98,13 +98,13 @@ public class FieldSetTestCase extends DocumentTestCaseBase { assertFalse(new DocIdOnly().contains(headerField)); assertTrue(new HeaderFields().contains(headerField)); - assertFalse(new HeaderFields().contains(bodyField)); + assertTrue(new HeaderFields().contains(bodyField)); assertTrue(new HeaderFields().contains(new DocIdOnly())); assertTrue(new HeaderFields().contains(new NoFields())); - assertContains("[body]", "testdoc:rawattr"); + assertNotContains("[body]", "testdoc:rawattr"); assertContains("[header]", "testdoc:intattr"); - assertNotContains("[header]", "testdoc:rawattr"); + assertContains("[header]", "testdoc:rawattr"); assertContains("testdoc:rawattr,intattr", "testdoc:intattr"); assertNotContains("testdoc:intattr", "testdoc:rawattr,intattr"); assertContains("testdoc:intattr,rawattr", "testdoc:rawattr,intattr"); @@ -141,10 +141,10 @@ public class FieldSetTestCase extends DocumentTestCaseBase { Document doc = getTestDocument(); doc.removeFieldValue("rawattr"); - assertEquals("floatattr:3.56", doCopyFields(doc, "[body]")); - assertEquals("stringattr:tjohei,intattr:50,byteattr:30,floatattr:3.56", doCopyFields(doc, "[all]")); - assertEquals("stringattr:tjohei,intattr:50,byteattr:30", doCopyFields(doc, "[header]")); - assertEquals("byteattr:30,floatattr:3.56", doCopyFields(doc, "testdoc:floatattr,byteattr")); + assertEquals("", doCopyFields(doc, "[body]")); + assertEquals("floatattr:3.56,stringattr:tjohei,intattr:50,byteattr:30", doCopyFields(doc, "[header]")); + assertEquals("floatattr:3.56,stringattr:tjohei,intattr:50,byteattr:30", doCopyFields(doc, "[all]")); + assertEquals("floatattr:3.56,byteattr:30", doCopyFields(doc, "testdoc:floatattr,byteattr")); } String doStripFields(Document source, String fieldSet) { @@ -159,10 +159,10 @@ public class FieldSetTestCase extends DocumentTestCaseBase { Document doc = getTestDocument(); doc.removeFieldValue("rawattr"); - assertEquals("floatattr:3.56", doStripFields(doc, "[body]")); - assertEquals("stringattr:tjohei,intattr:50,byteattr:30,floatattr:3.56", doStripFields(doc, "[all]")); - assertEquals("stringattr:tjohei,intattr:50,byteattr:30", doStripFields(doc, "[header]")); - assertEquals("byteattr:30,floatattr:3.56", doStripFields(doc, "testdoc:floatattr,byteattr")); + assertEquals("", doStripFields(doc, "[body]")); + assertEquals("floatattr:3.56,stringattr:tjohei,intattr:50,byteattr:30", doStripFields(doc, "[header]")); + assertEquals("floatattr:3.56,stringattr:tjohei,intattr:50,byteattr:30", doStripFields(doc, "[all]")); + assertEquals("floatattr:3.56,byteattr:30", doStripFields(doc, "testdoc:floatattr,byteattr")); } @Test diff --git a/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java b/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java index 05cfbc301cc..0212be8542e 100644 --- a/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java +++ b/document/src/test/java/com/yahoo/document/select/DocumentSelectorTestCase.java @@ -38,15 +38,15 @@ public class DocumentSelectorTestCase { public void setUp() { var importedFields = new HashSet<>(List.of("my_imported_field")); DocumentType type = new DocumentType("test", importedFields); - type.addHeaderField("hint", DataType.INT); - type.addHeaderField("hfloat", DataType.FLOAT); - type.addHeaderField("hstring", DataType.STRING); + type.addField("hint", DataType.INT); + type.addField("hfloat", DataType.FLOAT); + type.addField("hstring", DataType.STRING); type.addField("content", DataType.STRING); StructDataType mystruct = new StructDataType("mystruct"); - mystruct.addField(new Field("key", DataType.INT, false)); - mystruct.addField(new Field("value", DataType.STRING, false)); - type.addHeaderField("mystruct", mystruct); + mystruct.addField(new Field("key", DataType.INT)); + mystruct.addField(new Field("value", DataType.STRING)); + type.addField("mystruct", mystruct); ArrayDataType structarray = new ArrayDataType(mystruct); type.addField("structarray", structarray); diff --git a/document/src/test/resources/predicates/false__java b/document/src/test/resources/predicates/false__java Binary files differindex 00a71d5fe73..c9f426b3aaf 100644 --- a/document/src/test/resources/predicates/false__java +++ b/document/src/test/resources/predicates/false__java diff --git a/document/src/test/resources/predicates/foo_in_6_9__java b/document/src/test/resources/predicates/foo_in_6_9__java Binary files differindex d18b937bead..9c1413f1b77 100644 --- a/document/src/test/resources/predicates/foo_in_6_9__java +++ b/document/src/test/resources/predicates/foo_in_6_9__java diff --git a/document/src/test/resources/predicates/foo_in_6_x__java b/document/src/test/resources/predicates/foo_in_6_x__java Binary files differindex b8ae334882e..d53f4d03996 100644 --- a/document/src/test/resources/predicates/foo_in_6_x__java +++ b/document/src/test/resources/predicates/foo_in_6_x__java diff --git a/document/src/test/resources/predicates/foo_in_bar__java b/document/src/test/resources/predicates/foo_in_bar__java Binary files differindex aeb10e2b5d7..3adde3ae2fe 100644 --- a/document/src/test/resources/predicates/foo_in_bar__java +++ b/document/src/test/resources/predicates/foo_in_bar__java diff --git a/document/src/test/resources/predicates/foo_in_bar_and_baz_in_cox__java b/document/src/test/resources/predicates/foo_in_bar_and_baz_in_cox__java Binary files differindex 8a2705e6f62..8583f37da57 100644 --- a/document/src/test/resources/predicates/foo_in_bar_and_baz_in_cox__java +++ b/document/src/test/resources/predicates/foo_in_bar_and_baz_in_cox__java diff --git a/document/src/test/resources/predicates/foo_in_bar_baz__java b/document/src/test/resources/predicates/foo_in_bar_baz__java Binary files differindex ea3314d9bd7..1db1a175c0c 100644 --- a/document/src/test/resources/predicates/foo_in_bar_baz__java +++ b/document/src/test/resources/predicates/foo_in_bar_baz__java diff --git a/document/src/test/resources/predicates/foo_in_bar_or_baz_in_cox__java b/document/src/test/resources/predicates/foo_in_bar_or_baz_in_cox__java Binary files differindex 4d5474c24e4..3b1dbd541fa 100644 --- a/document/src/test/resources/predicates/foo_in_bar_or_baz_in_cox__java +++ b/document/src/test/resources/predicates/foo_in_bar_or_baz_in_cox__java diff --git a/document/src/test/resources/predicates/foo_in_x_9__java b/document/src/test/resources/predicates/foo_in_x_9__java Binary files differindex 017a610a7d5..9a2bfc9af89 100644 --- a/document/src/test/resources/predicates/foo_in_x_9__java +++ b/document/src/test/resources/predicates/foo_in_x_9__java diff --git a/document/src/test/resources/predicates/foo_in_x__java b/document/src/test/resources/predicates/foo_in_x__java Binary files differindex 6537cc6bdeb..8faf7762be7 100644 --- a/document/src/test/resources/predicates/foo_in_x__java +++ b/document/src/test/resources/predicates/foo_in_x__java diff --git a/document/src/test/resources/predicates/foo_in_x_x__java b/document/src/test/resources/predicates/foo_in_x_x__java Binary files differindex 5060718417a..bf01a265651 100644 --- a/document/src/test/resources/predicates/foo_in_x_x__java +++ b/document/src/test/resources/predicates/foo_in_x_x__java diff --git a/document/src/test/resources/predicates/not_foo_in_bar__java b/document/src/test/resources/predicates/not_foo_in_bar__java Binary files differindex b654de6d53e..a7cbacbaf35 100644 --- a/document/src/test/resources/predicates/not_foo_in_bar__java +++ b/document/src/test/resources/predicates/not_foo_in_bar__java diff --git a/document/src/test/resources/predicates/true__java b/document/src/test/resources/predicates/true__java Binary files differindex 2b5da7409d5..87356a5ed44 100644 --- a/document/src/test/resources/predicates/true__java +++ b/document/src/test/resources/predicates/true__java diff --git a/document/src/test/resources/tensor/empty_tensor__java b/document/src/test/resources/tensor/empty_tensor__java Binary files differindex 2c15c152558..cf878f0e689 100644 --- a/document/src/test/resources/tensor/empty_tensor__java +++ b/document/src/test/resources/tensor/empty_tensor__java diff --git a/document/src/test/resources/tensor/multi_cell_tensor__java b/document/src/test/resources/tensor/multi_cell_tensor__java Binary files differindex d923fc10559..deb53463fb5 100644 --- a/document/src/test/resources/tensor/multi_cell_tensor__java +++ b/document/src/test/resources/tensor/multi_cell_tensor__java diff --git a/document/src/test/resources/tensor/non_existing_tensor__java b/document/src/test/resources/tensor/non_existing_tensor__java Binary files differindex 08cbcac6dd3..7a1d95ff132 100644 --- a/document/src/test/resources/tensor/non_existing_tensor__java +++ b/document/src/test/resources/tensor/non_existing_tensor__java diff --git a/document/src/tests/data/serializejava-compressed.dat b/document/src/tests/data/serializejava-compressed.dat Binary files differindex 0ac391422ff..e11bb3b53db 100644 --- a/document/src/tests/data/serializejava-compressed.dat +++ b/document/src/tests/data/serializejava-compressed.dat diff --git a/document/src/tests/data/serializejava.dat b/document/src/tests/data/serializejava.dat Binary files differindex 10873c9d905..3fa21bdccd3 100644 --- a/document/src/tests/data/serializejava.dat +++ b/document/src/tests/data/serializejava.dat diff --git a/document/src/tests/data/serializejavawithannotations.dat b/document/src/tests/data/serializejavawithannotations.dat Binary files differindex fe683d1580e..08854d03a29 100644 --- a/document/src/tests/data/serializejavawithannotations.dat +++ b/document/src/tests/data/serializejavawithannotations.dat diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp index fed4de67f28..968470e9693 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -585,7 +585,7 @@ TEST(DocumentTest, testReadSerializedFile) EXPECT_TRUE(buf2.empty()); buf2.rp(0); - EXPECT_EQ(len - 13, buf2.size()); // Size is smaller as we are merging to one chunk. + EXPECT_EQ(len, buf2.size()); doc2.setValue("stringfield", StringFieldValue("hei")); 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 0a2ba901c8f..8cea3428fd8 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -223,6 +223,11 @@ public class Flags { "Takes effect at redeployment", APPLICATION_ID); + public static final UnboundBooleanFlag USE_RPM_PACKAGES_FOR_DATA_HIGHWAY = defineFeatureFlag( + "use-rpm-packages-for-data-highway", false, + "Whether RPM packages should be used for Data Highway", + "Takes effect on restart of Docker container", + ZONE_ID, APPLICATION_ID); /** WARNING: public for testing: All flags should be defined in {@link Flags}. */ public static UnboundBooleanFlag defineFeatureFlag(String flagId, boolean defaultValue, String description, diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Reports.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Reports.java index fd6094ae111..7885cec6b65 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Reports.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/node/Reports.java @@ -71,6 +71,6 @@ public class Reports { return this; } - public Reports build() { return new Reports(Collections.unmodifiableMap(reportMap)); } + public Reports build() { return new Reports(reportMap); } } } diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java index 09cb5dad0a9..577e28a4237 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/restapi/v2/NodePatcher.java @@ -6,6 +6,7 @@ import com.yahoo.config.provision.DockerImage; import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.NodeResources; +import com.yahoo.config.provision.NodeType; import com.yahoo.config.provision.TenantName; import com.yahoo.io.IOUtils; import com.yahoo.slime.Inspector; @@ -34,8 +35,8 @@ import java.util.stream.Collectors; import static com.yahoo.config.provision.NodeResources.DiskSpeed.fast; import static com.yahoo.config.provision.NodeResources.DiskSpeed.slow; -import static com.yahoo.config.provision.NodeResources.StorageType.remote; import static com.yahoo.config.provision.NodeResources.StorageType.local; +import static com.yahoo.config.provision.NodeResources.StorageType.remote; /** * A class which can take a partial JSON node/v2 node JSON structure and apply it to a node object. @@ -46,7 +47,6 @@ import static com.yahoo.config.provision.NodeResources.StorageType.local; public class NodePatcher { private static final String WANT_TO_RETIRE = "wantToRetire"; - private static final String WANT_TO_DEPROVISION = "wantToDeprovision"; private final NodeFlavors nodeFlavors; private final Inspector inspector; @@ -100,7 +100,6 @@ public class NodePatcher { private List<Node> applyFieldRecursive(List<Node> childNodes, String name, Inspector value) { switch (name) { case WANT_TO_RETIRE: - case WANT_TO_DEPROVISION: return childNodes.stream() .map(child -> applyField(child, name, value)) .collect(Collectors.toList()); @@ -139,7 +138,9 @@ public class NodePatcher { return IP.Config.verify(node.with(node.ipConfig().with(IP.Pool.of(asStringSet(value)))), nodes); case WANT_TO_RETIRE : return node.withWantToRetire(asBoolean(value), Agent.operator, clock.instant()); - case WANT_TO_DEPROVISION : + case "wantToDeprovision" : + if (node.type() != NodeType.host && asBoolean(value)) + throw new IllegalArgumentException("wantToDeprovision can only be set for hosts"); return node.with(node.status().withWantToDeprovision(asBoolean(value))); case "reports" : return nodeWithPatchedReports(node, value); @@ -172,22 +173,42 @@ public class NodePatcher { } private Node nodeWithPatchedReports(Node node, Inspector reportsInspector) { + Node patchedNode; // "reports": null clears the reports - if (reportsInspector.type() == Type.NIX) return node.with(new Reports()); + if (reportsInspector.type() == Type.NIX) { + patchedNode = node.with(new Reports()); + } else { + var reportsBuilder = new Reports.Builder(node.reports()); + reportsInspector.traverse((ObjectTraverser) (reportId, reportInspector) -> { + if (reportInspector.type() == Type.NIX) { + // ... "reports": { "reportId": null } clears the report "reportId" + reportsBuilder.clearReport(reportId); + } else { + // ... "reports": { "reportId": {...} } overrides the whole report "reportId" + reportsBuilder.setReport(Report.fromSlime(reportId, reportInspector)); + } + }); + patchedNode = node.with(reportsBuilder.build()); + } - var reportsBuilder = new Reports.Builder(node.reports()); + boolean hadHardFailReports = node.reports().getReports().stream() + .anyMatch(r -> r.getType() == Report.Type.HARD_FAIL); + boolean hasHardFailReports = patchedNode.reports().getReports().stream() + .anyMatch(r -> r.getType() == Report.Type.HARD_FAIL); - reportsInspector.traverse((ObjectTraverser) (reportId, reportInspector) -> { - if (reportInspector.type() == Type.NIX) { - // ... "reports": { "reportId": null } clears the report "reportId" - reportsBuilder.clearReport(reportId); - } else { - // ... "reports": { "reportId": {...} } overrides the whole report "reportId" - reportsBuilder.setReport(Report.fromSlime(reportId, reportInspector)); - } - }); + // If this patch resulted in going from not having HARD_FAIL report to having one, or vice versa + if (hadHardFailReports != hasHardFailReports) { + // Do not automatically change wantToDeprovision when + // 1. Transitioning to having a HARD_FAIL report and being in state failed: + // To allow operators manually unset before the host is parked and deleted. + // 2. When in parked state: Deletion is imminent, possibly already underway + if ((hasHardFailReports && node.state() == Node.State.failed) || node.state() == Node.State.parked) + return patchedNode; + + patchedNode = patchedNode.with(patchedNode.status().withWantToDeprovision(hasHardFailReports)); + } - return node.with(reportsBuilder.build()); + return patchedNode; } private Set<String> asStringSet(Inspector field) { diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/RestApiTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/RestApiTest.java index 6dfb1aed47e..c26614c630c 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/RestApiTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/RestApiTest.java @@ -218,9 +218,6 @@ public class RestApiTest { Utf8.toBytes("{\"wantToRetire\": true}"), Request.Method.PATCH), "{\"message\":\"Updated host4.yahoo.com\"}"); assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com", - Utf8.toBytes("{\"wantToDeprovision\": true}"), Request.Method.PATCH), - "{\"message\":\"Updated host4.yahoo.com\"}"); - assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com", Utf8.toBytes("{\"currentVespaVersion\": \"6.43.0\",\"currentDockerImage\": \"docker-registry.domain.tld:8080/dist/vespa:6.45.0\"}"), Request.Method.PATCH), "{\"message\":\"Updated host4.yahoo.com\"}"); assertResponse(new Request("http://localhost:8080/nodes/v2/node/host4.yahoo.com", @@ -229,6 +226,9 @@ public class RestApiTest { assertResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com", Utf8.toBytes("{\"modelName\": \"foo\"}"), Request.Method.PATCH), "{\"message\":\"Updated dockerhost1.yahoo.com\"}"); + assertResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com", + Utf8.toBytes("{\"wantToDeprovision\": true}"), Request.Method.PATCH), + "{\"message\":\"Updated dockerhost1.yahoo.com\"}"); assertResponseContains(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com"), "\"modelName\":\"foo\""); assertResponse(new Request("http://localhost:8080/nodes/v2/node/dockerhost1.yahoo.com", Utf8.toBytes("{\"modelName\": null}"), Request.Method.PATCH), @@ -541,11 +541,13 @@ public class RestApiTest { " \"actualCpuCores\": {" + " \"createdMillis\": 1, " + " \"description\": \"Actual number of CPU cores (2) differs from spec (4)\"," + + " \"type\": \"HARD_FAIL\"," + " \"value\":2" + " }," + " \"diskSpace\": {" + " \"createdMillis\": 2, " + " \"description\": \"Actual disk space (2TB) differs from spec (3TB)\"," + + " \"type\": \"HARD_FAIL\"," + " \"details\": {" + " \"inGib\": 3," + " \"disks\": [\"/dev/sda1\", \"/dev/sdb3\"]" + diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4-after-changes.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4-after-changes.json index ad5c28d6a80..af3552945d9 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4-after-changes.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node4-after-changes.json @@ -35,7 +35,7 @@ "currentDockerImage": "docker-registry.domain.tld:8080/dist/vespa:6.45.0", "failCount": 1, "wantToRetire": true, - "wantToDeprovision": true, + "wantToDeprovision": false, "history": [ { "event": "provisioned", diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-2.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-2.json index d33c1c9e743..a3d53798d7c 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-2.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports-2.json @@ -30,7 +30,7 @@ "currentRebootGeneration": 0, "failCount": 0, "wantToRetire": false, - "wantToDeprovision": false, + "wantToDeprovision": true, "history": [ { "event": "provisioned", @@ -65,6 +65,7 @@ "diskSpace": { "createdMillis": 2, "description": "Actual disk space (2TB) differs from spec (3TB)", + "type":"HARD_FAIL", "details": { "inGib": 3, "disks": [ diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports.json b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports.json index 4119e46e225..67b8d67c7f1 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports.json +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/restapi/v2/responses/node6-reports.json @@ -30,7 +30,7 @@ "currentRebootGeneration": 0, "failCount": 0, "wantToRetire": false, - "wantToDeprovision": false, + "wantToDeprovision": true, "history": [ { "event": "provisioned", @@ -62,11 +62,13 @@ "actualCpuCores": { "createdMillis": 1, "description": "Actual number of CPU cores (2) differs from spec (4)", + "type":"HARD_FAIL", "value": 2 }, "diskSpace": { "createdMillis": 2, "description": "Actual disk space (2TB) differs from spec (3TB)", + "type":"HARD_FAIL", "details": { "inGib": 3, "disks": [ diff --git a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionResourceTest.java b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionResourceTest.java index 2996220561c..80d0af09792 100644 --- a/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionResourceTest.java +++ b/orchestrator/src/test/java/com/yahoo/vespa/orchestrator/resources/ApplicationSuspensionResourceTest.java @@ -155,6 +155,7 @@ public class ApplicationSuspensionResourceTest { return "<services>\n" + " <container version=\"1.0\" jetty=\"true\">\n" + + " <accesslog type=\"disabled\"/>\n" + " <config name=\"container.handler.threadpool\">\n" + " <maxthreads>10</maxthreads>\n" + " </config>\n" + diff --git a/searchcore/src/vespa/searchcore/config/proton.def b/searchcore/src/vespa/searchcore/config/proton.def index d123a5711ac..eb4f1f6dc89 100644 --- a/searchcore/src/vespa/searchcore/config/proton.def +++ b/searchcore/src/vespa/searchcore/config/proton.def @@ -397,8 +397,8 @@ writefilter.memorylimit double default = 0.8 ## put and update portion of feed is blocked. writefilter.disklimit double default = 0.8 -## Interval between sampling of disk and memory usage. Default is 60 seconds. -writefilter.sampleinterval double default = 60.0 +## Interval between sampling of disk and memory usage. Default is 20 seconds. +writefilter.sampleinterval double default = 20.0 ## The size of the disk partition (in bytes) on which proton basedir is located. ## If set to 0, the disk size is sampled by looking at the filesystem space info. diff --git a/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_filter.cpp b/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_filter.cpp index 9445a0a5206..1a6fc6cdbfd 100644 --- a/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_filter.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_filter.cpp @@ -163,7 +163,7 @@ DiskMemUsageFilter::DiskMemUsageFilter(const HwInfo &hwInfo) _listeners() { } -DiskMemUsageFilter::~DiskMemUsageFilter() { } +DiskMemUsageFilter::~DiskMemUsageFilter() = default; void DiskMemUsageFilter::setMemoryStats(vespalib::ProcessMemoryStats memoryStats_in) diff --git a/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_state.h b/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_state.h index 40c74808e72..b05cc261728 100644 --- a/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_state.h +++ b/searchcore/src/vespa/searchcore/proton/server/disk_mem_usage_state.h @@ -15,11 +15,7 @@ class DiskMemUsageState ResourceUsageState _memoryState; public: - DiskMemUsageState() - : _diskState(), - _memoryState() - { - } + DiskMemUsageState() = default; DiskMemUsageState(const ResourceUsageState &diskState_, const ResourceUsageState &memoryState_) : _diskState(diskState_), diff --git a/searchcore/src/vespa/searchcore/proton/server/i_blockable_maintenance_job.h b/searchcore/src/vespa/searchcore/proton/server/i_blockable_maintenance_job.h index c70a6c502f1..63ff269580e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_blockable_maintenance_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_blockable_maintenance_job.h @@ -36,7 +36,7 @@ public: */ virtual void unBlock(BlockedReason reason) = 0; - virtual IBlockableMaintenanceJob *asBlockable() override { return this; } + IBlockableMaintenanceJob *asBlockable() override { return this; } }; } diff --git a/searchcore/src/vespa/searchcore/proton/server/i_maintenance_job.h b/searchcore/src/vespa/searchcore/proton/server/i_maintenance_job.h index 6d0739e1aed..df6889ecf04 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_maintenance_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_maintenance_job.h @@ -31,7 +31,7 @@ public: _interval(interval) {} - virtual ~IMaintenanceJob() {} + virtual ~IMaintenanceJob() = default; virtual const vespalib::string &getName() const { return _name; } virtual vespalib::duration getDelay() const { return _delay; } diff --git a/searchcore/src/vespa/searchcore/proton/server/move_operation_limiter.cpp b/searchcore/src/vespa/searchcore/proton/server/move_operation_limiter.cpp index 6c0c0863fe1..e535b05393c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/move_operation_limiter.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/move_operation_limiter.cpp @@ -41,9 +41,7 @@ MoveOperationLimiter::MoveOperationLimiter(IBlockableMaintenanceJob *job, { } -MoveOperationLimiter::~MoveOperationLimiter() -{ -} +MoveOperationLimiter::~MoveOperationLimiter() = default; void MoveOperationLimiter::clearJob() diff --git a/staging_vespalib/src/vespa/vespalib/util/process_memory_stats.cpp b/staging_vespalib/src/vespa/vespalib/util/process_memory_stats.cpp index ff1d7e1d6ec..e2e8e49419f 100644 --- a/staging_vespalib/src/vespa/vespalib/util/process_memory_stats.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/process_memory_stats.cpp @@ -196,6 +196,8 @@ ProcessMemoryStats::create(uint64_t sizeEpsilon) i, (samples.rbegin()+1)->toString().c_str(), samples.back().toString().c_str()); } std::sort(samples.begin(), samples.end()); + LOG(warning, "We failed to find 2 consecutive samples that where similar with epsilon of %lu.\nSmallest is '%s',\n median is '%s',\n largest is '%s'", + sizeEpsilon, samples.front().toString().c_str(), samples[samples.size()/2].toString().c_str(), samples.back().toString().c_str()); return samples[samples.size()/2]; } diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/RestApiTest.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/RestApiTest.java index aeddc762586..0661363477f 100644 --- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/RestApiTest.java +++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/RestApiTest.java @@ -202,7 +202,7 @@ public class RestApiTest { // Get logs through some hackish fetch method. Logs is something the mocked backend write. String getLog() throws IOException { - // The mocked backend will throw a runtime exception wtih a log if delete is called three times.. + // The mocked backend will throw a runtime exception with a log if delete is called three times.. Request request = new Request("http://localhost:" + getFirstListenPort() + remove_test_uri); HttpDelete delete = new HttpDelete(request.getUri()); doRest(delete); diff --git a/vespaclient-container-plugin/src/test/rest-api-application/services.xml b/vespaclient-container-plugin/src/test/rest-api-application/services.xml index 346740bc815..ae1b87635a9 100644 --- a/vespaclient-container-plugin/src/test/rest-api-application/services.xml +++ b/vespaclient-container-plugin/src/test/rest-api-application/services.xml @@ -2,6 +2,8 @@ <!-- Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> <container version="1.0" jetty="true"> + <accesslog type="disabled"/> + <handler id="com.yahoo.document.restapi.resource.RestApiWithTestDocumentHandler" bundle="integration-test"> <binding>http://*/document/v1/*</binding> </handler> |