diff options
1099 files changed, 6349 insertions, 5756 deletions
diff --git a/config-application-package/pom.xml b/config-application-package/pom.xml index 8236458c532..6bb1191ff8f 100644 --- a/config-application-package/pom.xml +++ b/config-application-package/pom.xml @@ -98,6 +98,12 @@ <artifactId>jackson-databind</artifactId> </dependency> <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>configdefinitions</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> diff --git a/config-application-package/src/main/java/com/yahoo/config/application/OverrideProcessor.java b/config-application-package/src/main/java/com/yahoo/config/application/OverrideProcessor.java index 1e77ad1a8f7..db506c0ed51 100644 --- a/config-application-package/src/main/java/com/yahoo/config/application/OverrideProcessor.java +++ b/config-application-package/src/main/java/com/yahoo/config/application/OverrideProcessor.java @@ -118,14 +118,18 @@ class OverrideProcessor implements PreProcessor { Iterator<Element> elemIt = children.iterator(); while (elemIt.hasNext()) { Element child = elemIt.next(); - Optional<Environment> env = getEnvironment(child); - RegionName reg = getRegion(child); - if ((env.isPresent() && !environment.equals(env.get())) || (!reg.isDefault() && !region.equals(reg))) { + if ( ! matches(getEnvironment(child), getRegion(child))) { parent.removeChild(child); elemIt.remove(); } } } + + private boolean matches(Optional<Environment> elementEnvironment, RegionName elementRegion) { + if (elementEnvironment.isPresent() && ! environment.equals(elementEnvironment.get())) return false; + if ( ! elementRegion.isDefault() && ( ! region.equals(elementRegion) || ! environment.equals(Environment.prod))) return false; + return true; + } /** * Find the most specific element and remove all others. diff --git a/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java b/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java index 41b69e9a7aa..adced18bb85 100644 --- a/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java +++ b/config-application-package/src/test/java/com/yahoo/config/application/OverrideProcessorTest.java @@ -268,7 +268,8 @@ public class OverrideProcessorTest { " <document mode=\"index\" type=\"music2\"/>" + " </documents>" + " <nodes>" + - " <node distribution-key=\"0\" hostalias=\"node1\"/>" + + // node1 is specified for us-west but does not match because region overrides implies environment=prod + " <node distribution-key=\"0\" hostalias=\"node0\"/>" + " </nodes>" + " </content>" + " <jdisc id=\"stateless\" version=\"1.0\">" + diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java b/config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java index 135eeebde6c..788cad27c7c 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/derived/ImportedFields.java @@ -2,6 +2,7 @@ package com.yahoo.searchdefinition.derived; import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.document.Attribute; import com.yahoo.searchdefinition.document.ImportedField; import com.yahoo.vespa.config.search.ImportedFieldsConfig; @@ -45,10 +46,21 @@ public class ImportedFields extends Derived implements ImportedFieldsConfig.Prod private static ImportedFieldsConfig.Attribute.Builder createAttributeBuilder(ImportedField field) { ImportedFieldsConfig.Attribute.Builder result = new ImportedFieldsConfig.Attribute.Builder(); + Attribute targetAttribute = field.targetField().getAttributes().get(field.targetField().getName()); result.name(field.fieldName()); result.referencefield(field.reference().referenceField().getName()); result.targetfield(field.targetField().getName()); + result.datatype(getDataType(targetAttribute)); + result.collectiontype(getCollectionType(targetAttribute)); return result; } + private static ImportedFieldsConfig.Attribute.Datatype.Enum getDataType(Attribute targetAttribute) { + return ImportedFieldsConfig.Attribute.Datatype.Enum.valueOf(targetAttribute.getType().getExportAttributeTypeName()); + } + + private static ImportedFieldsConfig.Attribute.Collectiontype.Enum getCollectionType(Attribute targetAttribute) { + return ImportedFieldsConfig.Attribute.Collectiontype.Enum.valueOf(targetAttribute.getCollectionType().getName()); + } + } diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/FastAccessValidator.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/FastAccessValidator.java new file mode 100644 index 00000000000..7bef7244eb7 --- /dev/null +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/FastAccessValidator.java @@ -0,0 +1,53 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.searchdefinition.processing; + +import com.yahoo.config.application.api.DeployLogger; +import com.yahoo.searchdefinition.RankProfileRegistry; +import com.yahoo.searchdefinition.Search; +import com.yahoo.searchdefinition.document.Attribute; +import com.yahoo.vespa.model.container.search.QueryProfiles; + +import java.util.stream.Collectors; + +/** + * Validates the use of the fast-access property. + * + * @author bjorncs + */ +public class FastAccessValidator extends Processor { + public FastAccessValidator(Search search, DeployLogger deployLogger, RankProfileRegistry rankProfileRegistry, QueryProfiles queryProfiles) { + super(search, deployLogger, rankProfileRegistry, queryProfiles); + } + + @Override + public void process() { + String invalidAttributes = search.allFields() + .flatMap(field -> field.getAttributes().values().stream()) + .filter(FastAccessValidator::isIncompatibleAttribute) + .map(Attribute::getName) + .collect(Collectors.joining(", ")); + if (!invalidAttributes.isEmpty()) { + throw new IllegalArgumentException( + String.format( + "For search '%s': The following attributes have a type that is incompatible with fast-access: %s. " + + "Predicate, tensor and reference attributes are incompatible with fast-access.", + search.getName(), + invalidAttributes)); + } + } + + private static boolean isIncompatibleAttribute(Attribute attribute) { + return attribute.isFastAccess() && isTypeIncompatibleWithFastAccess(attribute.getType()); + } + + private static boolean isTypeIncompatibleWithFastAccess(Attribute.Type type) { + switch (type) { + case PREDICATE: + case TENSOR: + case REFERENCE: + return true; + default: + return false; + } + } +} diff --git a/config-model/src/main/java/com/yahoo/searchdefinition/processing/Processing.java b/config-model/src/main/java/com/yahoo/searchdefinition/processing/Processing.java index 2098d0c0808..18cfd227813 100644 --- a/config-model/src/main/java/com/yahoo/searchdefinition/processing/Processing.java +++ b/config-model/src/main/java/com/yahoo/searchdefinition/processing/Processing.java @@ -73,6 +73,7 @@ public class Processing { TensorFieldProcessor::new, RankProfileTypeSettingsProcessor::new, ReferenceFieldsProcessor::new, + FastAccessValidator::new, // These two should be last. IndexingValidation::new, diff --git a/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java b/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java index 920759d3b83..b9698c21da0 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/HostSystem.java @@ -13,6 +13,7 @@ import com.yahoo.config.provision.ProvisionLogger; import java.net.InetAddress; import java.net.UnknownHostException; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -187,13 +188,11 @@ public class HostSystem extends AbstractConfigProducer<Host> { } Set<HostSpec> getSingleTenantHosts() { - LinkedHashSet<HostSpec> hostSpecs = new LinkedHashSet<>(); - for (HostResource host: hostname2host.values()) { - if (! host.getHost().isMultitenant()) { - hostSpecs.add(new HostSpec(host.getHostName(), host.primaryClusterMembership())); - } - } - return hostSpecs; + return hostname2host.values().stream() + .filter(host -> ! host.getHost().isMultitenant()) + .map(host -> new HostSpec(host.getHostName(), Collections.emptyList(), + host.getFlavor(), host.primaryClusterMembership())) + .collect(Collectors.toCollection(LinkedHashSet::new)); } /** A provision logger which forwards to a deploy logger */ diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/http/ConnectorFactory.java b/config-model/src/main/java/com/yahoo/vespa/model/container/http/ConnectorFactory.java index 24aeda9ed84..143a7a1ccee 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/http/ConnectorFactory.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/http/ConnectorFactory.java @@ -67,7 +67,7 @@ public class ConnectorFactory extends SimpleComponent implements ConnectorConfig Element soLinger = XML.getChild(legacyConfig, "soLinger"); if (soLinger != null) { - connectorBuilder.soLingerTime((int) Double.parseDouble(XML.getValue(soLinger).trim())); + connectorBuilder.soLingerTime(Double.parseDouble(XML.getValue(soLinger).trim())); } } { diff --git a/config-model/src/test/cfg/application/validation/search_content/hosts.xml b/config-model/src/test/cfg/application/validation/search_content/hosts.xml deleted file mode 100644 index e2b97e374e6..00000000000 --- a/config-model/src/test/cfg/application/validation/search_content/hosts.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<hosts> - <host name="localhost"> - <alias>node1</alias> - </host> -</hosts> diff --git a/config-model/src/test/cfg/application/validation/search_content/searchdefinitions/simple.sd b/config-model/src/test/cfg/application/validation/search_content/searchdefinitions/simple.sd deleted file mode 100644 index 3647689de10..00000000000 --- a/config-model/src/test/cfg/application/validation/search_content/searchdefinitions/simple.sd +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -search simple { - document simple { - field foo type raw { } - field bar type raw { indexing: summary } - } -} diff --git a/config-model/src/test/cfg/application/validation/search_content/services.xml b/config-model/src/test/cfg/application/validation/search_content/services.xml deleted file mode 100644 index c415b2aad4c..00000000000 --- a/config-model/src/test/cfg/application/validation/search_content/services.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<services> - <admin version="2.0"> - <adminserver hostalias="node1" /> - <logserver hostalias="node1" /> - </admin> - <search version="2.0"> - <qrservers> - <qrserver hostalias="node1" /> - </qrservers> - <cluster indexingmode="realtime"> - <searchdefinitions> - <searchdefinition name="simple" /> - </searchdefinitions> - <clustercontrollers> - <clustercontroller hostalias="node1" /> - </clustercontrollers> - <topleveldispatchers> - <topleveldispatcher hostalias="node1" /> - </topleveldispatchers> - <row index="0"> - <searchnodes> - <searchnode hostalias="node1" index="0" /> - </searchnodes> - </row> - </cluster> - </search> -</services> diff --git a/config-model/src/test/cfg/search/data/nextgen-simple-v2/searchdefinitions/nextgendoc.sd b/config-model/src/test/cfg/search/data/nextgen-simple-v2/searchdefinitions/nextgendoc.sd deleted file mode 100644 index 461e7123c01..00000000000 --- a/config-model/src/test/cfg/search/data/nextgen-simple-v2/searchdefinitions/nextgendoc.sd +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -search nextgendoc { - document nextgendoc { - field body type string { - indexing: summary | index - } - } -} diff --git a/config-model/src/test/cfg/search/data/nextgen-simple-v2/services.xml b/config-model/src/test/cfg/search/data/nextgen-simple-v2/services.xml deleted file mode 100644 index cce1cf40419..00000000000 --- a/config-model/src/test/cfg/search/data/nextgen-simple-v2/services.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<services version="1.0"> - - <admin version="2.0"> - - <adminserver hostalias="node1" /> - - <logserver hostalias="node1" /> - <slobroks> - <slobrok hostalias="node1" /> - </slobroks> - </admin> - - <search version="2.0"> - <qrservers> - <qrserver hostalias="node1" /> - </qrservers> - <cluster name="search" indexingmode="realtime"> - <searchdefinitions> - <searchdefinition name="nextgendoc" /> - </searchdefinitions> - <clustercontrollers> - <clustercontroller hostalias="node1" /> - </clustercontrollers> - <topleveldispatchers> - <topleveldispatcher hostalias="node1" /> - </topleveldispatchers> - <row index="0"> - <searchnodes> - <searchnode hostalias="node1" index="0" /> - </searchnodes> - </row> - </cluster> - </search> - -</services> diff --git a/config-model/src/test/cfg/search/data/onlybundles/components/testbundle.jar b/config-model/src/test/cfg/search/data/onlybundles/components/testbundle.jar Binary files differdeleted file mode 100644 index 69f6e335092..00000000000 --- a/config-model/src/test/cfg/search/data/onlybundles/components/testbundle.jar +++ /dev/null diff --git a/config-model/src/test/cfg/search/data/onlybundles/services.xml b/config-model/src/test/cfg/search/data/onlybundles/services.xml deleted file mode 100644 index 427b0c6d23f..00000000000 --- a/config-model/src/test/cfg/search/data/onlybundles/services.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<services> - <admin version="2.0"> - <adminserver hostalias="node1"/> - <logserver hostalias="node1"/> - </admin> - - <search version="2.0"> - <qrservers> - <qrserver hostalias="node1" /> - </qrservers> - <cluster name="music" indexingmode="realtime"> - <visibilitydelay>15.7</visibilitydelay> - <searchdefinitions> - <searchdefinition name="music2" /> - </searchdefinitions> - <documents selection="music" /> - <clustercontrollers> - <clustercontroller hostalias="node1" /> - </clustercontrollers> - <topleveldispatchers> - <topleveldispatcher hostalias="node1" /> - </topleveldispatchers> - <row index="0"> - <searchnodes> - <searchnode hostalias="node1" index="0" /> - </searchnodes> - </row> - </cluster> - - </search> - -</services> diff --git a/config-model/src/test/cfg/search/data/v2/onlybundles/components/testbundle.jar b/config-model/src/test/cfg/search/data/v2/onlybundles/components/testbundle.jar Binary files differdeleted file mode 100644 index 69f6e335092..00000000000 --- a/config-model/src/test/cfg/search/data/v2/onlybundles/components/testbundle.jar +++ /dev/null diff --git a/config-model/src/test/cfg/search/data/v2/onlybundles/services.xml b/config-model/src/test/cfg/search/data/v2/onlybundles/services.xml deleted file mode 100644 index 7d5048ba9a2..00000000000 --- a/config-model/src/test/cfg/search/data/v2/onlybundles/services.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<services> - <admin version="2.0"> - <adminserver hostalias="node1"/> - <logserver hostalias="node1"/> - </admin> - - <search version="2.0"> - <qrservers> - <qrserver hostalias="node1"/> - </qrservers> - <cluster name="music"> - <visibilitydelay>15.7</visibilitydelay> - <searchdefinitions> - <searchdefinition name="music2"/> - </searchdefinitions> - <documents selection="music"/> - <clustercontrollers> - <clustercontroller hostalias="node1"/> - </clustercontrollers> - <topleveldispatchers> - <topleveldispatcher hostalias="node1"/> - </topleveldispatchers> - <row index="0"> - <searchnodes> - <searchnode hostalias="node1" index="0"/> - </searchnodes> - </row> - </cluster> - - </search> - -</services> diff --git a/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/hosts.xml b/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/hosts.xml deleted file mode 100644 index 9215f81ad98..00000000000 --- a/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/hosts.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<hosts> - <host name="zarya"> - <alias>node1</alias> - </host> -</hosts> diff --git a/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/searchdefinitions/music.sd b/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/searchdefinitions/music.sd deleted file mode 100755 index 392e19213b1..00000000000 --- a/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/searchdefinitions/music.sd +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -search music { - document music { - field f1 type string { - indexing: summary | index - # index-to: f1, all - } - field f2 type string { - indexing: summary | index - # index-to: f2, all - } - } -} diff --git a/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/services.xml b/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/services.xml deleted file mode 100644 index 8c78597b5b5..00000000000 --- a/config-model/src/test/cfg/search/data/v2/twoFeedTargetClusters/services.xml +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<services> - <admin version="2.0"> - <adminserver hostalias="node1"/> - <logserver hostalias="node1"/> - </admin> - <search version="2.0"> - <qrservers> - <qrserver hostalias="node1"/> - </qrservers> - <cluster name="music1"> - <searchdefinitions> - <searchdefinition name="music"/> - </searchdefinitions> - <!-- The point with this test is to have a 'documents' tag without a 'feedname' attribute --> - <documents selection="music.f1"/> - <clustercontrollers> - <clustercontroller hostalias="node1"/> - </clustercontrollers> - <topleveldispatchers> - <topleveldispatcher hostalias="node1"/> - </topleveldispatchers> - <row index="0"> - <searchnodes> - <searchnode hostalias="node1" index="0"/> - </searchnodes> - </row> - </cluster> - - <cluster name="music2"> - <searchdefinitions> - <searchdefinition name="music"/> - </searchdefinitions> - <!-- The point with this test is to have a 'documents' tag without a 'feedname' attribute --> - <documents selection="music.f2"/> - <clustercontrollers> - <clustercontroller hostalias="node1"/> - </clustercontrollers> - <topleveldispatchers> - <topleveldispatcher hostalias="node1"/> - </topleveldispatchers> - <row index="0"> - <searchnodes> - <searchnode hostalias="node1" index="0"/> - </searchnodes> - </row> - <row index="1"> - <searchnodes> - <searchnode hostalias="node1" index="0"/> - </searchnodes> - </row> - </cluster> - </search> -</services> diff --git a/config-model/src/test/derived/importedfields/ad.sd b/config-model/src/test/derived/importedfields/ad.sd deleted file mode 100644 index 7c43538e501..00000000000 --- a/config-model/src/test/derived/importedfields/ad.sd +++ /dev/null @@ -1,18 +0,0 @@ -search ad { - document ad { - field campaign_ref type reference<campaign> { indexing: attribute } - field person_ref type reference<person> { indexing: attribute } - } - import field campaign_ref.budget as my_budget {} - import field person_ref.name as my_person_name {} - - fieldset myfieldset { - fields: my_budget, my_person_name - } - - document-summary mysummary { - summary campaign_ref type reference<campaign> {} - summary my_budget type int {} - summary my_person_name type string {} - } -} diff --git a/config-model/src/test/derived/importedfields/campaign.sd b/config-model/src/test/derived/importedfields/campaign.sd deleted file mode 100644 index 07998e57bde..00000000000 --- a/config-model/src/test/derived/importedfields/campaign.sd +++ /dev/null @@ -1,7 +0,0 @@ -search campaign { - document campaign { - field budget type int { - indexing: attribute - } - } -} diff --git a/config-model/src/test/derived/importedfields/child.sd b/config-model/src/test/derived/importedfields/child.sd new file mode 100644 index 00000000000..5ab9962f614 --- /dev/null +++ b/config-model/src/test/derived/importedfields/child.sd @@ -0,0 +1,22 @@ +search child { + document child { + field a_ref type reference<parent_a> { indexing: attribute } + field b_ref type reference<parent_b> { indexing: attribute } + } + import field a_ref.int_field as my_int_field {} + import field b_ref.string_field as my_string_field {} + import field a_ref.int_array_field as my_int_array_field {} + import field a_ref.int_wset_field as my_int_wset_field {} + + fieldset myfieldset { + fields: my_int_field, my_string_field + } + + document-summary mysummary { + summary a_ref type reference<parent_a> {} + summary my_int_field type int {} + summary my_string_field type string {} + summary my_int_array_field type array<int> {} + summary my_int_wset_field type weightedset<int> {} + } +} diff --git a/config-model/src/test/derived/importedfields/imported-fields.cfg b/config-model/src/test/derived/importedfields/imported-fields.cfg index 6ffb7055657..48eb8a58af3 100644 --- a/config-model/src/test/derived/importedfields/imported-fields.cfg +++ b/config-model/src/test/derived/importedfields/imported-fields.cfg @@ -1,6 +1,20 @@ -attribute[].name "my_budget" -attribute[].referencefield "campaign_ref" -attribute[].targetfield "budget" -attribute[].name "my_person_name" -attribute[].referencefield "person_ref" -attribute[].targetfield "name" +attribute[].name "my_int_field" +attribute[].referencefield "a_ref" +attribute[].targetfield "int_field" +attribute[].datatype INT32 +attribute[].collectiontype SINGLE +attribute[].name "my_string_field" +attribute[].referencefield "b_ref" +attribute[].targetfield "string_field" +attribute[].datatype STRING +attribute[].collectiontype SINGLE +attribute[].name "my_int_array_field" +attribute[].referencefield "a_ref" +attribute[].targetfield "int_array_field" +attribute[].datatype INT32 +attribute[].collectiontype ARRAY +attribute[].name "my_int_wset_field" +attribute[].referencefield "a_ref" +attribute[].targetfield "int_wset_field" +attribute[].datatype INT32 +attribute[].collectiontype WEIGHTEDSET diff --git a/config-model/src/test/derived/importedfields/index-info.cfg b/config-model/src/test/derived/importedfields/index-info.cfg index 0295df3f3fe..b33091bff04 100644 --- a/config-model/src/test/derived/importedfields/index-info.cfg +++ b/config-model/src/test/derived/importedfields/index-info.cfg @@ -1,36 +1,48 @@ -indexinfo[].name "ad" +indexinfo[].name "child" indexinfo[].command[].indexname "sddocname" indexinfo[].command[].command "index" indexinfo[].command[].indexname "sddocname" indexinfo[].command[].command "word" -indexinfo[].command[].indexname "campaign_ref" +indexinfo[].command[].indexname "a_ref" indexinfo[].command[].command "index" -indexinfo[].command[].indexname "campaign_ref" +indexinfo[].command[].indexname "a_ref" indexinfo[].command[].command "attribute" -indexinfo[].command[].indexname "campaign_ref" +indexinfo[].command[].indexname "a_ref" indexinfo[].command[].command "word" -indexinfo[].command[].indexname "person_ref" +indexinfo[].command[].indexname "b_ref" indexinfo[].command[].command "index" -indexinfo[].command[].indexname "person_ref" +indexinfo[].command[].indexname "b_ref" indexinfo[].command[].command "attribute" -indexinfo[].command[].indexname "person_ref" +indexinfo[].command[].indexname "b_ref" indexinfo[].command[].command "word" indexinfo[].command[].indexname "rankfeatures" indexinfo[].command[].command "index" indexinfo[].command[].indexname "summaryfeatures" indexinfo[].command[].command "index" -indexinfo[].command[].indexname "my_budget" +indexinfo[].command[].indexname "my_int_field" indexinfo[].command[].command "index" -indexinfo[].command[].indexname "my_budget" +indexinfo[].command[].indexname "my_int_field" indexinfo[].command[].command "attribute" -indexinfo[].command[].indexname "my_budget" +indexinfo[].command[].indexname "my_int_field" indexinfo[].command[].command "numerical" -indexinfo[].command[].indexname "my_person_name" +indexinfo[].command[].indexname "my_string_field" indexinfo[].command[].command "index" -indexinfo[].command[].indexname "my_person_name" +indexinfo[].command[].indexname "my_string_field" indexinfo[].command[].command "attribute" -indexinfo[].command[].indexname "my_person_name" +indexinfo[].command[].indexname "my_string_field" indexinfo[].command[].command "word" +indexinfo[].command[].indexname "my_int_array_field" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "my_int_array_field" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "my_int_array_field" +indexinfo[].command[].command "attribute" +indexinfo[].command[].indexname "my_int_wset_field" +indexinfo[].command[].command "index" +indexinfo[].command[].indexname "my_int_wset_field" +indexinfo[].command[].command "multivalue" +indexinfo[].command[].indexname "my_int_wset_field" +indexinfo[].command[].command "attribute" indexinfo[].command[].indexname "myfieldset" indexinfo[].command[].command "attribute" indexinfo[].command[].indexname "myfieldset" diff --git a/config-model/src/test/derived/importedfields/indexschema.cfg b/config-model/src/test/derived/importedfields/indexschema.cfg index 224d40566bc..5905de5e42e 100644 --- a/config-model/src/test/derived/importedfields/indexschema.cfg +++ b/config-model/src/test/derived/importedfields/indexschema.cfg @@ -1,3 +1,3 @@ fieldset[].name "myfieldset" -fieldset[].field[].name "my_budget" -fieldset[].field[].name "my_person_name" +fieldset[].field[].name "my_int_field" +fieldset[].field[].name "my_string_field" diff --git a/config-model/src/test/derived/importedfields/parent_a.sd b/config-model/src/test/derived/importedfields/parent_a.sd new file mode 100644 index 00000000000..9508393cf3f --- /dev/null +++ b/config-model/src/test/derived/importedfields/parent_a.sd @@ -0,0 +1,13 @@ +search parent_a { + document parent_a { + field int_field type int { + indexing: attribute + } + field int_array_field type array<int> { + indexing: attribute + } + field int_wset_field type weightedset<int> { + indexing: attribute + } + } +} diff --git a/config-model/src/test/derived/importedfields/parent_b.sd b/config-model/src/test/derived/importedfields/parent_b.sd new file mode 100644 index 00000000000..3827546a4e1 --- /dev/null +++ b/config-model/src/test/derived/importedfields/parent_b.sd @@ -0,0 +1,7 @@ +search parent_b { + document parent_b { + field string_field type string { + indexing: attribute + } + } +} diff --git a/config-model/src/test/derived/importedfields/person.sd b/config-model/src/test/derived/importedfields/person.sd deleted file mode 100644 index 74213fbe52f..00000000000 --- a/config-model/src/test/derived/importedfields/person.sd +++ /dev/null @@ -1,7 +0,0 @@ -search person { - document person { - field name type string { - indexing: attribute - } - } -} diff --git a/config-model/src/test/derived/importedfields/summary.cfg b/config-model/src/test/derived/importedfields/summary.cfg index d0042be0e2a..95a9c2bb318 100644 --- a/config-model/src/test/derived/importedfields/summary.cfg +++ b/config-model/src/test/derived/importedfields/summary.cfg @@ -7,14 +7,18 @@ classes[].fields[].name "summaryfeatures" classes[].fields[].type "featuredata" classes[].fields[].name "documentid" classes[].fields[].type "longstring" -classes[].id 153697641 +classes[].id 665629335 classes[].name "mysummary" -classes[].fields[].name "campaign_ref" +classes[].fields[].name "a_ref" classes[].fields[].type "longstring" -classes[].fields[].name "my_budget" +classes[].fields[].name "my_int_field" classes[].fields[].type "integer" -classes[].fields[].name "my_person_name" +classes[].fields[].name "my_string_field" classes[].fields[].type "longstring" +classes[].fields[].name "my_int_array_field" +classes[].fields[].type "jsonstring" +classes[].fields[].name "my_int_wset_field" +classes[].fields[].type "jsonstring" classes[].fields[].name "rankfeatures" classes[].fields[].type "featuredata" classes[].fields[].name "summaryfeatures" diff --git a/config-model/src/test/derived/importedfields/summarymap.cfg b/config-model/src/test/derived/importedfields/summarymap.cfg index 39408bbff5e..84f76490dd9 100644 --- a/config-model/src/test/derived/importedfields/summarymap.cfg +++ b/config-model/src/test/derived/importedfields/summarymap.cfg @@ -1,13 +1,19 @@ defaultoutputclass -1 +override[].field "my_int_field" +override[].command "attribute" +override[].arguments "my_int_field" +override[].field "my_string_field" +override[].command "attribute" +override[].arguments "my_string_field" +override[].field "my_int_array_field" +override[].command "attribute" +override[].arguments "my_int_array_field" +override[].field "my_int_wset_field" +override[].command "attribute" +override[].arguments "my_int_wset_field" override[].field "rankfeatures" override[].command "rankfeatures" override[].arguments "" override[].field "summaryfeatures" override[].command "summaryfeatures" override[].arguments "" -override[].field "my_budget" -override[].command "attribute" -override[].arguments "my_budget" -override[].field "my_person_name" -override[].command "attribute" -override[].arguments "my_person_name" diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ImportedFieldsTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ImportedFieldsTestCase.java index d9d3d936121..644a4eace16 100644 --- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ImportedFieldsTestCase.java +++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ImportedFieldsTestCase.java @@ -13,6 +13,6 @@ public class ImportedFieldsTestCase extends AbstractExportingTestCase { @Test public void configs_for_imported_fields_are_derived() throws IOException, ParseException { - assertCorrectDeriving("importedfields", "ad"); + assertCorrectDeriving("importedfields", "child"); } } diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java b/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java new file mode 100644 index 00000000000..8097d828da9 --- /dev/null +++ b/config-model/src/test/java/com/yahoo/searchdefinition/processing/FastAccessValidatorTest.java @@ -0,0 +1,59 @@ +package com.yahoo.searchdefinition.processing; + +import com.yahoo.config.model.test.TestUtil; +import com.yahoo.searchdefinition.RankProfileRegistry; +import com.yahoo.searchdefinition.SearchBuilder; +import com.yahoo.searchdefinition.parser.ParseException; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; + +/** + * @author bjorncs + */ +public class FastAccessValidatorTest { + + @Rule + public final ExpectedException exceptionRule = ExpectedException.none(); + + @Test + public void throws_exception_on_incompatible_use_of_fastaccess() throws ParseException { + SearchBuilder builder = new SearchBuilder(new RankProfileRegistry()); + builder.importString( + TestUtil.joinLines( + "search parent {", + " document parent {", + " field int_field type int { indexing: attribute }", + " }", + "}")); + builder.importString( + TestUtil.joinLines( + "search test {", + " document test { ", + " field int_attribute type int { ", + " indexing: attribute ", + " attribute: fast-access", + " }", + " field predicate_attribute type predicate {", + " indexing: attribute ", + " attribute: fast-access", + " }", + " field tensor_attribute type tensor(x[]) {", + " indexing: attribute ", + " attribute: fast-access", + " }", + " field reference_attribute type reference<parent> {", + " indexing: attribute ", + " attribute: fast-access", + " }", + " }", + "}")); + exceptionRule.expect(IllegalArgumentException.class); + exceptionRule.expectMessage( + "For search 'test': The following attributes have a type that is incompatible " + + "with fast-access: predicate_attribute, tensor_attribute, reference_attribute. " + + "Predicate, tensor and reference attributes are incompatible with fast-access."); + builder.build(); + } + +} diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java index 453b8d0ffa6..76c108cf851 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/JettyContainerModelBuilderTest.java @@ -164,7 +164,7 @@ public class JettyContainerModelBuilderTest extends ContainerModelBuilderTestBas assertThat(connector.tcpNoDelay(), equalTo(false)); assertThat(connector.acceptQueueSize(), equalTo(2)); assertThat(connector.idleTimeout(), equalTo(34.1)); - assertThat(connector.soLingerTime(), equalTo(42)); + assertThat(connector.soLingerTime(), equalTo(42.2)); assertThat(connector.outputBufferSize(), equalTo(1234)); assertThat(connector.headerCacheSize(), equalTo(4321)); assertThat(connector.ssl().enabled(), equalTo(true)); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java index f62cbbd0963..7426db0001b 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/search/test/SearchClusterTest.java @@ -50,31 +50,6 @@ public class SearchClusterTest { @Test public void testSdConfigLogical() throws IOException, SAXException { - String services = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + - "<services version=\"1.0\">" + - " <admin version='2.0'>" + - " <adminserver hostalias='node0' />" + - " </admin>" + - " <search version=\"2.0\">" + - " <qrservers>" + - " <qrserver hostalias=\"node0\" />" + - " </qrservers>" + - " <cluster name=\"s1\" indexingmode=\"realtime\">" + - " <searchdefinitions>" + - " <searchdefinition name=\"s1\" />" + - " <searchdefinition name=\"s2\" />" + - " </searchdefinitions>" + - " <documents selection=\"music\" feedname=\"a\" />" + - " <row index=\"0\">" + - " <searchnodes>" + - " <searchnode hostalias=\"node2\" index=\"0\" />" + - " </searchnodes>" + - " </row>" + - " </cluster>" + - " </search>" + - "</services>"; - ApplicationPackage app = new VespaModelCreatorWithMockPkg(vespaHosts, services).appPkg; - // sd1 SDDocumentType sdt1=new SDDocumentType("s1"); Search search1 = new Search("s1", null); diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/ProvisionInfo.java b/config-provisioning/src/main/java/com/yahoo/config/provision/ProvisionInfo.java index e903332bd6f..c5ccb7d2f58 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/ProvisionInfo.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/ProvisionInfo.java @@ -23,6 +23,7 @@ public class ProvisionInfo { private static final String hostSpecKey = "hostSpec"; private static final String hostSpecHostName = "hostName"; private static final String hostSpecMembership = "membership"; + private static final String hostSpecFlavor = "flavor"; private static final String dockerImage = "dockerImage"; private final Set<HostSpec> hosts = new LinkedHashSet<>(); @@ -50,29 +51,33 @@ public class ProvisionInfo { if (host.membership().get().cluster().dockerImage().isPresent()) cursor.setString(dockerImage, host.membership().get().cluster().dockerImage().get()); } + if (host.flavor().isPresent()) + cursor.setString(hostSpecFlavor, host.flavor().get().name()); } public Set<HostSpec> getHosts() { return Collections.unmodifiableSet(hosts); } - private static ProvisionInfo fromSlime(Inspector inspector) { + private static ProvisionInfo fromSlime(Inspector inspector, Optional<NodeFlavors> nodeFlavors) { Inspector array = inspector.field(mappingKey); final Set<HostSpec> hosts = new LinkedHashSet<>(); array.traverse(new ArrayTraverser() { @Override public void entry(int i, Inspector inspector) { - hosts.add(createHostSpec(inspector.field(hostSpecKey))); + hosts.add(createHostSpec(inspector.field(hostSpecKey), nodeFlavors)); } }); return new ProvisionInfo(hosts); } - private static HostSpec createHostSpec(Inspector object) { + private static HostSpec createHostSpec(Inspector object, Optional<NodeFlavors> nodeFlavors) { Optional<ClusterMembership> membership = - object.field(hostSpecMembership).valid() ? Optional.of(readMembership(object)) : Optional.empty(); - HostSpec h = new HostSpec(object.field(hostSpecHostName).asString(), Collections.emptyList(), Optional.empty(), membership); - return h; + object.field(hostSpecMembership).valid() ? Optional.of(readMembership(object)) : Optional.empty(); + Optional<Flavor> flavor = + object.field(hostSpecFlavor).valid() ? readFlavor(object, nodeFlavors) : Optional.empty(); + + return new HostSpec(object.field(hostSpecHostName).asString(),Collections.emptyList(), flavor, membership); } private static ClusterMembership readMembership(Inspector object) { @@ -80,14 +85,19 @@ public class ProvisionInfo { object.field(dockerImage).valid() ? Optional.of(object.field(dockerImage).asString()) : Optional.empty()); } + private static Optional<Flavor> readFlavor(Inspector object, Optional<NodeFlavors> nodeFlavors) { + return nodeFlavors.map(flavorMapper -> flavorMapper.getFlavor(object.field(hostSpecFlavor).asString())) + .orElse(Optional.empty()); + } + public byte[] toJson() throws IOException { Slime slime = new Slime(); toSlime(slime.setObject()); return SlimeUtils.toJsonBytes(slime); } - public static ProvisionInfo fromJson(byte[] json) { - return fromSlime(SlimeUtils.jsonToSlime(json).get()); + public static ProvisionInfo fromJson(byte[] json, Optional<NodeFlavors> nodeFlavors) { + return fromSlime(SlimeUtils.jsonToSlime(json).get(), nodeFlavors); } public ProvisionInfo merge(ProvisionInfo provisionInfo) { diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/Zone.java b/config-provisioning/src/main/java/com/yahoo/config/provision/Zone.java index 6ff26d0aad7..6559e08d3ed 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/Zone.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/Zone.java @@ -20,11 +20,15 @@ public class Zone { private final RegionName region; private final SystemName systemName; private final FlavorDefaults flavorDefaults; + private final Optional<NodeFlavors> nodeFlavors; @Inject - public Zone(ConfigserverConfig configserverConfig) { - this(SystemName.from(configserverConfig.system()), Environment.from(configserverConfig.environment()), - RegionName.from(configserverConfig.region()), new FlavorDefaults(configserverConfig)); + public Zone(ConfigserverConfig configserverConfig, NodeFlavors nodeFlavors) { + this(SystemName.from(configserverConfig.system()), + Environment.from(configserverConfig.environment()), + RegionName.from(configserverConfig.region()), + new FlavorDefaults(configserverConfig), + nodeFlavors); } /** Create from environment and region */ @@ -39,14 +43,19 @@ public class Zone { /** Create from environment and region. Useful for testing. */ public Zone(SystemName system, Environment environment, RegionName region, String defaultFlavor) { - this(system, environment, region, new FlavorDefaults(defaultFlavor)); + this(system, environment, region, new FlavorDefaults(defaultFlavor), null); } - private Zone(SystemName systemName, Environment environment, RegionName region, FlavorDefaults flavorDefaults) { + private Zone(SystemName systemName, + Environment environment, + RegionName region, + FlavorDefaults flavorDefaults, + NodeFlavors nodeFlavors) { this.environment = environment; this.region = region; this.flavorDefaults = flavorDefaults; this.systemName = systemName; + this.nodeFlavors = Optional.ofNullable(nodeFlavors); } /** Returns the current environment */ @@ -61,6 +70,9 @@ public class Zone { /** Returns the default hardware flavor to assign in this zone */ public String defaultFlavor(ClusterSpec.Type clusterType) { return flavorDefaults.flavor(clusterType); } + /** Returns all available node flavors for the zone, or empty if not set for this Zone. */ + public Optional<NodeFlavors> nodeFlavors() { return nodeFlavors; } + /** Do not use */ public static Zone defaultZone() { return new Zone(SystemName.defaultSystem(), Environment.defaultEnvironment(), RegionName.defaultName()); diff --git a/config-provisioning/src/test/java/com/yahoo/config/provision/ProvisionInfoTest.java b/config-provisioning/src/test/java/com/yahoo/config/provision/ProvisionInfoTest.java index 52b4f6853b8..a6ccdb8536f 100644 --- a/config-provisioning/src/test/java/com/yahoo/config/provision/ProvisionInfoTest.java +++ b/config-provisioning/src/test/java/com/yahoo/config/provision/ProvisionInfoTest.java @@ -49,7 +49,7 @@ public class ProvisionInfoTest { } private void assertProvisionInfo(ProvisionInfo info) throws IOException { - ProvisionInfo serializedInfo = ProvisionInfo.fromJson(info.toJson()); + ProvisionInfo serializedInfo = ProvisionInfo.fromJson(info.toJson(), Optional.empty()); assertEquals(info.getHosts().size(), serializedInfo.getHosts().size()); assertTrue(serializedInfo.getHosts().contains(h1)); assertTrue(serializedInfo.getHosts().contains(h2)); diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java index 1502e01a4b0..07d553f42e3 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java @@ -85,14 +85,14 @@ public class ProxyServer implements Runnable { } static ProxyServer createTestServer(ConfigSourceSet source) { - return createTestServer(source, null, new MemoryCache()); + return createTestServer(source, null, new MemoryCache(), new ConfigProxyStatistics()); } static ProxyServer createTestServer(ConfigSource source, ConfigSourceClient configSourceClient, - MemoryCache memoryCache) + MemoryCache memoryCache, + ConfigProxyStatistics statistics) { - final ConfigProxyStatistics statistics = new ConfigProxyStatistics(); final boolean delayedResponseHandling = false; return new ProxyServer(null, new DelayedResponses(statistics), source, statistics, defaultTimingValues(), delayedResponseHandling, diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ClientUpdaterTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ClientUpdaterTest.java index da691981d01..0abc63d089c 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ClientUpdaterTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ClientUpdaterTest.java @@ -11,8 +11,9 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import static junit.framework.TestCase.assertNull; import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; /** @@ -48,21 +49,21 @@ public class ClientUpdaterTest { clientUpdater.updateSubscribers(fooConfig); // No delayed response, so not returned - assertResponseAndCache(rpcServer, memoryCache, fooConfig, 0, 1); + assertEquals(0, rpcServer.responses); delayedResponses.add(new DelayedResponse(JRTServerConfigRequestV3.createFromRequest(JRTConfigRequestFactory.createFromRaw(fooConfig, -10L).getRequest()))); clientUpdater.updateSubscribers(fooConfig); - assertResponseAndCache(rpcServer, memoryCache, fooConfig, 1, 1); + assertEquals(1, rpcServer.responses); // Will not find bar config in delayed responses RawConfig barConfig = new RawConfig(new ConfigKey<>("bar", "id", "namespace"), fooConfig.getDefMd5()); clientUpdater.updateSubscribers(barConfig); - assertResponseAndCache(rpcServer, memoryCache, barConfig, 1, 2); + assertEquals(1, rpcServer.responses); mode = new Mode(Mode.ModeName.MEMORYCACHE); // Nothing should be returned, so still 1 response - assertResponseAndCache(rpcServer, memoryCache, fooConfig, 1, 2); + assertEquals(1, rpcServer.responses); assertThat(statistics.errors(), is(0L)); } @@ -93,13 +94,5 @@ public class ClientUpdaterTest { assertThat(statistics.errors(), is(1L)); } - private static void assertResponseAndCache(MockRpcServer rpcServer, - MemoryCache memoryCache, - RawConfig expectedConfig, - long expectedResponses, - int cacheSize) { - assertThat(rpcServer.responses, is(expectedResponses)); - assertThat(memoryCache.size(), is(cacheSize)); - assertThat(memoryCache.get(new ConfigCacheKey(expectedConfig.getKey(), expectedConfig.getDefMd5())), is(expectedConfig)); - } + } diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServerTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServerTest.java index 8e96d32329b..db4a0dc357f 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServerTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServerTest.java @@ -22,7 +22,7 @@ public class ConfigProxyRpcServerTest { private static final String hostname = "localhost"; private static final int port = 12345; private static final String address = "tcp/" + hostname + ":" + port; - ProxyServer proxyServer; + private ProxyServer proxyServer; private ConfigProxyRpcServer rpcServer; @Before diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyStatisticsTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyStatisticsTest.java deleted file mode 100644 index a9ce5bf24f2..00000000000 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyStatisticsTest.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.proxy; - -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -/** - * @author hmusum - * @since 5.1.9 - */ -public class ConfigProxyStatisticsTest { - - @Test - public void basic() { - ConfigProxyStatistics statistics = new ConfigProxyStatistics(); - assertThat(statistics.getEventInterval(), is(ConfigProxyStatistics.defaultEventInterval)); - assertThat(statistics.processedRequests(), is(0L)); - assertThat(statistics.errors(), is(0L)); - assertThat(statistics.delayedResponses(), is(0L)); - - statistics.delayedResponses(1); - statistics.incProcessedRequests(); - statistics.incRpcRequests(); - statistics.incErrorCount(); - - assertThat(statistics.processedRequests(), is(1L)); - assertThat(statistics.rpcRequests(), is(1L)); - assertThat(statistics.errors(), is(1L)); - assertThat(statistics.delayedResponses(), is(1L)); - - statistics.decDelayedResponses(); - assertThat(statistics.delayedResponses(), is(0L)); - - - Long eventInterval = 1L; - statistics = new ConfigProxyStatistics(eventInterval); - assertThat(statistics.getEventInterval(), is(eventInterval)); - - Thread t = new Thread(statistics); - t.start(); - - statistics.stop(); - } -} diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/DelayedResponseHandlerTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/DelayedResponseHandlerTest.java index 826a6d58639..ee05e26c37d 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/DelayedResponseHandlerTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/DelayedResponseHandlerTest.java @@ -14,7 +14,7 @@ import static org.junit.Assert.assertThat; */ public class DelayedResponseHandlerTest { - private final MapBackedConfigSource source = new MapBackedConfigSource(new MockClientUpdater(new MemoryCache())); + private final MockConfigSource source = new MockConfigSource(new MockClientUpdater(new MemoryCache())); @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MockConfigSource.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MockConfigSource.java new file mode 100644 index 00000000000..c7f12e671f4 --- /dev/null +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MockConfigSource.java @@ -0,0 +1,39 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.config.proxy; + +import com.yahoo.config.subscription.ConfigSource; +import com.yahoo.vespa.config.ConfigKey; +import com.yahoo.vespa.config.RawConfig; + +import java.util.HashMap; + +/** + * A simple class to be able to test config proxy without having an RPC config + * source. + * + * @author hmusum + * @since 5.1.10 + */ +class MockConfigSource implements ConfigSource { + private final HashMap<ConfigKey<?>, RawConfig> backing = new HashMap<>(); + private final ClientUpdater clientUpdater; + + MockConfigSource(ClientUpdater clientUpdater) { + this.clientUpdater = clientUpdater; + } + + MockConfigSource put(ConfigKey<?> key, RawConfig config) { + backing.put(key, config); + clientUpdater.updateSubscribers(config); + return this; + } + + RawConfig getConfig(ConfigKey<?> key) { + return backing.get(key); + } + + void clear() { + backing.clear(); + } + +} diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MapBackedConfigSource.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MockConfigSourceClient.java index 4863fd24d4e..b47905f5a01 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MapBackedConfigSource.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MockConfigSourceClient.java @@ -1,34 +1,24 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.proxy; -import com.yahoo.config.subscription.ConfigSource; import com.yahoo.vespa.config.ConfigKey; import com.yahoo.vespa.config.RawConfig; import com.yahoo.vespa.config.protocol.JRTServerConfigRequest; import java.util.Collections; -import java.util.HashMap; import java.util.List; /** - * A simple class to be able to test config proxy without having an RPC config - * source. + * Mock client that always returns with config immediately * * @author hmusum - * @since 5.1.10 */ -public class MapBackedConfigSource implements ConfigSource, ConfigSourceClient { - private final HashMap<ConfigKey<?>, RawConfig> backing = new HashMap<>(); +public class MockConfigSourceClient implements ConfigSourceClient{ private final ClientUpdater clientUpdater; + private final MockConfigSource configSource; - MapBackedConfigSource(ClientUpdater clientUpdater) { + MockConfigSourceClient(ClientUpdater clientUpdater, MockConfigSource configSource) { this.clientUpdater = clientUpdater; - } - - MapBackedConfigSource put(ConfigKey<?> key, RawConfig config) { - backing.put(key, config); - clientUpdater.updateSubscribers(config); - return this; + this.configSource = configSource; } @Override @@ -38,23 +28,19 @@ public class MapBackedConfigSource implements ConfigSource, ConfigSourceClient { return config; } - RawConfig getConfig(ConfigKey<?> configKey) { - return backing.get(configKey); + private RawConfig getConfig(ConfigKey<?> configKey) { + return configSource.getConfig(configKey); } @Override public void cancel() { - clear(); + configSource.clear(); } @Override public void shutdownSourceConnections() { } - void clear() { - backing.clear(); - } - @Override public String getActiveSourceConnection() { return "N/A"; diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java index f148e4951e1..ed646f0b6d6 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ProxyServerTest.java @@ -4,6 +4,7 @@ package com.yahoo.vespa.config.proxy; import com.yahoo.config.subscription.ConfigSourceSet; import com.yahoo.vespa.config.*; import com.yahoo.vespa.config.protocol.JRTServerConfigRequest; +import com.yahoo.vespa.config.protocol.Payload; import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -22,8 +23,11 @@ import static org.junit.Assert.*; public class ProxyServerTest { private final MemoryCache memoryCache = new MemoryCache(); - private final MapBackedConfigSource source = new MapBackedConfigSource(new MockClientUpdater(memoryCache)); - private ProxyServer proxy = ProxyServer.createTestServer(source, source, memoryCache); + private MockClientUpdater clientUpdater = new MockClientUpdater(memoryCache); + private final MockConfigSource source = new MockConfigSource(clientUpdater); + private MockConfigSourceClient client = new MockConfigSourceClient(clientUpdater, source); + private final ConfigProxyStatistics statistics = new ConfigProxyStatistics(); + private ProxyServer proxy; static final RawConfig fooConfig = Helper.fooConfig; @@ -41,7 +45,7 @@ public class ProxyServerTest { source.clear(); source.put(fooConfig.getKey(), createConfigWithNextConfigGeneration(fooConfig, 0)); source.put(errorConfigKey, createConfigWithNextConfigGeneration(fooConfig, ErrorCode.UNKNOWN_DEFINITION)); - proxy = ProxyServer.createTestServer(source, source, memoryCache); + proxy = ProxyServer.createTestServer(source, client, memoryCache, statistics); } @After @@ -54,6 +58,36 @@ public class ProxyServerTest { assertTrue(proxy.getMode().isDefault()); assertThat(proxy.getMemoryCache().size(), is(0)); assertThat(proxy.getTimingValues(), is(ProxyServer.defaultTimingValues())); + + ConfigTester tester = new ConfigTester(); + final MemoryCache memoryCache = proxy.getMemoryCache(); + assertEquals(0, memoryCache.size()); + RawConfig res = proxy.resolveConfig(tester.createRequest(fooConfig)); + assertNotNull(res); + assertThat(res.getPayload().toString(), is(Helper.fooPayload.toString())); + assertEquals(1, memoryCache.size()); + assertThat(memoryCache.get(new ConfigCacheKey(fooConfig.getKey(), fooConfig.getDefMd5())), is(res)); + + + assertEquals(1, statistics.processedRequests()); + assertEquals(0, statistics.rpcRequests()); + assertEquals(0, statistics.errors()); + assertEquals(0, statistics.delayedResponses()); + + statistics.incProcessedRequests(); + statistics.incRpcRequests(); + statistics.incErrorCount(); + statistics.delayedResponses(1); + + assertEquals(2, statistics.processedRequests()); + assertEquals(1, statistics.rpcRequests()); + assertEquals(1, statistics.errors()); + assertEquals(1, statistics.delayedResponses()); + + statistics.decDelayedResponses(); + assertEquals(0, statistics.delayedResponses()); + + assertEquals(ConfigProxyStatistics.defaultEventInterval, statistics.getEventInterval().longValue()); } /** @@ -157,6 +191,25 @@ public class ProxyServerTest { } @Test + public void testReconfigurationAsClient() { + long generation = 1; + RawConfig fooConfig = Helper.fooConfig; + source.put(fooConfig.getKey(), fooConfig); + + clientUpdater.waitForConfigGeneration(fooConfig.getKey(), generation); + assertThat(clientUpdater.getLastConfig(), is(fooConfig)); + + // Update payload in config + generation++; + final ConfigPayload payload = Helper.createConfigPayload("bar", "value2"); + RawConfig fooConfig2 = createConfigWithNextConfigGeneration(fooConfig, 0, Payload.from(payload)); + source.put(fooConfig2.getKey(), fooConfig2); + + clientUpdater.waitForConfigGeneration(fooConfig2.getKey(), generation); + assertFalse(clientUpdater.getLastConfig().equals(fooConfig)); + } + + @Test public void testReadingSystemProperties() { ProxyServer.Properties properties = ProxyServer.getSystemProperties(); assertThat(properties.eventInterval, is(ConfigProxyStatistics.defaultEventInterval)); @@ -165,9 +218,13 @@ public class ProxyServerTest { } static RawConfig createConfigWithNextConfigGeneration(RawConfig config, int errorCode) { + return createConfigWithNextConfigGeneration(config, errorCode, config.getPayload()); + } + + static RawConfig createConfigWithNextConfigGeneration(RawConfig config, int errorCode, Payload payload) { return new RawConfig(config.getKey(), config.getDefMd5(), - config.getPayload(), config.getConfigMd5(), - config.getGeneration() + 1, errorCode, config.getDefContent(), Optional.empty()); + payload, config.getConfigMd5(), + config.getGeneration() + 1, errorCode, config.getDefContent(), Optional.empty()); } } diff --git a/config/src/apps/configproxy-cmd/main.cpp b/config/src/apps/configproxy-cmd/main.cpp index 3a8cf33c343..fcf2a0ca5d7 100644 --- a/config/src/apps/configproxy-cmd/main.cpp +++ b/config/src/apps/configproxy-cmd/main.cpp @@ -11,7 +11,7 @@ class Application : public FastOS_Application bool parseOpts(); public: void usage(void); - int Main(void); + int Main(void) override; Application() : _flags() {} }; diff --git a/config/src/apps/getvespaconfig/getconfig.cpp b/config/src/apps/getvespaconfig/getconfig.cpp index 820e0f7178e..23127b79333 100644 --- a/config/src/apps/getvespaconfig/getconfig.cpp +++ b/config/src/apps/getvespaconfig/getconfig.cpp @@ -32,7 +32,7 @@ public: int usage(); void initRPC(const char *spec); void finiRPC(); - virtual int Main(); + virtual int Main() override; }; diff --git a/config/src/apps/pingproxy/pingproxy.cpp b/config/src/apps/pingproxy/pingproxy.cpp index db790820e64..667d5689691 100644 --- a/config/src/apps/pingproxy/pingproxy.cpp +++ b/config/src/apps/pingproxy/pingproxy.cpp @@ -24,7 +24,7 @@ public: int usage(); void initRPC(const char *spec); void finiRPC(); - virtual int Main(); + virtual int Main() override; }; diff --git a/config/src/tests/configagent/configagent.cpp b/config/src/tests/configagent/configagent.cpp index 73394d443a4..91b657b42f2 100644 --- a/config/src/tests/configagent/configagent.cpp +++ b/config/src/tests/configagent/configagent.cpp @@ -19,22 +19,22 @@ public: : _key(key) { } - const ConfigKey & getKey() const + const ConfigKey & getKey() const override { return _key; } - bool abort() + bool abort() override { return false; } - bool isAborted() const + bool isAborted() const override { return false; } - void setError(int errorCode) + void setError(int errorCode) override { (void) errorCode; } @@ -57,52 +57,52 @@ public: _isError(iserror) { } - const ConfigKey& getKey() const + const ConfigKey& getKey() const override { return _key; } - const ConfigValue & getValue() const + const ConfigValue & getValue() const override { return _value; } - const ConfigState & getConfigState() const + const ConfigState & getConfigState() const override { return _state; } - bool hasValidResponse() const + bool hasValidResponse() const override { return _valid; } - bool validateResponse() + bool validateResponse() override { return _valid; } - void fill() + void fill() override { _fillCalled = true; } - vespalib::string errorMessage() const + vespalib::string errorMessage() const override { return _errorMessage; } - int errorCode() const + int errorCode() const override { return _errorCode; } - bool isError() const + bool isError() const override { return _isError; } - const Trace & getTrace() const { return _trace; } + const Trace & getTrace() const override { return _trace; } const ConfigKey _key; const ConfigValue _value; @@ -145,24 +145,24 @@ public: { } - std::unique_ptr<ConfigUpdate> provide() + std::unique_ptr<ConfigUpdate> provide() override { return std::move(_update); } - bool wait(uint64_t timeout) + bool wait(uint64_t timeout) override { (void) timeout; return true; } - void handle(std::unique_ptr<ConfigUpdate> update) + void handle(std::unique_ptr<ConfigUpdate> update) override { _update = std::move(update); } - bool poll() { return true; } - void interrupt() { } + bool poll() override { return true; } + void interrupt() override { } private: std::unique_ptr<ConfigUpdate> _update; }; diff --git a/config/src/tests/configmanager/configmanager.cpp b/config/src/tests/configmanager/configmanager.cpp index 1b20458b47e..427be97753b 100644 --- a/config/src/tests/configmanager/configmanager.cpp +++ b/config/src/tests/configmanager/configmanager.cpp @@ -36,19 +36,19 @@ namespace { { public: MySource(TestContext * data, const IConfigHolder::SP & holder) : _holder(holder), _data(data) { } - void getConfig() + void getConfig() override { _data->numGetConfig++; if (_data->respond) { _holder->handle(ConfigUpdate::UP(new ConfigUpdate(ConfigValue(), true, _data->generation))); } } - void reload(int64_t generation) + void reload(int64_t generation) override { _data->numUpdate++; _data->generation = generation; } - void close() + void close() override { _data->numClose++; } @@ -60,7 +60,7 @@ namespace { { public: MySourceFactory(TestContext * d) : data(d) { } - Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const + Source::UP createSource(const IConfigHolder::SP & holder, const ConfigKey & key) const override { (void) key; return Source::UP(new MySource(data, holder)); @@ -77,7 +77,7 @@ namespace { { } SourceSpecKey createKey() const { return SourceSpecKey(_key); } - SourceFactory::UP createSourceFactory(const TimingValues & timingValues) const { + SourceFactory::UP createSourceFactory(const TimingValues & timingValues) const override { (void) timingValues; return SourceFactory::UP(new MySourceFactory(_data)); } diff --git a/config/src/tests/configretriever/configretriever.cpp b/config/src/tests/configretriever/configretriever.cpp index 9b191512e0e..bb4dda0e10e 100644 --- a/config/src/tests/configretriever/configretriever.cpp +++ b/config/src/tests/configretriever/configretriever.cpp @@ -106,9 +106,9 @@ struct SimpleSetup struct MySource : public Source { - void getConfig() { } - void close() { } - void reload(int64_t gen) { (void) gen; } + void getConfig() override { } + void close() override { } + void reload(int64_t gen) override { (void) gen; } }; struct SubscriptionFixture @@ -130,7 +130,7 @@ namespace { class FixedPayload : public protocol::Payload { public: - const Inspector & getSlimePayload() const + const Inspector & getSlimePayload() const override { return _data.get(); } diff --git a/config/src/tests/frt/frt.cpp b/config/src/tests/frt/frt.cpp index 89cf9dd9e6a..26f95df8f42 100644 --- a/config/src/tests/frt/frt.cpp +++ b/config/src/tests/frt/frt.cpp @@ -42,11 +42,11 @@ namespace { : update(), notified(false) { } - ConfigUpdate::UP provide() { return ConfigUpdate::UP(); } - void handle(ConfigUpdate::UP u) { update = std::move(u); } + ConfigUpdate::UP provide() override { return ConfigUpdate::UP(); } + void handle(ConfigUpdate::UP u) override { update = std::move(u); } bool wait(int timeoutInMillis) { (void) timeoutInMillis; return notified; } - bool poll() { return notified; } - void interrupt() { } + bool poll() override { return notified; } + void interrupt() override { } bool waitUntilResponse(int timeoutInMillis) { @@ -118,7 +118,7 @@ namespace { { bool aborted; MyAbortHandler() : aborted(false) { } - bool HandleAbort() { aborted = true; return true; } + bool HandleAbort() override { aborted = true; return true; } }; struct ConnectionMock : public Connection { @@ -130,9 +130,9 @@ namespace { vespalib::string address; ConnectionMock(FRT_RPCRequest * answer = NULL); ~ConnectionMock(); - FRT_RPCRequest * allocRPCRequest() { return supervisor.AllocRPCRequest(); } - void setError(int ec) { errorCode = ec; } - void invoke(FRT_RPCRequest * req, double t, FRT_IRequestWait * waiter) + FRT_RPCRequest * allocRPCRequest() override { return supervisor.AllocRPCRequest(); } + void setError(int ec) override { errorCode = ec; } + void invoke(FRT_RPCRequest * req, double t, FRT_IRequestWait * waiter) override { timeout = static_cast<int>(t); if (ans != NULL) @@ -140,8 +140,8 @@ namespace { else waiter->RequestDone(req); } - const vespalib::string & getAddress() const { return address; } - void setTransientDelay(int64_t delay) { (void) delay; } + const vespalib::string & getAddress() const override { return address; } + void setTransientDelay(int64_t delay) override { (void) delay; } }; ConnectionMock::ConnectionMock(FRT_RPCRequest * answer) @@ -156,11 +156,11 @@ namespace { struct FactoryMock : public ConnectionFactory { ConnectionMock * current; FactoryMock(ConnectionMock * c) : current(c) { } - Connection * getCurrent() { + Connection * getCurrent() override { return current; } - FNET_Scheduler * getScheduler() { return ¤t->scheduler; } - void syncTransport() { } + FNET_Scheduler * getScheduler() override { return ¤t->scheduler; } + void syncTransport() override { } }; @@ -187,10 +187,10 @@ namespace { { } - const ConfigState & getConfigState() const { return result->state; } - uint64_t getWaitTime () const { return result->waitTime; } - uint64_t getTimeout() const { return result->timeout; } - void handleResponse(const ConfigRequest & request, ConfigResponse::UP response) + const ConfigState & getConfigState() const override { return result->state; } + uint64_t getWaitTime () const override { return result->waitTime; } + uint64_t getTimeout() const override { return result->timeout; } + void handleResponse(const ConfigRequest & request, ConfigResponse::UP response) override { (void) request; (void) response; diff --git a/config/src/tests/frtconnectionpool/frtconnectionpool.cpp b/config/src/tests/frtconnectionpool/frtconnectionpool.cpp index 93163065eae..96dad86a54d 100644 --- a/config/src/tests/frtconnectionpool/frtconnectionpool.cpp +++ b/config/src/tests/frtconnectionpool/frtconnectionpool.cpp @@ -15,7 +15,7 @@ private: static ServerSpec::HostSpecList _sources; void verifyAllSourcesInRotation(FRTConnectionPool& sourcePool); public: - int Main(); + int Main() override; void testBasicRoundRobin(); void testBasicHashBasedSelection(); void testSetErrorRoundRobin(); diff --git a/config/src/tests/legacysubscriber/legacysubscriber.cpp b/config/src/tests/legacysubscriber/legacysubscriber.cpp index feae0a1d1a4..86ea70ead4f 100644 --- a/config/src/tests/legacysubscriber/legacysubscriber.cpp +++ b/config/src/tests/legacysubscriber/legacysubscriber.cpp @@ -14,7 +14,7 @@ class MyCallback : public IFetcherCallback<ConfigType> { public: MyCallback() : _config(), _configured(false) { } - void configure(std::unique_ptr<ConfigType> config) + void configure(std::unique_ptr<ConfigType> config) override { _configured = true; _config = std::move(config); diff --git a/config/src/tests/subscriber/subscriber.cpp b/config/src/tests/subscriber/subscriber.cpp index 0d5d2698b42..fa6dfcca01f 100644 --- a/config/src/tests/subscriber/subscriber.cpp +++ b/config/src/tests/subscriber/subscriber.cpp @@ -57,9 +57,9 @@ namespace { class MySource : public Source { - void getConfig() { } - void close() { } - void reload(int64_t gen) { (void) gen; } + void getConfig() override { } + void close() override { } + void reload(int64_t gen) override { (void) gen; } }; class MyManager : public IConfigManager @@ -77,7 +77,7 @@ namespace { MyManager() : idCounter(0), numCancel(0) { } - ConfigSubscription::SP subscribe(const ConfigKey & key, uint64_t timeoutInMillis) { + ConfigSubscription::SP subscribe(const ConfigKey & key, uint64_t timeoutInMillis) override { (void) timeoutInMillis; IConfigHolder::SP holder(new ConfigHolder()); _holders.push_back(holder); @@ -85,7 +85,7 @@ namespace { ConfigSubscription::SP s(new ConfigSubscription(0, key, holder, Source::UP(new MySource()))); return s; } - void unsubscribe(const ConfigSubscription::SP & subscription) { + void unsubscribe(const ConfigSubscription::SP & subscription) override { (void) subscription; numCancel++; } @@ -105,7 +105,7 @@ namespace { _holders[index]->handle(ConfigUpdate::UP(new ConfigUpdate(value, false, generation))); } - void reload(int64_t generation) + void reload(int64_t generation) override { (void) generation; } @@ -126,7 +126,7 @@ namespace { _m(rhs._m) { } - IConfigManager & getManagerInstance() { + IConfigManager & getManagerInstance() override { return _m; } @@ -135,7 +135,7 @@ namespace { return getManagerInstance(); } - void reload() { } + void reload() override { } }; struct StandardFixture { diff --git a/config/src/tests/subscription/subscription.cpp b/config/src/tests/subscription/subscription.cpp index 69cba9707fe..e47f8b11e60 100644 --- a/config/src/tests/subscription/subscription.cpp +++ b/config/src/tests/subscription/subscription.cpp @@ -28,9 +28,9 @@ namespace { : source(src) {} - void getConfig() { source->numGetConfig++; } - void close() { source->numClose++; } - void reload(int64_t gen) { (void) gen; source->numReload++; } + void getConfig() override { source->numGetConfig++; } + void close() override { source->numClose++; } + void reload(int64_t gen) override { (void) gen; source->numReload++; } SourceFixture * source; }; diff --git a/config/src/tests/trace/trace.cpp b/config/src/tests/trace/trace.cpp index 9945acae485..566077d47e1 100644 --- a/config/src/tests/trace/trace.cpp +++ b/config/src/tests/trace/trace.cpp @@ -15,7 +15,7 @@ struct FixedClock : public Clock { FixedClock() : currentTime(0) { } int64_t currentTime; - int64_t currentTimeMillis() const { return currentTime; } + int64_t currentTimeMillis() const override { return currentTime; } }; TEST("that trace can be serialized and deserialized") { diff --git a/config/src/vespa/config/helper/ifetchercallback.h b/config/src/vespa/config/helper/ifetchercallback.h index 19ad4a8984b..9bc6e848827 100644 --- a/config/src/vespa/config/helper/ifetchercallback.h +++ b/config/src/vespa/config/helper/ifetchercallback.h @@ -29,7 +29,7 @@ class IFetcherCallback : public ICallback public: virtual ~IFetcherCallback() { } protected: - virtual void configure(std::unique_ptr<const ConfigInstance> config) { + virtual void configure(std::unique_ptr<const ConfigInstance> config) override { configure(std::unique_ptr<ConfigType>(static_cast<const ConfigType *>(config.release()))); } virtual void configure(std::unique_ptr<ConfigType> config) = 0; diff --git a/config/src/vespa/config/helper/ihandle.h b/config/src/vespa/config/helper/ihandle.h index d84f324487a..f5a4c9dbd2b 100644 --- a/config/src/vespa/config/helper/ihandle.h +++ b/config/src/vespa/config/helper/ihandle.h @@ -23,10 +23,10 @@ public: { } - std::unique_ptr<const ConfigInstance> getConfig() { + std::unique_ptr<const ConfigInstance> getConfig() override { return std::unique_ptr<const ConfigInstance>(_handle->getConfig().release()); } - bool isChanged() { return _handle->isChanged(); } + bool isChanged() override { return _handle->isChanged(); } private: std::unique_ptr<ConfigHandle <ConfigType> > _handle; }; diff --git a/configd/src/tests/messages/messages.cpp b/configd/src/tests/messages/messages.cpp index b2627f66453..46fa229ff29 100644 --- a/configd/src/tests/messages/messages.cpp +++ b/configd/src/tests/messages/messages.cpp @@ -8,7 +8,7 @@ class MessagesTest : public vespalib::TestApp { public: MessagesTest() { } - int Main(); + int Main() override; }; int MessagesTest::Main() diff --git a/configdefinitions/src/vespa/imported-fields.def b/configdefinitions/src/vespa/imported-fields.def index 6ccdb20bb64..ba53985090a 100644 --- a/configdefinitions/src/vespa/imported-fields.def +++ b/configdefinitions/src/vespa/imported-fields.def @@ -10,3 +10,9 @@ attribute[].referencefield string # The name of the target attribute field in the parent document type that is imported into this document type. attribute[].targetfield string +# The data type of the target attribute field. This enum should match the one in attributes.def. +attribute[].datatype enum { STRING, UINT1, UINT2, UINT4, INT8, INT16, INT32, INT64, FLOAT, DOUBLE, PREDICATE, TENSOR, REFERENCE, NONE } default=NONE + +# The collection type of the target attribute field. This enum should match the one in attributes.def. +attribute[].collectiontype enum { SINGLE, ARRAY, WEIGHTEDSET } default=SINGLE + diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java index 9291e6030e2..650958c61dc 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java @@ -5,6 +5,7 @@ import com.google.inject.Inject; import com.yahoo.cloud.config.ConfigserverConfig; import com.yahoo.config.ConfigInstance; import com.yahoo.config.model.api.ConfigDefinitionRepo; +import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.Version; import com.yahoo.config.provision.Zone; import com.yahoo.log.LogLevel; @@ -48,13 +49,13 @@ public class SuperModelRequestHandler implements RequestHandler { * Creates a supermodel controller */ @Inject - public SuperModelRequestHandler(GenerationCounter generationCounter, ConfigDefinitionRepo configDefinitionRepo, - ConfigserverConfig configserverConfig) { + public SuperModelRequestHandler(GenerationCounter generationCounter, ConfigDefinitionRepo configDefinitionRepo, + ConfigserverConfig configserverConfig, NodeFlavors nodeFlavors) { this.generationCounter = generationCounter; this.configDefinitionRepo = configDefinitionRepo; this.masterGeneration = configserverConfig.masterGeneration(); this.responseFactory = ConfigResponseFactoryFactory.createFactory(configserverConfig); - this.zone = new Zone(configserverConfig); + this.zone = new Zone(configserverConfig, nodeFlavors); this.handler = createNewHandler(Collections.emptyMap()); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionHandler.java index 74b4eea2ee0..2816ef9dc1c 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/SessionHandler.java @@ -24,6 +24,7 @@ import java.util.concurrent.Executor; * @since 5.1.14 */ public class SessionHandler extends HttpHandler { + protected final ApplicationRepository applicationRepository; public SessionHandler(Executor executor, AccessLog accessLog, ApplicationRepository applicationRepository) { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSessionFactory.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSessionFactory.java index c44436740be..f87c6525a64 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSessionFactory.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/RemoteSessionFactory.java @@ -37,7 +37,12 @@ public class RemoteSessionFactory { public RemoteSession createSession(long sessionId) { Path sessionPath = sessionDirPath.append(String.valueOf(sessionId)); - SessionZooKeeperClient sessionZKClient = new SessionZooKeeperClient(curator, configCurator, sessionPath, defRepo, configserverConfig.serverId()); + SessionZooKeeperClient sessionZKClient = new SessionZooKeeperClient(curator, + configCurator, + sessionPath, + defRepo, + configserverConfig.serverId(), + componentRegistry.getZone().nodeFlavors()); return new RemoteSession(tenant, sessionId, componentRegistry, sessionZKClient); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java index 461019439e0..729472051fd 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java @@ -6,6 +6,7 @@ import com.yahoo.config.application.api.ApplicationPackage; import com.yahoo.config.application.api.DeployLogger; import com.yahoo.config.model.application.provider.*; import com.yahoo.config.model.api.ConfigDefinitionRepo; +import com.yahoo.config.provision.NodeFlavors; import com.yahoo.io.IOUtils; import com.yahoo.log.LogLevel; import com.yahoo.path.Path; @@ -22,6 +23,7 @@ import com.yahoo.vespa.curator.Curator; import java.io.File; import java.util.List; +import java.util.Optional; import java.util.concurrent.TimeUnit; import java.util.logging.Logger; @@ -49,6 +51,7 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader { private final ConfigDefinitionRepo defRepo; private final TenantName tenant; private final String serverId; + private final Optional<NodeFlavors> nodeFlavors; public SessionFactoryImpl(GlobalComponentRegistry globalComponentRegistry, SessionCounter sessionCounter, @@ -67,6 +70,7 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader { this.superModelGenerationCounter = globalComponentRegistry.getSuperModelGenerationCounter(); this.defRepo = globalComponentRegistry.getConfigDefinitionRepo(); this.serverId = globalComponentRegistry.getConfigserverConfig().serverId(); + this.nodeFlavors = globalComponentRegistry.getZone().nodeFlavors(); } @Override @@ -131,7 +135,12 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader { log.log(LogLevel.DEBUG, Tenants.logPre(tenant) + "Next session id is " + sessionId + " , sessionIdPath=" + sessionIdPath.getAbsolute()); try { ensureZKPathDoesNotExist(sessionIdPath); - SessionZooKeeperClient sessionZooKeeperClient = new SessionZooKeeperClient(curator, configCurator, sessionIdPath, defRepo, serverId); + SessionZooKeeperClient sessionZooKeeperClient = new SessionZooKeeperClient(curator, + configCurator, + sessionIdPath, + defRepo, + serverId, + nodeFlavors); File userApplicationDir = tenantFileSystemDirs.getUserApplicationDir(sessionId); IOUtils.copyDirectory(applicationFile, userApplicationDir); ApplicationPackage applicationPackage = createApplication(applicationFile, userApplicationDir, applicationName, sessionId, currentlyActiveSession); @@ -155,7 +164,12 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader { File sessionDir = getSessionAppDir(sessionId); ApplicationPackage applicationPackage = FilesApplicationPackage.fromFile(sessionDir); Path sessionIdPath = sessionsPath.append(String.valueOf(sessionId)); - SessionZooKeeperClient sessionZKClient = new SessionZooKeeperClient(curator, configCurator, sessionIdPath, defRepo, serverId); + SessionZooKeeperClient sessionZKClient = new SessionZooKeeperClient(curator, + configCurator, + sessionIdPath, + defRepo, + serverId, + nodeFlavors); SessionContext context = new SessionContext(applicationPackage, sessionZKClient, sessionDir, applicationRepo, hostRegistry, superModelGenerationCounter); return new LocalSession(tenant, sessionId, sessionPreparer, context); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClient.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClient.java index 9fbd8d539fb..dd74270c817 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClient.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClient.java @@ -5,6 +5,7 @@ import com.yahoo.component.Version; import com.yahoo.component.Vtag; import com.yahoo.config.application.api.ApplicationPackage; import com.yahoo.config.application.api.DeployLogger; +import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.ProvisionInfo; import com.yahoo.config.provision.TenantName; import com.yahoo.transaction.Transaction; @@ -23,6 +24,7 @@ import com.yahoo.vespa.curator.transaction.CuratorOperations; import com.yahoo.vespa.curator.transaction.CuratorTransaction; import com.yahoo.vespa.config.server.zookeeper.ConfigCurator; +import java.util.Optional; import java.util.concurrent.TimeUnit; /** @@ -44,17 +46,24 @@ public class SessionZooKeeperClient { private final Path sessionStatusPath; private final String serverId; private final ServerCacheLoader cacheLoader; + private final Optional<NodeFlavors> nodeFlavors; // Only for testing when cache loader does not need cache entries. public SessionZooKeeperClient(Curator curator, Path rootPath) { - this(curator, ConfigCurator.create(curator), rootPath, new StaticConfigDefinitionRepo(), ""); + this(curator, ConfigCurator.create(curator), rootPath, new StaticConfigDefinitionRepo(), "", Optional.empty()); } - public SessionZooKeeperClient(Curator curator, ConfigCurator configCurator, Path rootPath, ConfigDefinitionRepo definitionRepo, String serverId) { + public SessionZooKeeperClient(Curator curator, + ConfigCurator configCurator, + Path rootPath, + ConfigDefinitionRepo definitionRepo, + String serverId, + Optional<NodeFlavors> nodeFlavors) { this.curator = curator; this.configCurator = configCurator; this.rootPath = rootPath; this.serverId = serverId; + this.nodeFlavors = nodeFlavors; this.sessionStatusPath = rootPath.append(ConfigCurator.SESSIONSTATE_ZK_SUBPATH); this.cacheLoader = new ServerCacheLoader(configCurator, rootPath, definitionRepo); } @@ -133,7 +142,7 @@ public class SessionZooKeeperClient { } public ApplicationPackage loadApplicationPackage() { - return new ZKApplicationPackage(configCurator, rootPath); + return new ZKApplicationPackage(configCurator, rootPath, nodeFlavors); } public ServerCache loadServerCache() { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackage.java b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackage.java index 40f50be2b7f..946e70c715a 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackage.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackage.java @@ -10,6 +10,7 @@ import com.yahoo.config.codegen.DefParser; import com.yahoo.config.application.api.ApplicationFile; import com.yahoo.config.application.api.ApplicationPackage; import com.yahoo.config.model.application.provider.*; +import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.ProvisionInfo; import com.yahoo.config.provision.Version; import com.yahoo.io.IOUtils; @@ -42,33 +43,34 @@ public class ZKApplicationPackage implements ApplicationPackage { public static final String allocatedHostsNode = "allocatedHosts"; private final ApplicationMetaData metaData; - public ZKApplicationPackage(ConfigCurator zk, Path appPath) { + public ZKApplicationPackage(ConfigCurator zk, Path appPath, Optional<NodeFlavors> nodeFlavors) { verifyAppPath(zk, appPath); liveApp = new ZKLiveApp(zk, appPath); metaData = readMetaDataFromLiveApp(liveApp); importFileRegistries(fileRegistryNode); - importProvisionInfos(allocatedHostsNode); + importProvisionInfos(allocatedHostsNode, nodeFlavors); } - private void importProvisionInfos(String allocatedHostsNode) { + private void importProvisionInfos(String allocatedHostsNode, Optional<NodeFlavors> nodeFlavors) { List<String> provisionInfoNodes = liveApp.getChildren(allocatedHostsNode); if (provisionInfoNodes.isEmpty()) { - Optional<ProvisionInfo> provisionInfo = importProvisionInfo(allocatedHostsNode); + Optional<ProvisionInfo> provisionInfo = importProvisionInfo(allocatedHostsNode, nodeFlavors); provisionInfo.ifPresent(info -> provisionInfoMap.put(legacyVersion, info)); } else { provisionInfoNodes.stream() .forEach(versionStr -> { Version version = Version.fromString(versionStr); - Optional<ProvisionInfo> provisionInfo = importProvisionInfo(Joiner.on("/").join(allocatedHostsNode, versionStr)); + Optional<ProvisionInfo> provisionInfo = importProvisionInfo(Joiner.on("/").join(allocatedHostsNode, versionStr), + nodeFlavors); provisionInfo.ifPresent(info -> provisionInfoMap.put(version, info)); }); } } - private Optional<ProvisionInfo> importProvisionInfo(String provisionInfoNode) { + private Optional<ProvisionInfo> importProvisionInfo(String provisionInfoNode, Optional<NodeFlavors> nodeFlavors) { try { if (liveApp.exists(provisionInfoNode)) { - return Optional.of(ProvisionInfo.fromJson(liveApp.getBytes(provisionInfoNode))); + return Optional.of(ProvisionInfo.fromJson(liveApp.getBytes(provisionInfoNode), nodeFlavors)); } else { return Optional.empty(); } diff --git a/configserver/src/test/apps/zkapp/services.xml b/configserver/src/test/apps/zkapp/services.xml index aee18cc450a..9549bc2d063 100644 --- a/configserver/src/test/apps/zkapp/services.xml +++ b/configserver/src/test/apps/zkapp/services.xml @@ -10,51 +10,22 @@ </slobroks> </admin> - <clients version="2.0"> - <gateways protocols="http"> - <gateway hostalias="node1" /> - </gateways> - </clients> + <jdisc version="1.0"> + <documentapi/> + <search/> + <nodes> + <node hostalias="node1"/> + </nodes> + </jdisc> - <search version="2.0"> - <qrservers> - <qrserver hostalias="node1" /> - </qrservers> - <cluster name="music" indexingmode="realtime"> - <searchdefinitions> - <searchdefinition name="music" /> - </searchdefinitions> - <clustercontrollers> - <clustercontroller hostalias="node1" /> - </clustercontrollers> - <topleveldispatchers> - <topleveldispatcher hostalias="node1" /> - </topleveldispatchers> - <row index="0"> - <searchnodes> - <searchnode hostalias="node1" index="0" /> - </searchnodes> - </row> - </cluster> - </search> - - <storage version="3.0"> - <cluster redundancy="1"> -<!-- -Do not reshuffle nodes or change index values - this will cause -massive document redistribution. - -If you want to discontinue use of a node, set it in the 'retired' state, -this will rebalance the documents out of the node. Once node is empty, -you can stop it and delete the reference to it in vespa-services and -vespa-hosts files. ---> - <group index="0" name="mycluster"> - <node hostalias="node1" index="0"/> - </group> - - <fleetcontroller hostalias="node1" /> - </cluster> - </storage> + <content version="1.0"> + <redundancy>1</redundancy> + <documents> + <document name="music" mode="index"/> + </documents> + <nodes> + <node hostalias="node1" distribution-key="0"/> + </nodes> + </content> </services> diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelRequestHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelRequestHandlerTest.java index a2b0b4e7d22..9bf86b4aa0a 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelRequestHandlerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/SuperModelRequestHandlerTest.java @@ -3,7 +3,9 @@ package com.yahoo.vespa.config.server; import com.yahoo.cloud.config.ConfigserverConfig; import com.yahoo.config.model.application.provider.FilesApplicationPackage; +import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.Version; +import com.yahoo.config.provisioning.FlavorsConfig; import com.yahoo.vespa.config.server.application.Application; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.TenantName; @@ -43,7 +45,8 @@ public class SuperModelRequestHandlerTest { counter = new SuperModelGenerationCounter(new MockCurator()); controller = new SuperModelRequestHandler(counter, new TestConfigDefinitionRepo(), - new ConfigserverConfig(new ConfigserverConfig.Builder())); + new ConfigserverConfig(new ConfigserverConfig.Builder()), + emptyNodeFlavors()); } @Test @@ -94,7 +97,8 @@ public class SuperModelRequestHandlerTest { long masterGen = 10; controller = new SuperModelRequestHandler(counter, new TestConfigDefinitionRepo(), - new ConfigserverConfig(new ConfigserverConfig.Builder().masterGeneration(masterGen))); + new ConfigserverConfig(new ConfigserverConfig.Builder().masterGeneration(masterGen)), + emptyNodeFlavors()); long gen = counter.increment(); controller.reloadConfig(tenantA, createApp(tenantA, "foo", 3L, 1)); @@ -127,4 +131,8 @@ public class SuperModelRequestHandlerTest { } } + public static NodeFlavors emptyNodeFlavors() { + return new NodeFlavors(new FlavorsConfig(new FlavorsConfig.Builder())); + } + } diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/TestComponentRegistry.java b/configserver/src/test/java/com/yahoo/vespa/config/server/TestComponentRegistry.java index efd8b2f843b..87f94fc4d1d 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/TestComponentRegistry.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/TestComponentRegistry.java @@ -26,6 +26,8 @@ import com.yahoo.vespa.model.VespaModelFactory; import java.util.Collections; import java.util.Optional; +import static com.yahoo.vespa.config.server.SuperModelRequestHandlerTest.emptyNodeFlavors; + /** * @author lulf * @since 5.1 @@ -141,7 +143,8 @@ public class TestComponentRegistry implements GlobalComponentRegistry { HostProvisionerProvider.empty(); SessionPreparer sessionPreparer = new SessionPreparer(modelFactoryRegistry, fileDistributionFactory, hostProvisionerProvider, permApp, - configserverConfig, defRepo, curator, new Zone(configserverConfig)); + configserverConfig, defRepo, curator, + new Zone(configserverConfig, emptyNodeFlavors())); return new TestComponentRegistry(curator, configCurator.orElse(ConfigCurator.create(curator)), metrics, modelFactoryRegistry, permApp, diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java index 8f1754357b2..df1bb7f4f62 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/rpc/TestWithRpc.java @@ -27,6 +27,7 @@ import java.time.Instant; import java.util.ArrayList; import java.util.List; +import static com.yahoo.vespa.config.server.SuperModelRequestHandlerTest.emptyNodeFlavors; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -84,7 +85,8 @@ public class TestWithRpc { rpcServer = new RpcServer(new ConfigserverConfig(new ConfigserverConfig.Builder().rpcport(port).numthreads(1).maxgetconfigclients(1).hostedVespa(hostedVespa)), new SuperModelRequestHandler(generationCounter, new TestConfigDefinitionRepo(), - new ConfigserverConfig(new ConfigserverConfig.Builder())), + new ConfigserverConfig(new ConfigserverConfig.Builder()), + emptyNodeFlavors()), Metrics.createTestMetrics(), new HostRegistries(), hostLivenessTracker); rpcServer.onTenantCreate(TenantName.from("default"), tenantProvider); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRequestHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRequestHandlerTest.java index fc0dc52dc01..bd8c764353f 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRequestHandlerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/tenant/TenantRequestHandlerTest.java @@ -85,7 +85,10 @@ public class TenantRequestHandlerTest extends TestWithCurator { } private void feedApp(File appDir, long sessionId, ApplicationId appId) throws IOException { - SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, configCurator, new PathProvider(Path.createRoot()).getSessionDir(sessionId), new TestConfigDefinitionRepo(), ""); + SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, configCurator, + new PathProvider(Path.createRoot()).getSessionDir(sessionId), + new TestConfigDefinitionRepo(), + "", Optional.empty()); zkc.writeApplicationId(appId); File app = tempFolder.newFolder(); IOUtils.copyDirectory(appDir, app); @@ -98,7 +101,10 @@ public class TenantRequestHandlerTest extends TestWithCurator { } private ApplicationSet reloadConfig(long id, String application) { - SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, configCurator, new PathProvider(Path.createRoot()).getSessionDir(id), new TestConfigDefinitionRepo(), ""); + SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, configCurator, + new PathProvider(Path.createRoot()).getSessionDir(id), + new TestConfigDefinitionRepo(), + "", Optional.empty()); zkc.writeApplicationId(new ApplicationId.Builder().tenant(tenant).applicationName(application).build()); RemoteSession session = new RemoteSession(tenant, id, componentRegistry, zkc); return session.ensureApplicationLoaded(); @@ -176,7 +182,10 @@ public class TenantRequestHandlerTest extends TestWithCurator { @Test public void testResolveForAppId() { long id = 1l; - SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, configCurator, new PathProvider(Path.createRoot()).getSessionDir(id), new TestConfigDefinitionRepo(), ""); + SessionZooKeeperClient zkc = new SessionZooKeeperClient(curator, configCurator, + new PathProvider(Path.createRoot()).getSessionDir(id), + new TestConfigDefinitionRepo(), + "", Optional.empty()); ApplicationId appId = new ApplicationId.Builder() .tenant(tenant) .applicationName("myapp").instanceName("myinst").build(); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java index 217e2a04f9b..f6b00aa7e88 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/zookeeper/ZKApplicationPackageTest.java @@ -8,13 +8,17 @@ import java.io.File; import java.io.IOException; import java.io.Reader; import java.util.Collections; +import java.util.Optional; import java.util.regex.Pattern; import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.model.deploy.DeployState; +import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.HostSpec; +import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.ProvisionInfo; import com.yahoo.config.provision.Version; +import com.yahoo.config.provisioning.FlavorsConfig; import com.yahoo.path.Path; import com.yahoo.text.Utf8; import com.yahoo.vespa.config.server.TestWithCurator; @@ -27,8 +31,10 @@ import com.yahoo.io.IOUtils; public class ZKApplicationPackageTest extends TestWithCurator { private static final String APP = "src/test/apps/zkapp"; + private static final String TEST_FLAVOR_NAME = "test-flavor"; + private static final Optional<Flavor> TEST_FLAVOR = new MockNodeFlavors().getFlavor(TEST_FLAVOR_NAME); private static final ProvisionInfo provisionInfo = ProvisionInfo.withHosts( - Collections.singleton(new HostSpec("foo.yahoo.com", Collections.emptyList()))); + Collections.singleton(new HostSpec("foo.yahoo.com", Collections.emptyList(), TEST_FLAVOR, Optional.empty()))); @Rule public TemporaryFolder tmpDir = new TemporaryFolder(); @@ -36,7 +42,7 @@ public class ZKApplicationPackageTest extends TestWithCurator { @Test public void testBasicZKFeed() throws IOException { feed(configCurator, new File(APP)); - ZKApplicationPackage zkApp = new ZKApplicationPackage(configCurator, Path.fromString("/0")); + ZKApplicationPackage zkApp = new ZKApplicationPackage(configCurator, Path.fromString("/0"), Optional.of(new MockNodeFlavors())); assertTrue(Pattern.compile(".*<slobroks>.*",Pattern.MULTILINE+Pattern.DOTALL).matcher(IOUtils.readAll(zkApp.getServices())).matches()); assertTrue(Pattern.compile(".*<alias>.*",Pattern.MULTILINE+Pattern.DOTALL).matcher(IOUtils.readAll(zkApp.getHosts())).matches()); assertTrue(Pattern.compile(".*<slobroks>.*",Pattern.MULTILINE+Pattern.DOTALL).matcher(IOUtils.readAll(zkApp.getFile(Path.fromString("services.xml")).createReader())).matches()); @@ -61,6 +67,7 @@ public class ZKApplicationPackageTest extends TestWithCurator { assertTrue(zkApp.getProvisionInfoMap().containsKey(goodVersion)); ProvisionInfo readInfo = zkApp.getProvisionInfoMap().get(goodVersion); assertThat(Utf8.toString(readInfo.toJson()), is(Utf8.toString(provisionInfo.toJson()))); + assertThat(readInfo.getHosts().iterator().next().flavor(), is(TEST_FLAVOR)); assertTrue(zkApp.getDeployment().isPresent()); assertThat(DeploymentSpec.fromXml(zkApp.getDeployment().get()).globalServiceId().get(), is("mydisc")); } @@ -74,4 +81,14 @@ public class ZKApplicationPackageTest extends TestWithCurator { zk.putData("/0/" + ZKApplicationPackage.allocatedHostsNode + "/3.0.0", provisionInfo.toJson()); } + private static class MockNodeFlavors extends NodeFlavors{ + + MockNodeFlavors() { super(flavorsConfig()); } + + private static FlavorsConfig flavorsConfig() { + return new FlavorsConfig(new FlavorsConfig.Builder() + .flavor(new FlavorsConfig.Flavor.Builder().name(TEST_FLAVOR_NAME)) + ); + } + } } diff --git a/configutil/src/apps/configstatus/main.cpp b/configutil/src/apps/configstatus/main.cpp index 1376624b207..f774afa355d 100644 --- a/configutil/src/apps/configstatus/main.cpp +++ b/configutil/src/apps/configstatus/main.cpp @@ -18,7 +18,7 @@ class Application : public FastOS_Application { HostFilter parse_host_set(vespalib::stringref raw_arg) const; public: void usage(void); - int Main(void); + int Main(void) override; Application(); ~Application(); diff --git a/configutil/src/apps/modelinspect/main.cpp b/configutil/src/apps/modelinspect/main.cpp index 9b5c2ccdd09..0aca2499cea 100644 --- a/configutil/src/apps/modelinspect/main.cpp +++ b/configutil/src/apps/modelinspect/main.cpp @@ -19,7 +19,7 @@ class Application : public FastOS_Application vespalib::string getSources(); public: void usage(); - int Main(); + int Main() override; Application(); ~Application(); diff --git a/configutil/src/lib/configstatus.cpp b/configutil/src/lib/configstatus.cpp index 5f15b469d90..174350c5eca 100644 --- a/configutil/src/lib/configstatus.cpp +++ b/configutil/src/lib/configstatus.cpp @@ -42,7 +42,7 @@ struct ComponentTraverser : public vespalib::slime::ObjectTraverser } virtual void - field(const vespalib::Memory &symbol_name, const vespalib::slime::Inspector &inspector) { + field(const vespalib::Memory &symbol_name, const vespalib::slime::Inspector &inspector) override { switch (_state) { case ROOT: _component = symbol_name.make_string(); @@ -87,16 +87,16 @@ public: {} ~MyHttpHandler(); - virtual void handleHeader(const vbench::string &name, const vbench::string &value) { + virtual void handleHeader(const vbench::string &name, const vbench::string &value) override { (void) name; (void) value; } - virtual void handleContent(const vbench::Memory &data) { + virtual void handleContent(const vbench::Memory &data) override { _json += std::string(data.data, data.size); } - virtual void handleFailure(const vbench::string &reason) { + virtual void handleFailure(const vbench::string &reason) override { std::cerr << _configId << ": Failed to fetch json: " << reason << std::endl; _error = reason; } diff --git a/configutil/src/tests/config_status/config_status_test.cpp b/configutil/src/tests/config_status/config_status_test.cpp index ac672b3a367..77fcf1b8da8 100644 --- a/configutil/src/tests/config_status/config_status_test.cpp +++ b/configutil/src/tests/config_status/config_status_test.cpp @@ -18,7 +18,7 @@ private: bool _fail; virtual void onGetRequest(const string &, const string &, - Fast_HTTPConnection &conn) { + Fast_HTTPConnection &conn) override { if (_fail) { conn.Output(conn.GetHTTPVersion().c_str()); conn.Output(" 500 Error\r\n"); diff --git a/configutil/src/tests/model_inspect/model_inspect_test.cpp b/configutil/src/tests/model_inspect/model_inspect_test.cpp index 3273e07653e..be45d4d0d46 100644 --- a/configutil/src/tests/model_inspect/model_inspect_test.cpp +++ b/configutil/src/tests/model_inspect/model_inspect_test.cpp @@ -84,18 +84,18 @@ public: _getIndexOf = false; }; - void yamlDump() { _yamlDump = true; }; - void listHosts() { _listHosts = true; }; - void listServices() { _listServices = true; }; - void listClusters() { _listClusters = true; }; - void listConfigIds() { _listConfigIds = true; }; - int listHost(const vespalib::string) { _listHost = true; return 0; }; - int listAllPorts() { _listAllPorts = true; return 0; }; - int listCluster(const vespalib::string) { _listCluster = true; return 0; }; - int listService(const vespalib::string) { _listService = true; return 0; }; - int listService(const vespalib::string, const vespalib::string) { _listService2 = true; return 0; }; - int listConfigId(const vespalib::string) { _listConfigId = true; return 0; }; - int getIndexOf(const vespalib::string, const vespalib::string) { _getIndexOf = true; return 0; }; + void yamlDump() override { _yamlDump = true; }; + void listHosts() override { _listHosts = true; }; + void listServices() override { _listServices = true; }; + void listClusters() override { _listClusters = true; }; + void listConfigIds() override { _listConfigIds = true; }; + int listHost(const vespalib::string) override { _listHost = true; return 0; }; + int listAllPorts() override { _listAllPorts = true; return 0; }; + int listCluster(const vespalib::string) override { _listCluster = true; return 0; }; + int listService(const vespalib::string) override { _listService = true; return 0; }; + int listService(const vespalib::string, const vespalib::string) override { _listService2 = true; return 0; }; + int listConfigId(const vespalib::string) override { _listConfigId = true; return 0; }; + int getIndexOf(const vespalib::string, const vespalib::string) override { _getIndexOf = true; return 0; }; ~ModelDummy() {}; }; diff --git a/container-disc/src/main/sh/vespa-start-container-daemon.sh b/container-disc/src/main/sh/vespa-start-container-daemon.sh index ec632a9c0c4..dd79e0dd054 100755 --- a/container-disc/src/main/sh/vespa-start-container-daemon.sh +++ b/container-disc/src/main/sh/vespa-start-container-daemon.sh @@ -67,8 +67,8 @@ configure_memory() { # Update jvm_heapsize only if percentage is explicitly set (default is 0). if ((jvm_heapSizeAsPercentageOfPhysicalMemory > 0)); then - if ((TOTAL_MEMORY_MB > 0)); then - available="$TOTAL_MEMORY_MB" + if ((VESPA_TOTAL_MEMORY_MB > 0)); then + available="$VESPA_TOTAL_MEMORY_MB" else available=`free -m | grep Mem | tr -s ' ' | cut -f2 -d' '` fi diff --git a/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java b/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java index eae3b436b6a..ac718c4867b 100644 --- a/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/statistics/StatisticsSearcher.java @@ -63,7 +63,7 @@ public class StatisticsSearcher extends Searcher { private Value maxQueryLatency; // separate to avoid name mangling @SuppressWarnings("unused") // all the work is done by the callback private Value activeQueries; // raw measure every 5 minutes - private Value peakQPS; // peak 10s QPS + private Value peakQPS; // peak 1s QPS private Counter emptyResults; // number of results containing no concrete hits private Value hitsPerQuery; // mean number of hits per query private long prevMaxQPSTime; // previous measurement time of QPS @@ -128,7 +128,7 @@ public class StatisticsSearcher extends Searcher { // but two memory barriers in the common case. Don't change till we know // that is actually better. synchronized (peakQpsLock) { - if ((now - prevMaxQPSTime) >= (10 * 1000)) { + if ((now - prevMaxQPSTime) >= (1000)) { double ms = (double) (now - prevMaxQPSTime); final double peakQPS = queriesForQPS / (ms / 1000); this.peakQPS.put(peakQPS); diff --git a/document/src/tests/arrayfieldvaluetest.cpp b/document/src/tests/arrayfieldvaluetest.cpp index 136129274b5..85659c0cbb4 100644 --- a/document/src/tests/arrayfieldvaluetest.cpp +++ b/document/src/tests/arrayfieldvaluetest.cpp @@ -11,8 +11,8 @@ using vespalib::nbostream; namespace document { struct ArrayFieldValueTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testArray(); diff --git a/document/src/tests/documentcalculatortestcase.cpp b/document/src/tests/documentcalculatortestcase.cpp index 357f6db0cfc..a292302ad61 100644 --- a/document/src/tests/documentcalculatortestcase.cpp +++ b/document/src/tests/documentcalculatortestcase.cpp @@ -19,8 +19,8 @@ class DocumentCalculatorTest : public CppUnit::TestFixture { public: const DocumentTypeRepo &getRepo() { return _testRepo.getTypeRepo(); } - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testConstant(); void testSimple(); diff --git a/document/src/tests/documentselectparsertest.cpp b/document/src/tests/documentselectparsertest.cpp index f8e99e9cd66..8e17dd12e12 100644 --- a/document/src/tests/documentselectparsertest.cpp +++ b/document/src/tests/documentselectparsertest.cpp @@ -65,8 +65,8 @@ public: DocumentSelectParserTest() : _bucketIdFactory() {} - void setUp(); - void tearDown() {} + void setUp() override; + void tearDown() override {} void createDocs(); void testParseTerminals(); @@ -914,29 +914,29 @@ namespace { public: virtual ~TestVisitor() {} - void visitConstant(const select::Constant& node) + void visitConstant(const select::Constant& node) override { data << "CONSTANT(" << node << ")"; } virtual void - visitInvalidConstant(const select::InvalidConstant& node) + visitInvalidConstant(const select::InvalidConstant& node) override { data << "INVALIDCONSTANT(" << node << ")"; } - void visitDocumentType(const select::DocType& node) + void visitDocumentType(const select::DocType& node) override { data << "DOCTYPE(" << node << ")"; } - void visitComparison(const select::Compare& node) + void visitComparison(const select::Compare& node) override { data << "COMPARE(" << node.getLeft() << " " << node.getOperator() << " " << node.getRight() << ")"; } - void visitAndBranch(const select::And& node) + void visitAndBranch(const select::And& node) override { data << "AND("; node.getLeft().visit(*this); @@ -945,7 +945,7 @@ namespace { data << ")"; } - void visitOrBranch(const select::Or& node) + void visitOrBranch(const select::Or& node) override { data << "OR("; node.getLeft().visit(*this); @@ -954,7 +954,7 @@ namespace { data << ")"; } - void visitNotBranch(const select::Not& node) + void visitNotBranch(const select::Not& node) override { data << "NOT("; node.getChild().visit(*this); @@ -962,62 +962,62 @@ namespace { } virtual void - visitArithmeticValueNode(const select::ArithmeticValueNode &) + visitArithmeticValueNode(const select::ArithmeticValueNode &) override { } virtual void - visitFunctionValueNode(const select::FunctionValueNode &) + visitFunctionValueNode(const select::FunctionValueNode &) override { } virtual void - visitIdValueNode(const select::IdValueNode &) + visitIdValueNode(const select::IdValueNode &) override { } virtual void - visitSearchColumnValueNode(const select::SearchColumnValueNode &) + visitSearchColumnValueNode(const select::SearchColumnValueNode &) override { } virtual void - visitFieldValueNode(const select::FieldValueNode &) + visitFieldValueNode(const select::FieldValueNode &) override { } virtual void - visitFloatValueNode(const select::FloatValueNode &) + visitFloatValueNode(const select::FloatValueNode &) override { } virtual void - visitVariableValueNode(const select::VariableValueNode &) + visitVariableValueNode(const select::VariableValueNode &) override { } virtual void - visitIntegerValueNode(const select::IntegerValueNode &) + visitIntegerValueNode(const select::IntegerValueNode &) override { } virtual void - visitCurrentTimeValueNode(const select::CurrentTimeValueNode &) + visitCurrentTimeValueNode(const select::CurrentTimeValueNode &) override { } virtual void - visitStringValueNode(const select::StringValueNode &) + visitStringValueNode(const select::StringValueNode &) override { } virtual void - visitNullValueNode(const select::NullValueNode &) + visitNullValueNode(const select::NullValueNode &) override { } virtual void - visitInvalidValueNode(const select::InvalidValueNode &) + visitInvalidValueNode(const select::InvalidValueNode &) override { } diff --git a/document/src/tests/documenttestcase.cpp b/document/src/tests/documenttestcase.cpp index 8a6cb193aad..d9b188278fd 100644 --- a/document/src/tests/documenttestcase.cpp +++ b/document/src/tests/documenttestcase.cpp @@ -269,7 +269,7 @@ DocumentTest::testVariables() class ModifyIteratorHandler : public FieldValue::IteratorHandler { public: - ModificationStatus doModify(FieldValue& fv) { + ModificationStatus doModify(FieldValue& fv) override { StringFieldValue* sfv = dynamic_cast<StringFieldValue*>(&fv); if (sfv != NULL) { *sfv = std::string("newvalue"); @@ -279,7 +279,7 @@ public: return NOT_MODIFIED; }; - bool onComplex(const Content&) { + bool onComplex(const Content&) override { return false; } }; diff --git a/document/src/tests/documenttypetestcase.cpp b/document/src/tests/documenttypetestcase.cpp index b2aeccdf8de..c7856ff9cf5 100644 --- a/document/src/tests/documenttypetestcase.cpp +++ b/document/src/tests/documenttypetestcase.cpp @@ -16,8 +16,8 @@ using document::config_builder::Map; namespace document { struct DocumentTypeTest : public CppUnit::TestFixture { - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testSetGet(); void testHeaderContent(); diff --git a/document/src/tests/documentupdatetestcase.cpp b/document/src/tests/documentupdatetestcase.cpp index f0784bf2ba7..5ac7c48c7ad 100644 --- a/document/src/tests/documentupdatetestcase.cpp +++ b/document/src/tests/documentupdatetestcase.cpp @@ -33,8 +33,8 @@ using vespalib::tensor::TensorDimensions; namespace document { struct DocumentUpdateTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testSimpleUsage(); void testUpdateApplySingleValue(); diff --git a/document/src/tests/fieldpathupdatetestcase.cpp b/document/src/tests/fieldpathupdatetestcase.cpp index 991c1d6b908..4a23f828921 100644 --- a/document/src/tests/fieldpathupdatetestcase.cpp +++ b/document/src/tests/fieldpathupdatetestcase.cpp @@ -25,8 +25,8 @@ struct FieldPathUpdateTestCase : public CppUnit::TestFixture { DocumentTypeRepo::SP _repo; DocumentType _foobar_type; - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testWhereClause(); void testNoIterateMapValues(); @@ -264,7 +264,7 @@ struct TestFieldPathUpdate : FieldPathUpdate TestIteratorHandler(std::string& str) : _str(str) {} - ModificationStatus doModify(FieldValue& value) + ModificationStatus doModify(FieldValue& value) override { std::ostringstream ss; value.print(ss, false, ""); @@ -275,7 +275,7 @@ struct TestFieldPathUpdate : FieldPathUpdate return NOT_MODIFIED; } - bool onComplex(const Content&) { return false; } + bool onComplex(const Content&) override { return false; } std::string& _str; }; @@ -288,15 +288,15 @@ struct TestFieldPathUpdate : FieldPathUpdate TestFieldPathUpdate(const TestFieldPathUpdate& other); - std::unique_ptr<FieldValue::IteratorHandler> getIteratorHandler(Document&) const + std::unique_ptr<FieldValue::IteratorHandler> getIteratorHandler(Document&) const override { return std::unique_ptr<FieldValue::IteratorHandler>( new TestIteratorHandler(_str)); } - TestFieldPathUpdate* clone() const { return new TestFieldPathUpdate(*this); } + TestFieldPathUpdate* clone() const override { return new TestFieldPathUpdate(*this); } - void print(std::ostream& out, bool, const std::string&) const + void print(std::ostream& out, bool, const std::string&) const override { out << "TestFieldPathUpdate()"; } diff --git a/document/src/tests/primitivefieldvaluetest.cpp b/document/src/tests/primitivefieldvaluetest.cpp index 90e51ec071d..ba81e0ebbf6 100644 --- a/document/src/tests/primitivefieldvaluetest.cpp +++ b/document/src/tests/primitivefieldvaluetest.cpp @@ -11,8 +11,8 @@ using vespalib::nbostream; namespace document { struct PrimitiveFieldValueTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testLiterals(); void testRaw(); diff --git a/document/src/tests/serialization/annotationserializer_test.cpp b/document/src/tests/serialization/annotationserializer_test.cpp index 05a1b1441e0..9be0d6d334e 100644 --- a/document/src/tests/serialization/annotationserializer_test.cpp +++ b/document/src/tests/serialization/annotationserializer_test.cpp @@ -35,7 +35,7 @@ class Test : public vespalib::TestApp { void requireThatUnknownAnnotationIsSkipped(); public: - int Main(); + int Main() override; }; int diff --git a/document/src/tests/struct_anno/struct_anno_test.cpp b/document/src/tests/struct_anno/struct_anno_test.cpp index a6c078698d3..9feb5b8a040 100644 --- a/document/src/tests/struct_anno/struct_anno_test.cpp +++ b/document/src/tests/struct_anno/struct_anno_test.cpp @@ -25,7 +25,7 @@ class Test : public vespalib::TestApp { void requireThatStructFieldsCanContainAnnotations(); public: - int Main(); + int Main() override; }; int Test::Main() { diff --git a/document/src/tests/structfieldvaluetest.cpp b/document/src/tests/structfieldvaluetest.cpp index b1c68662553..0daf8c97302 100644 --- a/document/src/tests/structfieldvaluetest.cpp +++ b/document/src/tests/structfieldvaluetest.cpp @@ -17,8 +17,8 @@ namespace document { struct StructFieldValueTest : public CppUnit::TestFixture { DocumentTypeRepo doc_repo; StructFieldValueTest(); - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testStruct(); void testEmptyStruct(); diff --git a/document/src/tests/testbytebuffer.h b/document/src/tests/testbytebuffer.h index 58962d73449..baeccef979a 100644 --- a/document/src/tests/testbytebuffer.h +++ b/document/src/tests/testbytebuffer.h @@ -25,7 +25,7 @@ public: /** Initialization. */ - void setUp(); + void setUp() override; protected: /** diff --git a/document/src/tests/teststringutil.h b/document/src/tests/teststringutil.h index be25c9667d3..355d90367ed 100644 --- a/document/src/tests/teststringutil.h +++ b/document/src/tests/teststringutil.h @@ -14,7 +14,7 @@ class StringUtil_Test : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - void setUp(); + void setUp() override; protected: void test_escape(); diff --git a/document/src/tests/weightedsetfieldvaluetest.cpp b/document/src/tests/weightedsetfieldvaluetest.cpp index bc1bdca6028..100db297b55 100644 --- a/document/src/tests/weightedsetfieldvaluetest.cpp +++ b/document/src/tests/weightedsetfieldvaluetest.cpp @@ -11,8 +11,8 @@ using vespalib::nbostream; namespace document { struct WeightedSetFieldValueTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testWeightedSet(); void testAddIgnoreZeroWeight(); diff --git a/documentapi/src/tests/messagebus/messagebus_test.cpp b/documentapi/src/tests/messagebus/messagebus_test.cpp index 92668de675a..4e7620dac05 100644 --- a/documentapi/src/tests/messagebus/messagebus_test.cpp +++ b/documentapi/src/tests/messagebus/messagebus_test.cpp @@ -17,7 +17,7 @@ class Test : public vespalib::TestApp { DocumentTypeRepo::SP _repo; public: - int Main(); + int Main() override; private: void testMessage(); diff --git a/documentapi/src/tests/messages/messages50test.h b/documentapi/src/tests/messages/messages50test.h index 515a61e59fc..ec44ab77a4b 100644 --- a/documentapi/src/tests/messages/messages50test.h +++ b/documentapi/src/tests/messages/messages50test.h @@ -5,8 +5,8 @@ class Messages50Test : public TestBase { protected: - const vespalib::Version getVersion() const { return vespalib::Version(5, 0); } - bool shouldTestCoverage() const { return FALSE; } + const vespalib::Version getVersion() const override { return vespalib::Version(5, 0); } + bool shouldTestCoverage() const override { return FALSE; } bool tryDocumentReply(const string &filename, uint32_t type); bool tryVisitorReply(const string &filename, uint32_t type); diff --git a/documentapi/src/tests/messages/messages51test.h b/documentapi/src/tests/messages/messages51test.h index 9cf57a44b29..c7874d26a33 100644 --- a/documentapi/src/tests/messages/messages51test.h +++ b/documentapi/src/tests/messages/messages51test.h @@ -5,8 +5,8 @@ class Messages51Test : public Messages50Test { protected: - const vespalib::Version getVersion() const { return vespalib::Version(5, 1); } - bool shouldTestCoverage() const { return TRUE; } + const vespalib::Version getVersion() const override { return vespalib::Version(5, 1); } + bool shouldTestCoverage() const override { return TRUE; } public: Messages51Test(); diff --git a/documentapi/src/tests/messages/testbase.h b/documentapi/src/tests/messages/testbase.h index 6b802f30066..6c3675bd5f9 100644 --- a/documentapi/src/tests/messages/testbase.h +++ b/documentapi/src/tests/messages/testbase.h @@ -42,7 +42,7 @@ protected: virtual const vespalib::Version getVersion() const = 0; virtual bool shouldTestCoverage() const = 0; TestBase &putTest(uint32_t type, TEST_METHOD_PT test); - int Main(); + int Main() override; public: const document::DocumentTypeRepo &getTypeRepo() { return *_repo; } diff --git a/documentapi/src/tests/policies/policies_test.cpp b/documentapi/src/tests/policies/policies_test.cpp index ba5cc280bce..b1135a30032 100644 --- a/documentapi/src/tests/policies/policies_test.cpp +++ b/documentapi/src/tests/policies/policies_test.cpp @@ -63,7 +63,7 @@ private: mbus::Message::UP newPutDocumentMessage(const string &documentId); public: - int Main(); + int Main() override; void testAND(); void testDocumentRouteSelector(); void testDocumentRouteSelectorIgnore(); diff --git a/documentapi/src/tests/policies/testframe.cpp b/documentapi/src/tests/policies/testframe.cpp index 0c4fd90a5c4..8d5b6585529 100644 --- a/documentapi/src/tests/policies/testframe.cpp +++ b/documentapi/src/tests/policies/testframe.cpp @@ -40,17 +40,17 @@ public: // empty } - bool allocServiceAddress(mbus::RoutingNode &recipient) { + bool allocServiceAddress(mbus::RoutingNode &recipient) override { string hop = recipient.getRoute().getHop(0).toString(); recipient.setServiceAddress(mbus::IServiceAddress::UP(new MyServiceAddress(hop))); return true; } - void freeServiceAddress(mbus::RoutingNode &recipient) { + void freeServiceAddress(mbus::RoutingNode &recipient) override { recipient.setServiceAddress(mbus::IServiceAddress::UP()); } - void send(const mbus::Message &, const std::vector<mbus::RoutingNode*> &nodes) { + void send(const mbus::Message &, const std::vector<mbus::RoutingNode*> &nodes) override { _nodes.insert(_nodes.begin(), nodes.begin(), nodes.end()); } diff --git a/documentapi/src/tests/policies/testframe.h b/documentapi/src/tests/policies/testframe.h index 26039cf951e..e0780733331 100644 --- a/documentapi/src/tests/policies/testframe.h +++ b/documentapi/src/tests/policies/testframe.h @@ -199,7 +199,7 @@ public: documentapi::SystemStateHandle getSystemState(); // Implements IReplyHandler. - void handleReply(mbus::Reply::UP reply); + void handleReply(mbus::Reply::UP reply) override; }; class UIntList : public std::vector<uint32_t> { diff --git a/documentapi/src/tests/policyfactory/policyfactory.cpp b/documentapi/src/tests/policyfactory/policyfactory.cpp index d8db57c9ecb..cba4e6cf70f 100644 --- a/documentapi/src/tests/policyfactory/policyfactory.cpp +++ b/documentapi/src/tests/policyfactory/policyfactory.cpp @@ -23,8 +23,8 @@ private: string _param; public: MyPolicy(const string ¶m); - void select(mbus::RoutingContext &ctx); - void merge(mbus::RoutingContext &ctx); + void select(mbus::RoutingContext &ctx) override; + void merge(mbus::RoutingContext &ctx) override; }; MyPolicy::MyPolicy(const string ¶m) : @@ -48,7 +48,7 @@ MyPolicy::merge(mbus::RoutingContext &ctx) class MyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; mbus::IRoutingPolicy::UP diff --git a/documentapi/src/tests/replymerger/replymerger_test.cpp b/documentapi/src/tests/replymerger/replymerger_test.cpp index 2e1551e8dca..8803994b0cf 100644 --- a/documentapi/src/tests/replymerger/replymerger_test.cpp +++ b/documentapi/src/tests/replymerger/replymerger_test.cpp @@ -19,7 +19,7 @@ class Test : public vespalib::TestApp static void assertReplyErrorsMatch(const mbus::Reply& r, const std::vector<mbus::Error>& errors); public: - int Main(); + int Main() override; void mergingGenericRepliesWithNoErrorsPicksFirstReply(); void mergingSingleReplyWithOneErrorReturnsEmptyReplyWithError(); diff --git a/documentapi/src/tests/routablefactory/routablefactory.cpp b/documentapi/src/tests/routablefactory/routablefactory.cpp index fff7d84a197..620142e803b 100644 --- a/documentapi/src/tests/routablefactory/routablefactory.cpp +++ b/documentapi/src/tests/routablefactory/routablefactory.cpp @@ -40,23 +40,23 @@ public: getTrace().setLevel(9); } - DocumentReply::UP doCreateReply() const { + DocumentReply::UP doCreateReply() const override { return DocumentReply::UP(new MyReply()); } - uint32_t getType() const { + uint32_t getType() const override { return TYPE; } }; class MyMessageFactory : public RoutableFactories51::DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const { + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override { (void)buf; return DocumentMessage::UP(new MyMessage()); } - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const { + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override { (void)msg; (void)buf; return true; @@ -65,12 +65,12 @@ protected: class MyReplyFactory : public RoutableFactories51::DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const { + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override { (void)buf; return DocumentReply::UP(new MyReply()); } - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const { + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override { (void)reply; (void)buf; return true; @@ -109,7 +109,7 @@ protected: void testFactory(TestData &data); public: - int Main(); + int Main() override; }; TEST_APPHOOK(Test); diff --git a/documentapi/src/tests/systemstate/systemstate.cpp b/documentapi/src/tests/systemstate/systemstate.cpp index b8f6c04fa2b..a797f55c625 100644 --- a/documentapi/src/tests/systemstate/systemstate.cpp +++ b/documentapi/src/tests/systemstate/systemstate.cpp @@ -11,7 +11,7 @@ using namespace documentapi; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; void testParser(); void testPathing(); void testState(); diff --git a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h index 59aeb51589e..b35cce81b40 100644 --- a/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h +++ b/documentapi/src/vespa/documentapi/messagebus/documentprotocol.h @@ -305,16 +305,16 @@ public: SystemState &getSystemState() { return *_systemState; } // Implements IProtocol. - const mbus::string &getName() const { return NAME; } + const mbus::string &getName() const override { return NAME; } // Implements IProtocol. - mbus::IRoutingPolicy::UP createPolicy(const mbus::string &name, const mbus::string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const mbus::string &name, const mbus::string ¶m) const override; // Implements IProtocol. - mbus::Blob encode(const vespalib::Version &version, const mbus::Routable &routable) const; + mbus::Blob encode(const vespalib::Version &version, const mbus::Routable &routable) const override; // Implements IProtocol. - mbus::Routable::UP decode(const vespalib::Version &version, mbus::BlobRef data) const; + mbus::Routable::UP decode(const vespalib::Version &version, mbus::BlobRef data) const override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h index 98277cac427..b4adf41ca79 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentmessage.h @@ -57,7 +57,7 @@ public: */ Priority::Value getPriority() const { return _priority; }; - uint8_t priority() const { return (uint8_t)_priority; }; + uint8_t priority() const override { return (uint8_t)_priority; } /** * Sets the priority tag for this message. @@ -83,7 +83,7 @@ public: } // Implements mbus::Message. - const mbus::string& getProtocol() const; + const mbus::string& getProtocol() const override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h index c1e13ccbc16..2850c412807 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentreply.h @@ -42,7 +42,7 @@ public: */ Priority::Value getPriority() const { return _priority; } - uint8_t priority() const { return (uint8_t)_priority; }; + uint8_t priority() const override { return (uint8_t)_priority; } /** * Sets the priority tag for this message. @@ -52,10 +52,10 @@ public: void setPriority(Priority::Value p) { _priority = p; } // Implements mbus::Reply. - const mbus::string& getProtocol() const; + const mbus::string& getProtocol() const override; // Implements mbus::Reply. - uint32_t getType() const { return _type; } + uint32_t getType() const override { return _type; } }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h index cac631a3f1e..ac5e141da23 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/documentsummarymessage.h @@ -10,7 +10,7 @@ class DocumentSummaryMessage : public VisitorMessage, public vdslib::DocumentSummary { protected: // Implements VisitorMessage. - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: /** @@ -32,12 +32,12 @@ public: DocumentSummaryMessage(const vdslib::DocumentSummary &summary); // Overrides VisitorMessage. - uint32_t getApproxSize() const; + uint32_t getApproxSize() const override; // Implements VisitorMessage. - uint32_t getType() const; + uint32_t getType() const override; - string toString() const { return "documentsummarymessage"; } + string toString() const override { return "documentsummarymessage"; } }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h index cbd0d7c35ab..54ce4e8de4c 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/emptybucketsmessage.h @@ -17,7 +17,7 @@ private: std::vector<document::BucketId> _bucketIds; protected: - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: EmptyBucketsMessage(); // must be serialized into @@ -31,9 +31,9 @@ public: void resize(uint32_t size); - uint32_t getType() const; + uint32_t getType() const override; - string toString() const { return "emptybucketsmessage"; } + string toString() const override { return "emptybucketsmessage"; } }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h index b8cf4f72293..c08e36aa3fd 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistmessage.h @@ -12,7 +12,7 @@ private: protected: // Implements DocumentMessage. - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: /** @@ -42,15 +42,15 @@ public: void setBucketId(const document::BucketId& id) { _bucketId = id; } // Overrides DocumentMessage. - bool hasSequenceId() const; + bool hasSequenceId() const override; // Overrides DocumentMessage. - uint64_t getSequenceId() const; + uint64_t getSequenceId() const override; // Implements DocumentMessage. - uint32_t getType() const; + uint32_t getType() const override; - string toString() const { return "getbucketlistmessage"; } + string toString() const override { return "getbucketlistmessage"; } }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h index 3193a525640..a207ef206e4 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketlistreply.h @@ -42,7 +42,7 @@ public: */ const std::vector<BucketInfo> &getBuckets() const { return _buckets; } - string toString() const { return "getbucketlistreply"; } + string toString() const override { return "getbucketlistreply"; } }; std::ostream & operator<<(std::ostream &out, const GetBucketListReply::BucketInfo &info); diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h index b34b7cc476b..ed27ed11212 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatemessage.h @@ -12,7 +12,7 @@ private: protected: // Implements DocumentMessage. - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: /** @@ -42,15 +42,15 @@ public: void setBucketId(document::BucketId bucket) { _bucket = bucket; } // Overrides DocumentMessage. - bool hasSequenceId() const; + bool hasSequenceId() const override; // Overrides DocumentMessage. - uint64_t getSequenceId() const; + uint64_t getSequenceId() const override; // Implements DocumentMessage. - uint32_t getType() const; + uint32_t getType() const override; - string toString() const { return "getbucketstatemessage"; } + string toString() const override { return "getbucketstatemessage"; } }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatereply.h b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatereply.h index ece8e4e69a1..7763adfa4ac 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatereply.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/getbucketstatereply.h @@ -46,7 +46,7 @@ public: */ const std::vector<DocumentState> &getBucketState() const { return _state; } - string toString() const { return "getbucketstatereply"; } + string toString() const override { return "getbucketstatereply"; } }; } // documentapi diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h index 5b116ab81e6..ac78aea6251 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/multioperationmessage.h @@ -25,7 +25,7 @@ private: bool _keepTimeStamps; protected: - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: typedef std::unique_ptr<MultiOperationMessage> UP; @@ -47,15 +47,15 @@ public: void serialize(document::ByteBuffer& buf) const; - uint32_t getApproxSize() const; + uint32_t getApproxSize() const override; - uint32_t getType() const; + uint32_t getType() const override; const document::BucketId& getBucketId() const { return _bucketId; } bool keepTimeStamps() const { return _keepTimeStamps;} void keepTimeStamps(bool b) { _keepTimeStamps = b;} - string toString() const { return "multioperationmessage"; } + string toString() const override { return "multioperationmessage"; } private: void verifyBucketId() const; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h index f216c4c2955..46af0dfb7a4 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/putdocumentmessage.h @@ -75,7 +75,7 @@ public: uint32_t getType() const override; - string toString() const { return "putdocumentmessage"; } + string toString() const override { return "putdocumentmessage"; } }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h index 72c277ba54c..3904cf0f243 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/removedocumentmessage.h @@ -12,7 +12,7 @@ private: protected: // Implements DocumentMessage. - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: /** @@ -48,15 +48,15 @@ public: void setDocumentId(const document::DocumentId& documentId); // Overrides DocumentMessage. - bool hasSequenceId() const; + bool hasSequenceId() const override; // Overrides DocumentMessage. - uint64_t getSequenceId() const; + uint64_t getSequenceId() const override; // Implements DocumentMessage. - uint32_t getType() const; + uint32_t getType() const override; - string toString() const { return "removedocumentmessage"; } + string toString() const override { return "removedocumentmessage"; } }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h b/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h index 8d5bfbae1f8..acaf3357d4d 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/removelocationmessage.h @@ -18,14 +18,14 @@ public: const string& getDocumentSelection() const { return _documentSelection; } - uint32_t getType() const; + uint32_t getType() const override; const document::BucketId& getBucketId() const { return _bucketId; }; - string toString() const { return "removelocationmessage"; } + string toString() const override { return "removelocationmessage"; } protected: - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; private: string _documentSelection; diff --git a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h index e63696cd7ea..43045fd44c6 100644 --- a/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h +++ b/documentapi/src/vespa/documentapi/messagebus/messages/visitor.h @@ -46,7 +46,7 @@ private: uint32_t _maxBucketsPerVisitor; protected: - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: typedef std::unique_ptr<CreateVisitorMessage> UP; @@ -114,12 +114,12 @@ public: uint32_t getMaxBucketsPerVisitor() const { return _maxBucketsPerVisitor; } void setMaxBucketsPerVisitor(uint32_t max) { _maxBucketsPerVisitor = max; } - uint32_t getType() const; + uint32_t getType() const override; void setVisitorDispatcherVersion(uint32_t version) { _version = version; }; uint32_t getVisitorDispatcherVersion() const { return _version; }; - string toString() const { return "createvisitormessage"; } + string toString() const override { return "createvisitormessage"; } }; /** @@ -133,7 +133,7 @@ private: string _instanceId; protected: - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: typedef std::unique_ptr<DestroyVisitorMessage> UP; @@ -145,9 +145,9 @@ public: const string& getInstanceId() const { return _instanceId; } void setInstanceId(const string& id) { _instanceId = id; } - uint32_t getType() const; + uint32_t getType() const override; - string toString() const { return "destroyvisitormessage"; } + string toString() const override { return "destroyvisitormessage"; } }; /** @@ -183,7 +183,7 @@ public: const vdslib::VisitorStatistics& getVisitorStatistics() const { return _visitorStatistics; } void setVisitorStatistics(const vdslib::VisitorStatistics& stats) { _visitorStatistics = stats; } - string toString() const { return "createvisitorreply"; } + string toString() const override { return "createvisitorreply"; } }; /** @@ -200,7 +200,7 @@ private: string _errorMessage; protected: - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: typedef std::unique_ptr<VisitorInfoMessage> UP; @@ -213,9 +213,9 @@ public: const string& getErrorMessage() const { return _errorMessage; } void setErrorMessage(const string& errorMessage) { _errorMessage = errorMessage; }; - uint32_t getType() const; + uint32_t getType() const override; - string toString() const { return "visitorinfomessage"; } + string toString() const override { return "visitorinfomessage"; } }; /** @@ -229,7 +229,7 @@ private: vdslib::Parameters _data; protected: - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: typedef std::unique_ptr<MapVisitorMessage> UP; @@ -239,10 +239,10 @@ public: vdslib::Parameters& getData() { return _data; }; const vdslib::Parameters& getData() const { return _data; }; - uint32_t getApproxSize() const; - uint32_t getType() const; + uint32_t getApproxSize() const override; + uint32_t getType() const override; - string toString() const { return "mapvisitormessage"; } + string toString() const override { return "mapvisitormessage"; } }; /** @@ -280,7 +280,7 @@ private: std::vector<Entry> _documents; protected: - DocumentReply::UP doCreateReply() const; + DocumentReply::UP doCreateReply() const override; public: DocumentListMessage(); @@ -292,9 +292,9 @@ public: std::vector<Entry>& getDocuments() { return _documents; }; const std::vector<Entry>& getDocuments() const { return _documents; }; - uint32_t getType() const; + uint32_t getType() const override; - string toString() const { return "documentlistmessage"; } + string toString() const override { return "documentlistmessage"; } }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h index 740413a4958..0edba2c0872 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/andpolicy.h @@ -35,10 +35,10 @@ public: virtual ~ANDPolicy(); // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context); + virtual void select(mbus::RoutingContext &context) override; // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context); + virtual void merge(mbus::RoutingContext &context) override; private: ANDPolicy(const ANDPolicy &); // hide diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h index 2d13ea59991..2f901ebad2d 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/contentpolicy.h @@ -10,7 +10,7 @@ class ContentPolicy : public StoragePolicy public: ContentPolicy(const string& param); private: - virtual string createConfigId(const string & clusterName) const; + virtual string createConfigId(const string & clusterName) const override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h index 4bddc6a1ecf..678210b1416 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/documentrouteselectorpolicy.h @@ -66,13 +66,13 @@ public: const string &getError() const; // Implements Subscriber. - void configure(std::unique_ptr<messagebus::protocol::DocumentrouteselectorpolicyConfig> cfg); + void configure(std::unique_ptr<messagebus::protocol::DocumentrouteselectorpolicyConfig> cfg) override; // Implements IRoutingPolicy. - void select(mbus::RoutingContext &context); + void select(mbus::RoutingContext &context) override; // Implements IRoutingPolicy. - void merge(mbus::RoutingContext &context); + void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h index 75c697331d3..790e0ab923c 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/errorpolicy.h @@ -24,10 +24,10 @@ public: ErrorPolicy(const string &msg); // Implements IRoutingPolicy. - void select(mbus::RoutingContext &context); + void select(mbus::RoutingContext &context) override; // Implements IRoutingPolicy. - void merge(mbus::RoutingContext &context); + void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h index 629c3c861b8..d1e01cdbe59 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externpolicy.h @@ -76,10 +76,10 @@ public: slobrok::api::IMirrorAPI &getMirror() { return *_mirror; } // Overrides IRoutingPolicy. - void select(mbus::RoutingContext &ctx); + void select(mbus::RoutingContext &ctx) override; // Overrides IRoutingPolicy. - void merge(mbus::RoutingContext &ctx); + void merge(mbus::RoutingContext &ctx) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h index 3686c5b6ca9..6a2a673807f 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/externslobrokpolicy.h @@ -42,7 +42,7 @@ public: /** * Initializes the policy */ - virtual string init(); + virtual string init() override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h index b782abbef27..0541b784b1f 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/loadbalancerpolicy.h @@ -11,7 +11,7 @@ class LoadBalancerPolicy : public ExternSlobrokPolicy public: LoadBalancerPolicy(const string& param); - virtual void doSelect(mbus::RoutingContext &context); + virtual void doSelect(mbus::RoutingContext &context) override; /** Finds the TCP address of the target docproc. @@ -22,7 +22,7 @@ public: return _loadBalancer->getRecipient(lookup(context, _pattern)); } - virtual void merge(mbus::RoutingContext &context); + virtual void merge(mbus::RoutingContext &context) override; private: string _pattern; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h index 49b8d195740..af63403a8b1 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/localservicepolicy.h @@ -83,10 +83,10 @@ public: virtual ~LocalServicePolicy(); // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context); + virtual void select(mbus::RoutingContext &context) override; // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context); + virtual void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h index aee4e1bc071..d29439db50c 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/messagetypepolicy.h @@ -45,13 +45,13 @@ public: MessageTypePolicy(const config::ConfigUri & configUri); // Implements Subscriber. - void configure(std::unique_ptr<vespa::config::content::MessagetyperouteselectorpolicyConfig> cfg); + void configure(std::unique_ptr<vespa::config::content::MessagetyperouteselectorpolicyConfig> cfg) override; // Implements IRoutingPolicy. - void select(mbus::RoutingContext &context); + void select(mbus::RoutingContext &context) override; // Implements IRoutingPolicy. - void merge(mbus::RoutingContext &context); + void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h index 7bd839f762c..3a3a22090f9 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/roundrobinpolicy.h @@ -70,10 +70,10 @@ public: virtual ~RoundRobinPolicy(); // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context); + virtual void select(mbus::RoutingContext &context) override; // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context); + virtual void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h index 1b786a10696..ef6478e368a 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/storagepolicy.h @@ -42,10 +42,10 @@ public: virtual ~StoragePolicy(); // Inherit doc from IRoutingPolicy. - virtual void doSelect(mbus::RoutingContext &context); + virtual void doSelect(mbus::RoutingContext &context) override; // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context); + virtual void merge(mbus::RoutingContext &context) override; void updateStateFromReply(WrongDistributionReply& reply); @@ -57,7 +57,7 @@ public: virtual void configure(std::unique_ptr<storage::lib::Distribution::DistributionConfig> config); - string init(); + string init() override; private: virtual string createConfigId(const string & clusterName) const; diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h b/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h index 03f5165eed3..49724785361 100644 --- a/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h +++ b/documentapi/src/vespa/documentapi/messagebus/policies/subsetservicepolicy.h @@ -74,10 +74,10 @@ public: virtual ~SubsetServicePolicy(); // Inherit doc from IRoutingPolicy. - virtual void select(mbus::RoutingContext &context); + virtual void select(mbus::RoutingContext &context) override; // Inherit doc from IRoutingPolicy. - virtual void merge(mbus::RoutingContext &context); + virtual void merge(mbus::RoutingContext &context) override; }; } diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h index 6e164ec6286..aed43b8b2e5 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories50.h @@ -101,10 +101,10 @@ public: typedef std::shared_ptr<IRoutableFactory> SP; // Implements IRoutableFactory. - bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const; + bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; // Implements IRoutableFactory. - mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const; + mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; /** @@ -144,10 +144,10 @@ public: typedef std::shared_ptr<IRoutableFactory> SP; // Implements IRoutableFactory. - bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const; + bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; // Implements IRoutableFactory. - mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const; + mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; /** @@ -164,8 +164,8 @@ public: */ class FeedReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; virtual uint32_t getType() const = 0; }; @@ -177,113 +177,113 @@ public: class BatchDocumentUpdateMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: BatchDocumentUpdateMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class BatchDocumentUpdateReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class CreateVisitorMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class CreateVisitorReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class DestroyVisitorMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class DestroyVisitorReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class DocBlockMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class DocBlockReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class DocumentListMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: DocumentListMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class DocumentListReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class DocumentSummaryMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class DocumentSummaryReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class EmptyBucketsMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class EmptyBucketsReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class GetBucketListMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class GetBucketListReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class GetBucketStateMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class GetBucketStateReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class GetDocumentMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class GetDocumentReplyFactory : public DocumentReplyFactory { const document::DocumentTypeRepo &_repo; - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &msg, vespalib::GrowableByteBuffer &buf) const override; public: GetDocumentReplyFactory(const document::DocumentTypeRepo &r) : _repo(r) {} @@ -291,39 +291,39 @@ public: class MapVisitorMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: MapVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class MapVisitorReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class MultiOperationMessageFactory : public DocumentMessageFactory { document::DocumentTypeRepo::SP _repo; protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: MultiOperationMessageFactory(const document::DocumentTypeRepo::SP &r) : _repo(r) {} }; class MultiOperationReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class PutDocumentMessageFactory : public DocumentMessageFactory { protected: const document::DocumentTypeRepo &_repo; - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const { + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override { return decodeMessage<PutDocumentMessage>(this, buf); } - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: void decodeInto(PutDocumentMessage & msg, document::ByteBuffer & buf) const; PutDocumentMessageFactory(const document::DocumentTypeRepo &r) @@ -331,75 +331,75 @@ public: }; class PutDocumentReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class RemoveDocumentMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const { + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override { return decodeMessage<RemoveDocumentMessage>(this, buf); } - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: void decodeInto(RemoveDocumentMessage & msg, document::ByteBuffer & buf) const; }; class RemoveDocumentReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class RemoveLocationMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: RemoveLocationMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} }; class RemoveLocationReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class SearchResultMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class SearchResultReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class StatBucketMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class StatBucketReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class StatDocumentMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class StatDocumentReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class UpdateDocumentMessageFactory : public DocumentMessageFactory { protected: const document::DocumentTypeRepo &_repo; - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const { + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override { return decodeMessage<UpdateDocumentMessage>(this, buf); } - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: void decodeInto(UpdateDocumentMessage & msg, document::ByteBuffer & buf) const; UpdateDocumentMessageFactory(const document::DocumentTypeRepo &r) @@ -407,33 +407,33 @@ public: }; class UpdateDocumentReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class VisitorInfoMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class VisitorInfoReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class WrongDistributionReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; class QueryResultMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; class QueryResultReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; /////////////////////////////////////////////////////////////////////////// diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h index 7dc51e45a4f..bfa25c21d84 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories51.h @@ -59,10 +59,10 @@ public: typedef std::shared_ptr<IRoutableFactory> SP; // Implements IRoutableFactory. - bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const; + bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; // Implements IRoutableFactory. - mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const; + mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; /** @@ -102,16 +102,16 @@ public: typedef std::shared_ptr<IRoutableFactory> SP; // Implements IRoutableFactory. - bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const; + bool encode(const mbus::Routable &obj, vespalib::GrowableByteBuffer &out) const override; // Implements IRoutableFactory. - mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const; + mbus::Routable::UP decode(document::ByteBuffer &in, const LoadTypeSet& loadTypes) const override; }; class DocumentIgnoredReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; }; /** @@ -128,8 +128,8 @@ public: */ class FeedReplyFactory : public DocumentReplyFactory { protected: - DocumentReply::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const; + DocumentReply::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentReply &reply, vespalib::GrowableByteBuffer &buf) const override; virtual uint32_t getType() const = 0; }; @@ -142,8 +142,8 @@ public: class CreateVisitorMessageFactory : public DocumentMessageFactory { const document::DocumentTypeRepo &_repo; protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; public: CreateVisitorMessageFactory(const document::DocumentTypeRepo &r) : _repo(r) {} @@ -151,8 +151,8 @@ public: class GetDocumentMessageFactory : public DocumentMessageFactory { protected: - DocumentMessage::UP doDecode(document::ByteBuffer &buf) const; - bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const; + DocumentMessage::UP doDecode(document::ByteBuffer &buf) const override; + bool doEncode(const DocumentMessage &msg, vespalib::GrowableByteBuffer &buf) const override; }; /////////////////////////////////////////////////////////////////////////// diff --git a/documentapi/src/vespa/documentapi/messagebus/routablefactories52.h b/documentapi/src/vespa/documentapi/messagebus/routablefactories52.h index 281ab899aa6..3d9303cdf09 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablefactories52.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablefactories52.h @@ -44,7 +44,7 @@ public: return decodeMessage<RemoveDocumentMessage>(this, buf); } - bool doEncode(const DocumentMessage & msg, vespalib::GrowableByteBuffer & buf) const; + bool doEncode(const DocumentMessage & msg, vespalib::GrowableByteBuffer & buf) const override; public: void decodeInto(RemoveDocumentMessage & msg, document::ByteBuffer & buf) const; }; @@ -56,7 +56,7 @@ public: return decodeMessage<UpdateDocumentMessage>(this, buf); } - bool doEncode(const DocumentMessage & msg, vespalib::GrowableByteBuffer & buf) const; + bool doEncode(const DocumentMessage & msg, vespalib::GrowableByteBuffer & buf) const override; public: void decodeInto(UpdateDocumentMessage & msg, document::ByteBuffer & buf) const; UpdateDocumentMessageFactory(const document::DocumentTypeRepo & r) : super::UpdateDocumentMessageFactory(r) {} diff --git a/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h b/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h index 75e9ef1ab18..906fc508bd7 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h +++ b/documentapi/src/vespa/documentapi/messagebus/routingpolicyfactories.h @@ -13,23 +13,23 @@ private: public: class AndPolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class StoragePolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class MessageTypePolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class ContentPolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class LoadBalancerPolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class DocumentRouteSelectorPolicyFactory : public IRoutingPolicyFactory { private: @@ -39,31 +39,31 @@ public: DocumentRouteSelectorPolicyFactory( const document::DocumentTypeRepo &repo, const string &configId); - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class ExternPolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class LocalServicePolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class RoundRobinPolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class SearchColumnPolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class SearchRowPolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; class SubsetServicePolicyFactory : public IRoutingPolicyFactory { public: - mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const; + mbus::IRoutingPolicy::UP createPolicy(const string ¶m) const override; }; }; diff --git a/eval/src/tests/eval/function/function_test.cpp b/eval/src/tests/eval/function/function_test.cpp index e90525ce2fa..773b3e17d2e 100644 --- a/eval/src/tests/eval/function/function_test.cpp +++ b/eval/src/tests/eval/function/function_test.cpp @@ -374,7 +374,7 @@ TEST("require that Call children can be accessed") { struct MyNodeHandler : public NodeHandler { std::vector<nodes::Node_UP> nodes; - virtual void handle(nodes::Node_UP node) { + virtual void handle(nodes::Node_UP node) override { if (node.get() != nullptr) { nodes.push_back(std::move(node)); } @@ -658,7 +658,8 @@ struct MySymbolExtractor : SymbolExtractor { MySymbolExtractor() : extra(), invoke_count() {} explicit MySymbolExtractor(std::initializer_list<char> extra_in) : extra(extra_in), invoke_count() {} virtual void extract_symbol(const char *pos_in, const char *end_in, - const char *&pos_out, vespalib::string &symbol_out) const + const char *&pos_out, vespalib::string &symbol_out) + const override { ++invoke_count; for (; pos_in < end_in; ++pos_in) { diff --git a/fastlib/src/vespa/fastlib/net/tests/httpheaderparsertest.cpp b/fastlib/src/vespa/fastlib/net/tests/httpheaderparsertest.cpp index d4e10f33bca..6c355b78aa1 100644 --- a/fastlib/src/vespa/fastlib/net/tests/httpheaderparsertest.cpp +++ b/fastlib/src/vespa/fastlib/net/tests/httpheaderparsertest.cpp @@ -11,7 +11,7 @@ class HeaderReaderApp : public FastOS_Application { public: - int Main(void) + int Main(void) override { if (_argc != 2) { diff --git a/fastlib/src/vespa/fastlib/text/tests/latintokenizertest.h b/fastlib/src/vespa/fastlib/text/tests/latintokenizertest.h index f659a274a29..36477f6b010 100644 --- a/fastlib/src/vespa/fastlib/text/tests/latintokenizertest.h +++ b/fastlib/src/vespa/fastlib/text/tests/latintokenizertest.h @@ -145,7 +145,7 @@ public: LatinTokenizerTest(); virtual ~LatinTokenizerTest(); - virtual void Run(); + virtual void Run() override; }; @@ -459,7 +459,7 @@ void LatinTokenizerTest::Run() class LatinTokenizerTestApp : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; diff --git a/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.h b/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.h index 2300b83d6db..28f1323384f 100644 --- a/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.h +++ b/fastlib/src/vespa/fastlib/text/tests/unicodeutiltest.h @@ -40,7 +40,7 @@ class UnicodeUtilTest : public Test } public: - virtual void Run() { + virtual void Run() override { // do the tests _test(GetUTF8Char_WrongInput()); _test(IsTerminalPunctuationChar()); @@ -50,5 +50,5 @@ public: class UnicodeUtilTestApp : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; diff --git a/fastlib/src/vespa/fastlib/text/tests/wordfolderstest.h b/fastlib/src/vespa/fastlib/text/tests/wordfolderstest.h index 28c7e8f06f2..3c18be1d552 100644 --- a/fastlib/src/vespa/fastlib/text/tests/wordfolderstest.h +++ b/fastlib/src/vespa/fastlib/text/tests/wordfolderstest.h @@ -115,7 +115,7 @@ class WordFoldersTest : public Test public: - virtual void Run() { + virtual void Run() override { // do the tests _test(NormalizeWordFolderConstruction()); _test(TokenizeAnnotatedBuffer()); @@ -127,5 +127,5 @@ public: class WordFoldersTestApp : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; diff --git a/fastlib/src/vespa/fastlib/util/tests/bagtest.h b/fastlib/src/vespa/fastlib/util/tests/bagtest.h index 3bfff40a50f..7ca33f318f0 100644 --- a/fastlib/src/vespa/fastlib/util/tests/bagtest.h +++ b/fastlib/src/vespa/fastlib/util/tests/bagtest.h @@ -529,7 +529,7 @@ public: - virtual void Run() { + virtual void Run() override { RunTest(&BagTester::IterPtrInitTest); RunTest(&BagTester::IterRefInitTest); RunTest(&BagTester::IterPtrStartTest); @@ -557,7 +557,7 @@ class BagTest : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; diff --git a/fastlib/src/vespa/fastlib/util/tests/base64test.cpp b/fastlib/src/vespa/fastlib/util/tests/base64test.cpp index 327def403b2..970f87831b1 100644 --- a/fastlib/src/vespa/fastlib/util/tests/base64test.cpp +++ b/fastlib/src/vespa/fastlib/util/tests/base64test.cpp @@ -8,7 +8,7 @@ class Base64Test : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; int diff --git a/filedistribution/src/apps/filedistributor/filedistributor.cpp b/filedistribution/src/apps/filedistributor/filedistributor.cpp index 1d51c032e9c..452b951bf6b 100644 --- a/filedistribution/src/apps/filedistributor/filedistributor.cpp +++ b/filedistribution/src/apps/filedistributor/filedistributor.cpp @@ -140,20 +140,20 @@ public: FileDistributor(); ~FileDistributor(); - void notifyGenerationChange(int64_t generation) { + void notifyGenerationChange(int64_t generation) override { if (_components && ! completeReconfigurationNeeded()) { _components->updatedConfig(generation); } } //configure overrides - void configure(std::unique_ptr<ZookeepersConfig> config) { + void configure(std::unique_ptr<ZookeepersConfig> config) override { LockGuard guard(_configMutex); _zooKeepersConfig = std::move(config); _completeReconfigurationNeeded = true; } - void configure(std::unique_ptr<FiledistributorConfig> config) { + void configure(std::unique_ptr<FiledistributorConfig> config) override { LockGuard guard(_configMutex); if (_fileDistributorConfig.get() != NULL && (config->torrentport != _fileDistributorConfig->torrentport || @@ -169,7 +169,7 @@ public: } - void configure(std::unique_ptr<FiledistributorrpcConfig> config) { + void configure(std::unique_ptr<FiledistributorrpcConfig> config) override { LockGuard guard(_configMutex); _rpcConfig = std::move(config); _completeReconfigurationNeeded = true; @@ -241,8 +241,7 @@ class FileDistributorApplication : public FastOS_Application { public: FileDistributorApplication(const config::ConfigUri & configUri); - //overrides - int Main(); + int Main() override; }; namespace { diff --git a/filedistribution/src/tests/filedownloader/testfiledownloader.cpp b/filedistribution/src/tests/filedownloader/testfiledownloader.cpp index c9d93ffc218..56a664ea7e1 100644 --- a/filedistribution/src/tests/filedownloader/testfiledownloader.cpp +++ b/filedistribution/src/tests/filedownloader/testfiledownloader.cpp @@ -47,15 +47,15 @@ createDownloader(ComponentsDeleter& deleter, } //anonymous namespace class MockFileDistributionModel : public FileDistributionModel { - virtual FileDBModel& getFileDBModel() { + virtual FileDBModel& getFileDBModel() override { abort(); } - virtual std::set<std::string> getFilesToDownload() { + virtual std::set<std::string> getFilesToDownload() override { return std::set<std::string>(); } - virtual PeerEntries getPeers(const std::string& , size_t) { + virtual PeerEntries getPeers(const std::string&, size_t) override { PeerEntries peers(2); peers[0].ip = localHost; peers[0].port = uploaderPort; @@ -66,9 +66,9 @@ class MockFileDistributionModel : public FileDistributionModel { return peers; } - virtual void addPeer(const std::string&) {} - virtual void removePeer(const std::string&) {} - virtual void peerFinished(const std::string&) {} + virtual void addPeer(const std::string&) override {} + virtual void removePeer(const std::string&) override {} + virtual void peerFinished(const std::string&) override {} }; diff --git a/filedistribution/src/tests/rpc/mockfileprovider.h b/filedistribution/src/tests/rpc/mockfileprovider.h index 230cd0d0382..33177d939c1 100644 --- a/filedistribution/src/tests/rpc/mockfileprovider.h +++ b/filedistribution/src/tests/rpc/mockfileprovider.h @@ -14,7 +14,7 @@ public: boost::barrier _queueForeverBarrier; - boost::optional<Path> getPath(const std::string& fileReference) { + boost::optional<Path> getPath(const std::string& fileReference) override { if (fileReference == "dd") { return Path("direct/result/path"); } else { @@ -22,7 +22,7 @@ public: } } - void downloadFile(const std::string& fileReference) { + void downloadFile(const std::string& fileReference) override { if (fileReference == _queueForeverFileReference) { _queueForeverBarrier.wait(); return; @@ -33,11 +33,11 @@ public: } //Overrides - DownloadCompletedSignal& downloadCompleted() { + DownloadCompletedSignal& downloadCompleted() override { return _downloadCompleted; } - DownloadFailedSignal& downloadFailed() { + DownloadFailedSignal& downloadFailed() override { return _downloadFailed; } diff --git a/filedistribution/src/tests/scheduler/test-scheduler.cpp b/filedistribution/src/tests/scheduler/test-scheduler.cpp index a9249bbdcae..5be60569449 100644 --- a/filedistribution/src/tests/scheduler/test-scheduler.cpp +++ b/filedistribution/src/tests/scheduler/test-scheduler.cpp @@ -50,7 +50,7 @@ BOOST_FIXTURE_TEST_SUITE(SchedulerTest, Fixture) struct RepeatedTask : Scheduler::Task { - void doHandle() { + void doHandle() override { std::cout <<"RepeatedTask::doHandle " <<std::endl; schedule(boost::posix_time::seconds(1)); } @@ -66,7 +66,7 @@ BOOST_AUTO_TEST_CASE(require_tasks_does_not_keep_scheduler_alive) { struct EnsureInvokedTask : Scheduler::Task { boost::barrier& _barrier; - void doHandle() { + void doHandle() override { _barrier.wait(); } @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(require_task_invoked) { } struct ThrowExceptionTask : Scheduler::Task { - void doHandle() { + void doHandle() override { throw TestException(); } diff --git a/filedistribution/src/tests/zkfacade/test-zkfacade.cpp b/filedistribution/src/tests/zkfacade/test-zkfacade.cpp index c20e7058933..46db660d452 100644 --- a/filedistribution/src/tests/zkfacade/test-zkfacade.cpp +++ b/filedistribution/src/tests/zkfacade/test-zkfacade.cpp @@ -28,7 +28,7 @@ struct Watcher : public ZKFacade::NodeChangedWatcher { Watcher() : _barrier(2) {} - void operator()() { + void operator()() override { _barrier.wait(); } }; @@ -206,7 +206,7 @@ BOOST_AUTO_TEST_CASE(require_that_zkfacade_can_be_deleted_from_callback) :_zk(zk) {} - void operator()() { + void operator()() override { BOOST_CHECK(_zk.use_count() == 2); _zk.reset(); Watcher::operator()(); diff --git a/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.cpp b/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.cpp index 2412b00ecd6..1db2f7c6e49 100644 --- a/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.cpp +++ b/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.cpp @@ -68,7 +68,7 @@ struct TrackingTask : public Scheduler::Task { ~TrackingTask(); //TODO: refactor - void doHandle(); + void doHandle() override; PeerEntries getPeers(const std::shared_ptr<FileDownloader>& downloader); void reschedule(); }; diff --git a/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.h b/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.h index abb7367974a..e22fdab1e30 100644 --- a/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.h +++ b/filedistribution/src/vespa/filedistribution/distributor/filedistributortrackerimpl.h @@ -30,7 +30,7 @@ public: virtual ~FileDistributorTrackerImpl(); //overrides - void trackingRequest(libtorrent::tracker_request& request, const TorrentSP & torrent); + void trackingRequest(libtorrent::tracker_request& request, const TorrentSP & torrent) override; void setDownloader(const std::shared_ptr<FileDownloader>& downloader); }; diff --git a/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h b/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h index 64a2a8a744e..21bc8f5200f 100644 --- a/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h +++ b/filedistribution/src/vespa/filedistribution/distributor/filedownloadermanager.h @@ -49,15 +49,15 @@ public: ~FileDownloaderManager(); void start(); - boost::optional<Path> getPath(const std::string& fileReference); - void downloadFile(const std::string& fileReference); + boost::optional<Path> getPath(const std::string& fileReference) override; + void downloadFile(const std::string& fileReference) override; //FileProvider overrides - DownloadCompletedSignal& downloadCompleted() { + DownloadCompletedSignal& downloadCompleted() override { return _fileDownloader->_downloadCompleted; } - DownloadFailedSignal& downloadFailed() { + DownloadFailedSignal& downloadFailed() override { return _fileDownloader->_downloadFailed; } }; diff --git a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp index 01b08e1f377..0288f3082f8 100644 --- a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp +++ b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.cpp @@ -86,7 +86,7 @@ struct FileDistributionModelImpl::DeployedFilesChangedCallback : {} //override - void operator()() { + void operator()() override { if (std::shared_ptr<FileDistributionModelImpl> model = _parent.lock()) { model->_filesToDownloadChanged(); } diff --git a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.h b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.h index 0c89e8b12ae..e132ec8b230 100644 --- a/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.h +++ b/filedistribution/src/vespa/filedistribution/model/filedistributionmodelimpl.h @@ -48,20 +48,20 @@ public: ~FileDistributionModelImpl(); //overrides FileDistributionModel - FileDBModel& getFileDBModel() { + FileDBModel& getFileDBModel() override { return _fileDBModel; } - std::set<std::string> getFilesToDownload(); + std::set<std::string> getFilesToDownload() override; - PeerEntries getPeers(const std::string& fileReference, size_t maxPeers); - void addPeer(const std::string& fileReference); - void removePeer(const std::string& fileReference); - void peerFinished(const std::string& fileReference); + PeerEntries getPeers(const std::string& fileReference, size_t maxPeers) override; + void addPeer(const std::string& fileReference) override; + void removePeer(const std::string& fileReference) override; + void peerFinished(const std::string& fileReference) override; void addConfigServersAsPeers(std::vector<std::string>& peers, char const* envConfigServer, int port); //Overrides Subscriber - void configure(std::unique_ptr<FilereferencesConfig> config); + void configure(std::unique_ptr<FilereferencesConfig> config) override; }; } //namespace filedistribution diff --git a/filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.h b/filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.h index 7be2a383e7b..126d9da3424 100644 --- a/filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.h +++ b/filedistribution/src/vespa/filedistribution/model/zkfiledbmodel.h @@ -25,30 +25,30 @@ public: } //overrides - bool hasFile(const std::string& fileReference); - void addFile(const std::string& fileReference, const Buffer& buffer); + bool hasFile(const std::string& fileReference) override; + void addFile(const std::string& fileReference, const Buffer& buffer) override; Buffer getFile(const std::string& fileReference) override; - void cleanFiles(const std::vector<std::string>& filesToPreserve); + void cleanFiles(const std::vector<std::string>& filesToPreserve) override; void setDeployedFilesToDownload(const std::string& hostName, const std::string & appId, - const std::vector<std::string> & files); + const std::vector<std::string> & files) override; void cleanDeployedFilesToDownload( const std::vector<std::string> & hostsToPreserve, - const std::string& appId); + const std::string& appId) override; void removeDeploymentsThatHaveDifferentApplicationId( const std::vector<std::string> & hostsToPreserve, - const std::string& appId); + const std::string& appId) override; void removeNonApplicationFiles( const Path & hostPath, const std::string& appId); - std::vector<std::string> getHosts(); - HostStatus getHostStatus(const std::string& hostName); + std::vector<std::string> getHosts() override; + HostStatus getHostStatus(const std::string& hostName) override; ZKFileDBModel(const std::shared_ptr<ZKFacade>& zk); Progress getProgress(const std::string& fileReference, - const std::vector<std::string>& hostsSortedAscending); + const std::vector<std::string>& hostsSortedAscending) override; }; } //namespace filedistribution diff --git a/fnet/src/examples/frt/rpc/echo_client.cpp b/fnet/src/examples/frt/rpc/echo_client.cpp index f34f4c65111..b5fabb32363 100644 --- a/fnet/src/examples/frt/rpc/echo_client.cpp +++ b/fnet/src/examples/frt/rpc/echo_client.cpp @@ -7,7 +7,7 @@ LOG_SETUP("echo_client"); class EchoClient : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp index 479eb13fd43..3dd936f7fea 100644 --- a/fnet/src/examples/frt/rpc/rpc_callback_client.cpp +++ b/fnet/src/examples/frt/rpc/rpc_callback_client.cpp @@ -34,7 +34,7 @@ RPC::Init(FRT_Supervisor *s) class MyApp : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp index 05d3a205a29..419b1266d23 100644 --- a/fnet/src/examples/frt/rpc/rpc_callback_server.cpp +++ b/fnet/src/examples/frt/rpc/rpc_callback_server.cpp @@ -40,7 +40,7 @@ RPC::Init(FRT_Supervisor *s) class MyApp : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_client.cpp b/fnet/src/examples/frt/rpc/rpc_client.cpp index cde39270698..f5e5a9fe1e2 100644 --- a/fnet/src/examples/frt/rpc/rpc_client.cpp +++ b/fnet/src/examples/frt/rpc/rpc_client.cpp @@ -8,7 +8,7 @@ LOG_SETUP("rpc_client"); class RPCClient : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_info.cpp b/fnet/src/examples/frt/rpc/rpc_info.cpp index 600af612b40..5b7aebd6bdd 100644 --- a/fnet/src/examples/frt/rpc/rpc_info.cpp +++ b/fnet/src/examples/frt/rpc/rpc_info.cpp @@ -64,7 +64,7 @@ public: printf("\n"); } - virtual int Main(); + virtual int Main() override; }; diff --git a/fnet/src/examples/frt/rpc/rpc_invoke.cpp b/fnet/src/examples/frt/rpc/rpc_invoke.cpp index 0295e7ea7a9..0f64ef9b539 100644 --- a/fnet/src/examples/frt/rpc/rpc_invoke.cpp +++ b/fnet/src/examples/frt/rpc/rpc_invoke.cpp @@ -43,7 +43,7 @@ private: int run(); public: - virtual int Main(); + virtual int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_proxy.cpp b/fnet/src/examples/frt/rpc/rpc_proxy.cpp index af01ac60d26..6c805d6a173 100644 --- a/fnet/src/examples/frt/rpc/rpc_proxy.cpp +++ b/fnet/src/examples/frt/rpc/rpc_proxy.cpp @@ -68,7 +68,7 @@ private: public: ReqDone(RPCProxy &proxy) : _proxy(proxy) {} - virtual void RequestDone(FRT_RPCRequest *req); + virtual void RequestDone(FRT_RPCRequest *req) override; }; void @@ -209,7 +209,7 @@ RPCProxy::HOOK_Fini(FRT_RPCRequest *req) class App : public FastOS_Application { public: - virtual int Main(); + virtual int Main() override; }; int diff --git a/fnet/src/examples/frt/rpc/rpc_server.cpp b/fnet/src/examples/frt/rpc/rpc_server.cpp index 4da65ddfe2b..823d3c893b1 100644 --- a/fnet/src/examples/frt/rpc/rpc_server.cpp +++ b/fnet/src/examples/frt/rpc/rpc_server.cpp @@ -107,7 +107,7 @@ private: public: App() : _server() {} - virtual int Main(); + virtual int Main() override; }; int diff --git a/fnet/src/examples/ping/packets.h b/fnet/src/examples/ping/packets.h index 39dae75a16f..68cc27ccb5b 100644 --- a/fnet/src/examples/ping/packets.h +++ b/fnet/src/examples/ping/packets.h @@ -11,26 +11,26 @@ enum { class PingRequest : public FNET_Packet { public: - virtual uint32_t GetPCODE(); - virtual uint32_t GetLength(); - virtual void Encode(FNET_DataBuffer *); - virtual bool Decode(FNET_DataBuffer *src, uint32_t len); + virtual uint32_t GetPCODE() override; + virtual uint32_t GetLength() override; + virtual void Encode(FNET_DataBuffer *) override; + virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; class PingReply : public FNET_Packet { public: - virtual uint32_t GetPCODE(); - virtual uint32_t GetLength(); - virtual void Encode(FNET_DataBuffer *); - virtual bool Decode(FNET_DataBuffer *src, uint32_t len); + virtual uint32_t GetPCODE() override; + virtual uint32_t GetLength() override; + virtual void Encode(FNET_DataBuffer *) override; + virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; class PingPacketFactory : public FNET_IPacketFactory { public: - virtual FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context); + virtual FNET_Packet *CreatePacket(uint32_t pcode, FNET_Context) override; }; diff --git a/fnet/src/examples/ping/pingclient.cpp b/fnet/src/examples/ping/pingclient.cpp index 2f11adb73e5..fb834b9108b 100644 --- a/fnet/src/examples/ping/pingclient.cpp +++ b/fnet/src/examples/ping/pingclient.cpp @@ -9,7 +9,7 @@ LOG_SETUP("pingclient"); class PingClient : public FastOS_Application { public: - int Main(); + int Main() override; }; diff --git a/fnet/src/examples/ping/pingserver.cpp b/fnet/src/examples/ping/pingserver.cpp index 905a1dc656d..173e627ac23 100644 --- a/fnet/src/examples/ping/pingserver.cpp +++ b/fnet/src/examples/ping/pingserver.cpp @@ -11,15 +11,15 @@ class PingServer : public FNET_IServerAdapter, public FastOS_Application { public: - bool InitAdminChannel(FNET_Channel *) { return false; } - bool InitChannel(FNET_Channel *channel, uint32_t) + bool InitAdminChannel(FNET_Channel *) override { return false; } + bool InitChannel(FNET_Channel *channel, uint32_t) override { channel->SetContext(FNET_Context(channel)); channel->SetHandler(this); return true; } - HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) + HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override { if (packet->GetPCODE() == PCODE_PING_REQUEST) { fprintf(stderr, "Got ping request, sending ping reply\n"); @@ -29,7 +29,7 @@ public: return FNET_FREE_CHANNEL; } - int Main(); + int Main() override; }; diff --git a/fnet/src/examples/proxy/proxy.cpp b/fnet/src/examples/proxy/proxy.cpp index 243c1e764c1..40d7a44c7f6 100644 --- a/fnet/src/examples/proxy/proxy.cpp +++ b/fnet/src/examples/proxy/proxy.cpp @@ -12,10 +12,10 @@ private: public: RawPacket() : _data() {} - virtual uint32_t GetPCODE(); - virtual uint32_t GetLength(); - virtual void Encode(FNET_DataBuffer *); - virtual bool Decode(FNET_DataBuffer *src, uint32_t len); + virtual uint32_t GetPCODE() override; + virtual uint32_t GetLength() override; + virtual void Encode(FNET_DataBuffer *) override; + virtual bool Decode(FNET_DataBuffer *src, uint32_t len) override; }; uint32_t @@ -69,8 +69,7 @@ public: _server = server; } - virtual HP_RetCode HandlePacket(FNET_Packet *packet, - FNET_Context context); + virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; }; @@ -140,17 +139,14 @@ private: public: Proxy() : _transport() {} - virtual bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, - uint32_t *pcode, uint32_t *chid, bool *); - virtual FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, - uint32_t pcode, FNET_Context); - virtual void Encode(FNET_Packet *packet, uint32_t chid, - FNET_DataBuffer *dst); + virtual bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, uint32_t *pcode, uint32_t *chid, bool *) override; + virtual FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, uint32_t pcode, FNET_Context) override; + virtual void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst) override; // --------------------------------------------- - virtual bool InitAdminChannel(FNET_Channel *channel); - virtual bool InitChannel(FNET_Channel *, uint32_t); + virtual bool InitAdminChannel(FNET_Channel *channel) override; + virtual bool InitChannel(FNET_Channel *, uint32_t) override; // --------------------------------------------- - virtual int Main(); + virtual int Main() override; }; diff --git a/fnet/src/examples/timeout/timeout.cpp b/fnet/src/examples/timeout/timeout.cpp index 39bfb96eb0f..8a52d769282 100644 --- a/fnet/src/examples/timeout/timeout.cpp +++ b/fnet/src/examples/timeout/timeout.cpp @@ -20,7 +20,7 @@ public: _queue(queue) {} - virtual void PerformTask(); + virtual void PerformTask() override; }; @@ -34,7 +34,7 @@ Timeout::PerformTask() class MyApp : public FastOS_Application { public: - int Main(); + int Main() override; }; diff --git a/fnet/src/tests/fdselector/fdselector.cpp b/fnet/src/tests/fdselector/fdselector.cpp index 61c204aded7..0097334a9ce 100644 --- a/fnet/src/tests/fdselector/fdselector.cpp +++ b/fnet/src/tests/fdselector/fdselector.cpp @@ -14,11 +14,11 @@ struct Handler : public FNET_IFDSelectorHandler { reset(); } - void readEvent(FNET_FDSelector *src) + void readEvent(FNET_FDSelector *src) override { readEventCnt[src->getContext()._value.INT]++; } - void writeEvent(FNET_FDSelector *src) + void writeEvent(FNET_FDSelector *src) override { writeEventCnt[src->getContext()._value.INT]++; } diff --git a/fnet/src/tests/frt/method_pt/method_pt.cpp b/fnet/src/tests/frt/method_pt/method_pt.cpp index 33cd6e5218b..4b869f6ba9f 100644 --- a/fnet/src/tests/frt/method_pt/method_pt.cpp +++ b/fnet/src/tests/frt/method_pt/method_pt.cpp @@ -112,8 +112,8 @@ class MediumHandler1 : public FRT_Invokable, public MediumB { public: - virtual void foo() {} - virtual void bar() {} + virtual void foo() override {} + virtual void bar() override {} void RPC_Method(FRT_RPCRequest *req); }; @@ -123,8 +123,8 @@ class MediumHandler2 : public MediumA, public MediumB { public: - virtual void foo() {} - virtual void bar() {} + virtual void foo() override {} + virtual void bar() override {} void RPC_Method(FRT_RPCRequest *req); }; @@ -134,8 +134,8 @@ class MediumHandler3 : public MediumA, public FRT_Invokable { public: - virtual void foo() {} - virtual void bar() {} + virtual void foo() override {} + virtual void bar() override {} void RPC_Method(FRT_RPCRequest *req); }; @@ -146,8 +146,8 @@ class ComplexHandler1 : public FRT_Invokable, public ComplexB { public: - virtual void foo() {} - virtual void bar() {} + virtual void foo() override {} + virtual void bar() override {} void RPC_Method(FRT_RPCRequest *req); }; @@ -157,8 +157,8 @@ class ComplexHandler2 : public ComplexA, public ComplexB { public: - virtual void foo() {} - virtual void bar() {} + virtual void foo() override {} + virtual void bar() override {} void RPC_Method(FRT_RPCRequest *req); }; @@ -168,8 +168,8 @@ class ComplexHandler3 : public ComplexA, public FRT_Invokable { public: - virtual void foo() {} - virtual void bar() {} + virtual void foo() override {} + virtual void bar() override {} void RPC_Method(FRT_RPCRequest *req); }; diff --git a/fnet/src/tests/frt/rpc/detach_return_invoke.cpp b/fnet/src/tests/frt/rpc/detach_return_invoke.cpp index b689671372b..44f484cf064 100644 --- a/fnet/src/tests/frt/rpc/detach_return_invoke.cpp +++ b/fnet/src/tests/frt/rpc/detach_return_invoke.cpp @@ -8,7 +8,7 @@ struct Receptor : public FRT_IRequestWait FRT_RPCRequest *req; Receptor() : req(0) {} - void RequestDone(FRT_RPCRequest *r) { + void RequestDone(FRT_RPCRequest *r) override { req = r; } }; diff --git a/fnet/src/tests/frt/rpc/invoke.cpp b/fnet/src/tests/frt/rpc/invoke.cpp index 77ded20acf4..7853c473f5e 100644 --- a/fnet/src/tests/frt/rpc/invoke.cpp +++ b/fnet/src/tests/frt/rpc/invoke.cpp @@ -48,7 +48,7 @@ struct LockedReqWait : public FRT_IRequestWait return ret; } - virtual void RequestDone(FRT_RPCRequest *) + virtual void RequestDone(FRT_RPCRequest *) override { _wasLocked = isLocked(); _cond.Lock(); @@ -90,7 +90,7 @@ public: Schedule(delay); } - void PerformTask() + void PerformTask() override { _req->Return(); _delayedReturnCntLock.Lock(); diff --git a/fnet/src/tests/frt/rpc/sharedblob.cpp b/fnet/src/tests/frt/rpc/sharedblob.cpp index 29a229a1a89..a086584b36a 100644 --- a/fnet/src/tests/frt/rpc/sharedblob.cpp +++ b/fnet/src/tests/frt/rpc/sharedblob.cpp @@ -10,10 +10,10 @@ struct MyBlob : FRT_ISharedBlob { int refcnt; MyBlob() : refcnt(1) {} - virtual uint32_t getLen() { return (strlen("blob_test") + 1); } - virtual const char *getData() { return "blob_test"; } - virtual void addRef() { ++refcnt; } - virtual void subRef() { --refcnt; } + virtual uint32_t getLen() override { return (strlen("blob_test") + 1); } + virtual const char *getData() override { return "blob_test"; } + virtual void addRef() override { ++refcnt; } + virtual void subRef() override { --refcnt; } }; struct Data diff --git a/fnet/src/tests/locking/castspeed.cpp b/fnet/src/tests/locking/castspeed.cpp index 7fe360b3caf..1f57bc4757c 100644 --- a/fnet/src/tests/locking/castspeed.cpp +++ b/fnet/src/tests/locking/castspeed.cpp @@ -18,14 +18,14 @@ class C: public A { public: B *otherB; - virtual B* asB() { return otherB; } + virtual B* asB() override { return otherB; } C() : otherB(nullptr) {} }; class B: public C { public: - virtual B* asB() { return this; } + virtual B* asB() override { return this; } }; diff --git a/fnet/src/tests/locking/drainpackets.cpp b/fnet/src/tests/locking/drainpackets.cpp index 5fedea4790f..fb86371c9ec 100644 --- a/fnet/src/tests/locking/drainpackets.cpp +++ b/fnet/src/tests/locking/drainpackets.cpp @@ -6,10 +6,10 @@ class MyPacket : public FNET_Packet { public: - uint32_t GetPCODE() { return 0; } - uint32_t GetLength() { return 0; } - void Encode(FNET_DataBuffer *) {} - bool Decode(FNET_DataBuffer *, uint32_t) + uint32_t GetPCODE() override { return 0; } + uint32_t GetLength() override { return 0; } + void Encode(FNET_DataBuffer *) override {} + bool Decode(FNET_DataBuffer *, uint32_t) override { return true; } }; diff --git a/fnet/src/tests/scheduling/schedule.cpp b/fnet/src/tests/scheduling/schedule.cpp index 1b72b514d46..6fb928f7aeb 100644 --- a/fnet/src/tests/scheduling/schedule.cpp +++ b/fnet/src/tests/scheduling/schedule.cpp @@ -38,7 +38,7 @@ public: return true; } - void PerformTask() + void PerformTask() override { _time = ::_time; _done = true; @@ -57,7 +57,7 @@ public: uint32_t GetCnt() { return _cnt; } - void PerformTask() + void PerformTask() override { _cnt++; ScheduleNow(); // re-schedule as fast as possible diff --git a/fnet/src/tests/scheduling/sloweventloop.cpp b/fnet/src/tests/scheduling/sloweventloop.cpp index 3e27bfef131..a4b57cfd218 100644 --- a/fnet/src/tests/scheduling/sloweventloop.cpp +++ b/fnet/src/tests/scheduling/sloweventloop.cpp @@ -13,7 +13,7 @@ public: _done(false) {} bool done() const { return _done; } - void PerformTask() { _done = true; } + void PerformTask() override { _done = true; } }; diff --git a/fnet/src/tests/sync_execute/sync_execute.cpp b/fnet/src/tests/sync_execute/sync_execute.cpp index e24d63effd5..c832ef0330d 100644 --- a/fnet/src/tests/sync_execute/sync_execute.cpp +++ b/fnet/src/tests/sync_execute/sync_execute.cpp @@ -5,7 +5,7 @@ struct DoIt : public FNET_IExecutable { vespalib::Gate gate; - virtual void execute() { + virtual void execute() override { gate.countDown(); } }; diff --git a/frtstream/src/vespa/frtstream/frtclientstream.h b/frtstream/src/vespa/frtstream/frtclientstream.h index 27d1f36b780..b47f1399d0f 100644 --- a/frtstream/src/vespa/frtstream/frtclientstream.h +++ b/frtstream/src/vespa/frtstream/frtclientstream.h @@ -21,8 +21,8 @@ class FrtClientStream : public FrtStream { bool executed; uint32_t _nextOutValue; - FRT_Values& in(); - FRT_Value& nextOut(); + FRT_Values& in() override; + FRT_Value& nextOut() override; public: FrtClientStream(const std::string& connectionSpec); ~FrtClientStream(); diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java index 87327bc217e..1be7d26d39f 100644 --- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java +++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/ConnectorFactory.java @@ -104,7 +104,12 @@ public class ConnectorFactory { connector.setName(connectorConfig.name()); connector.setAcceptQueueSize(connectorConfig.acceptQueueSize()); connector.setReuseAddress(connectorConfig.reuseAddress()); - connector.setSoLingerTime(connectorConfig.soLingerTime()); + double soLingerTimeSeconds = connectorConfig.soLingerTime(); + if (soLingerTimeSeconds == -1) { + connector.setSoLingerTime(-1); + } else { + connector.setSoLingerTime((int)(soLingerTimeSeconds * 1000.0)); + } connector.setIdleTimeout((long)(connectorConfig.idleTimeout() * 1000.0)); connector.setStopTimeout((long)(connectorConfig.stopTimeout() * 1000.0)); return connector; diff --git a/jdisc_http_service/src/main/resources/configdefinitions/jdisc.http.connector.def b/jdisc_http_service/src/main/resources/configdefinitions/jdisc.http.connector.def index 433508b0b9f..afe57e33245 100644 --- a/jdisc_http_service/src/main/resources/configdefinitions/jdisc.http.connector.def +++ b/jdisc_http_service/src/main/resources/configdefinitions/jdisc.http.connector.def @@ -25,8 +25,8 @@ acceptQueueSize int default=0 # Whether the server socket reuses addresses. reuseAddress bool default=true -# The linger time in milliseconds. Use -1 to disable. -soLingerTime int default=-1 +# The linger time in seconds. Use -1.0 to disable. +soLingerTime double default=-1.0 # The maximum idle time for a connection, which roughly translates to the Socket.setSoTimeout(int). idleTimeout double default=180.0 diff --git a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerConformanceTest.java b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerConformanceTest.java index 09ca633e0f7..0729c4b8480 100644 --- a/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerConformanceTest.java +++ b/jdisc_http_service/src/test/java/com/yahoo/jdisc/http/server/jetty/HttpServerConformanceTest.java @@ -411,7 +411,7 @@ public class HttpServerConformanceTest extends ServerProviderConformanceTest { @Override @Test public void testRequestContentCloseWithNondeterministicSyncFailure() throws Throwable { - new TestRunner().expect(anyOf(success(), serverError())) + new TestRunner().expect(anyOf(success(), successNoContent(), serverError())) .execute(); } diff --git a/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp b/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp index ef13973c0ce..75defdc3881 100644 --- a/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp +++ b/jrt_test/src/jrt-test/simpleserver/simpleserver.cpp @@ -70,7 +70,7 @@ public: class App : public FastOS_Application { public: - int Main(); + int Main() override; }; diff --git a/jrt_test/src/tests/echo/echo-client.cpp b/jrt_test/src/tests/echo/echo-client.cpp index 4d246431793..2d72cdc937b 100644 --- a/jrt_test/src/tests/echo/echo-client.cpp +++ b/jrt_test/src/tests/echo/echo-client.cpp @@ -7,7 +7,7 @@ LOG_SETUP("echo_client"); class EchoClient : public FastOS_Application { public: - int Main() + int Main() override { if (_argc < 2) { printf("usage : echo_client <connectspec>\n"); diff --git a/jrt_test/src/tests/mandatory-methods/extract-reflection.cpp b/jrt_test/src/tests/mandatory-methods/extract-reflection.cpp index 7b92997cfdf..98584e9a284 100644 --- a/jrt_test/src/tests/mandatory-methods/extract-reflection.cpp +++ b/jrt_test/src/tests/mandatory-methods/extract-reflection.cpp @@ -64,7 +64,7 @@ public: } - int Main() + int Main() override { if (_argc < 2) { printf("usage : rpc_info <connectspec> [verbose]\n"); diff --git a/jrt_test/src/tests/mockup-invoke/mockup-server.cpp b/jrt_test/src/tests/mockup-invoke/mockup-server.cpp index 97b2e945e57..46a1e2bc11a 100644 --- a/jrt_test/src/tests/mockup-invoke/mockup-server.cpp +++ b/jrt_test/src/tests/mockup-invoke/mockup-server.cpp @@ -42,7 +42,7 @@ public: class App : public FastOS_Application { public: - int Main(); + int Main() override; }; diff --git a/jrt_test/src/tests/rpc-error/test-errors.cpp b/jrt_test/src/tests/rpc-error/test-errors.cpp index fd167b85085..07ff7425f9a 100644 --- a/jrt_test/src/tests/rpc-error/test-errors.cpp +++ b/jrt_test/src/tests/rpc-error/test-errors.cpp @@ -29,7 +29,7 @@ public: void testWrongParameters(); void testWrongReturnValues(); void testMethodFailed(); - int Main(); + int Main() override; }; diff --git a/juniper/src/test/SrcTestSuite.cpp b/juniper/src/test/SrcTestSuite.cpp index 689ed5b57bf..f73e4c8fc3a 100644 --- a/juniper/src/test/SrcTestSuite.cpp +++ b/juniper/src/test/SrcTestSuite.cpp @@ -53,7 +53,7 @@ SrcTestSuite::SrcTestSuite() : */ class SrcTestSuiteApp : public vespalib::TestApp { public: - virtual int Main(); + virtual int Main() override; }; int SrcTestSuiteApp::Main() { diff --git a/juniper/src/test/auxTest.cpp b/juniper/src/test/auxTest.cpp index 4b1274cb2a6..2dc3457e6c3 100644 --- a/juniper/src/test/auxTest.cpp +++ b/juniper/src/test/auxTest.cpp @@ -560,8 +560,7 @@ void AuxTest::test_summary(Matcher& m, const char* content, size_t content_len, class DefProps : public IJuniperProperties { public: - virtual const char* GetProperty(const char*, const char* def) - { + virtual const char* GetProperty(const char*, const char* def) override { return def; } }; @@ -627,13 +626,12 @@ public: TokenChecker(Token* output) : _out(output), i(0) { } - virtual void handle_token(Token& token) - { + virtual void handle_token(Token& token) override { _out[i] = token; i++; } - virtual void handle_end(Token&) {} + virtual void handle_end(Token&) override {} }; @@ -672,13 +670,13 @@ private: std::vector<std::string> _tokens; public: TokenProcessor(const std::string & text) : _text(text), _tokens() {} - virtual void handle_token(Token & t) { + virtual void handle_token(Token & t) override { _tokens.push_back(std::string(_text.c_str() + t.bytepos, t.bytelen)); //LOG(info, "handle_token(%s): bytepos(%d), wordpos(%d), bytelen(%d), curlen(%d)", //_tokens.back().c_str(), //(int)t.bytepos, (int)t.wordpos, t.bytelen, t.curlen); } - virtual void handle_end(Token & t) { + virtual void handle_end(Token & t) override { _tokens.push_back(std::string(_text.c_str() + t.bytepos, t.bytelen)); //LOG(info, "handle_end(%s): bytepos(%d), wordpos(%d), bytelen(%d), curlen(%d)", //_tokens.back().c_str(), diff --git a/juniper/src/test/auxTest.h b/juniper/src/test/auxTest.h index 43b89058b16..218dcaab6d0 100644 --- a/juniper/src/test/auxTest.h +++ b/juniper/src/test/auxTest.h @@ -25,14 +25,14 @@ public: void Run(MethodContainer::iterator &itr); void Run(const char* method); void Run(int argc, char* argv[]); - virtual void Run(); + virtual void Run() override; protected: /** * Since we are running within Emacs, the default behavior of * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() { *m_osptr << '.' << std::flush; } + virtual void print_progress() override { *m_osptr << '.' << std::flush; } private: // tests: void TestPropertyMap(); diff --git a/juniper/src/test/auxTestApp.cpp b/juniper/src/test/auxTestApp.cpp index 906a1c133dc..3f43c706d35 100644 --- a/juniper/src/test/auxTestApp.cpp +++ b/juniper/src/test/auxTestApp.cpp @@ -6,7 +6,7 @@ class AuxTestApp : public vespalib::TestApp { public: - virtual int Main(); + virtual int Main() override; }; diff --git a/juniper/src/test/fakerewriter.h b/juniper/src/test/fakerewriter.h index 8d09de56644..0a0554f76fc 100644 --- a/juniper/src/test/fakerewriter.h +++ b/juniper/src/test/fakerewriter.h @@ -8,10 +8,10 @@ class FakeRewriter: public juniper::IRewriter { public: FakeRewriter() : _name() {} - virtual const char* Name() const; - virtual juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term); - virtual juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term, size_t length); - virtual const char* NextTerm(juniper::RewriteHandle* exp, size_t& length); + virtual const char* Name() const override; + virtual juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term) override; + virtual juniper::RewriteHandle* Rewrite(uint32_t langid, const char* term, size_t length) override; + virtual const char* NextTerm(juniper::RewriteHandle* exp, size_t& length) override; private: std::string _name; }; diff --git a/juniper/src/test/matchobjectTest.h b/juniper/src/test/matchobjectTest.h index fb2c4bc0578..9e0828cfa77 100644 --- a/juniper/src/test/matchobjectTest.h +++ b/juniper/src/test/matchobjectTest.h @@ -98,7 +98,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() { *m_osptr << '.' << std::flush; } + virtual void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -109,7 +109,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run(); + virtual void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/matchobjectTestApp.cpp b/juniper/src/test/matchobjectTestApp.cpp index b83691ef338..065af199589 100644 --- a/juniper/src/test/matchobjectTestApp.cpp +++ b/juniper/src/test/matchobjectTestApp.cpp @@ -29,7 +29,7 @@ */ class MatchObjectTestApp : public vespalib::TestApp { public: - virtual int Main() { + virtual int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); MatchObjectTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/mcandTest.cpp b/juniper/src/test/mcandTest.cpp index 3da6b452ace..b185707c1be 100644 --- a/juniper/src/test/mcandTest.cpp +++ b/juniper/src/test/mcandTest.cpp @@ -405,13 +405,13 @@ struct MyTokenProcessor : public ITokenProcessor Matcher &_m; std::vector<size_t> _cands; MyTokenProcessor(Matcher &m) : _m(m), _cands() {} - virtual void handle_token(Token &token) { + virtual void handle_token(Token &token) override { _m.handle_token(token); const match_sequence *ms = _m.GetWorkSet(); _cands.push_back(ms[0].size()); LOG(info, "match_sequence[0].size(%zu)", _cands.back()); } - virtual void handle_end(Token &token) { + virtual void handle_end(Token &token) override { _m.handle_end(token); } }; diff --git a/juniper/src/test/mcandTest.h b/juniper/src/test/mcandTest.h index 52a8c626a15..754c18ee9dd 100644 --- a/juniper/src/test/mcandTest.h +++ b/juniper/src/test/mcandTest.h @@ -196,7 +196,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() { *m_osptr << '.' << std::flush; } + virtual void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -207,7 +207,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run(); + virtual void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/mcandTestApp.cpp b/juniper/src/test/mcandTestApp.cpp index 28692a01c73..8a93c14cfc9 100644 --- a/juniper/src/test/mcandTestApp.cpp +++ b/juniper/src/test/mcandTestApp.cpp @@ -29,7 +29,7 @@ */ class MatchCandidateTestApp : public vespalib::TestApp { public: - virtual int Main() { + virtual int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); MatchCandidateTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/queryparserTest.h b/juniper/src/test/queryparserTest.h index 1a13e4d3cc1..b4f464f7592 100644 --- a/juniper/src/test/queryparserTest.h +++ b/juniper/src/test/queryparserTest.h @@ -97,7 +97,7 @@ protected: * print_progress which includes backspace does not work. * We'll use a single '.' instead. */ - virtual void print_progress() { *m_osptr << '.' << std::flush; } + virtual void print_progress() override { *m_osptr << '.' << std::flush; } public: @@ -108,7 +108,7 @@ public: * main entry points *************************************************************************/ void Run(MethodContainer::iterator &itr); - virtual void Run(); + virtual void Run() override; void Run(const char *method); void Run(int argc, char* argv[]); }; diff --git a/juniper/src/test/queryparserTestApp.cpp b/juniper/src/test/queryparserTestApp.cpp index 2c999247478..3559b0177b6 100644 --- a/juniper/src/test/queryparserTestApp.cpp +++ b/juniper/src/test/queryparserTestApp.cpp @@ -29,7 +29,7 @@ */ class QueryParserTestApp : public vespalib::TestApp { public: - virtual int Main() { + virtual int Main() override { juniper::TestEnv te(this, TEST_PATH("../rpclient/testclient.rc").c_str()); QueryParserTest test; test.SetStream(&std::cout); diff --git a/juniper/src/test/testenv.h b/juniper/src/test/testenv.h index 1200ce6928e..88d250767fc 100644 --- a/juniper/src/test/testenv.h +++ b/juniper/src/test/testenv.h @@ -57,7 +57,7 @@ public: PropertyMap(); virtual ~PropertyMap(); PropertyMap &set(const char *name, const char *value); - virtual const char* GetProperty(const char* name, const char* def = NULL); + virtual const char* GetProperty(const char* name, const char* def = NULL) override; }; diff --git a/logd/src/logd/errhandle.h b/logd/src/logd/errhandle.h index 8c0dde2d00e..001ca0c9214 100644 --- a/logd/src/logd/errhandle.h +++ b/logd/src/logd/errhandle.h @@ -11,7 +11,7 @@ private: public: MsgException(const char *s) : _string(s) {} virtual ~MsgException() throw() {} - const char *what() const throw() { return _string.c_str(); } + const char *what() const throw() override { return _string.c_str(); } }; class ConnectionException : public MsgException diff --git a/logd/src/logd/perform.h b/logd/src/logd/perform.h index 57a1fd6fd66..db9e67e585e 100644 --- a/logd/src/logd/perform.h +++ b/logd/src/logd/perform.h @@ -19,7 +19,7 @@ private: Services& _services; void listStates(const char *service, const char *component); public: - void doCmd(char *line); + void doCmd(char *line) override; void doSetAllStates(char *levmods, char * line); char *doSetState(char *levmods, Component *cmp, char *line); ExternalPerformer(Forwarder& fw, Services& s) @@ -31,7 +31,7 @@ class InternalPerformer: public Performer { Services& _services; public: - void doCmd(char *line); + void doCmd(char *line) override; InternalPerformer(Services& s) : _services(s) {} ~InternalPerformer() {} }; diff --git a/memfilepersistence/src/tests/device/devicemanagertest.cpp b/memfilepersistence/src/tests/device/devicemanagertest.cpp index 7e26543349b..15882663383 100644 --- a/memfilepersistence/src/tests/device/devicemanagertest.cpp +++ b/memfilepersistence/src/tests/device/devicemanagertest.cpp @@ -72,14 +72,14 @@ namespace { Listener() : ost() { ost << "\n"; } virtual ~Listener() {} - virtual void handleDirectoryEvent(Directory& dir, const IOEvent& e) { + virtual void handleDirectoryEvent(Directory& dir, const IOEvent& e) override { ost << "Dir " << dir.getPath() << ": " << e.toString(true) << "\n"; } - virtual void handlePartitionEvent(Partition& part, const IOEvent& e) { + virtual void handlePartitionEvent(Partition& part, const IOEvent& e) override { ost << "Partition " << part.getMountPoint() << ": " << e.toString(true) << "\n"; } - virtual void handleDiskEvent(Disk& disk, const IOEvent& e) { + virtual void handleDiskEvent(Disk& disk, const IOEvent& e) override { ost << "Disk " << disk.getId() << ": " << e.toString(true) << "\n"; } diff --git a/memfilepersistence/src/tests/device/mountpointlisttest.cpp b/memfilepersistence/src/tests/device/mountpointlisttest.cpp index aaeff981af8..986b6fbe157 100644 --- a/memfilepersistence/src/tests/device/mountpointlisttest.cpp +++ b/memfilepersistence/src/tests/device/mountpointlisttest.cpp @@ -31,7 +31,7 @@ public: void testInitDisks(); void init(); - void tearDown(); + void tearDown() override; framework::defaultimplementation::FakeClock _clock; diff --git a/memfilepersistence/src/tests/device/partitionmonitortest.cpp b/memfilepersistence/src/tests/device/partitionmonitortest.cpp index faa8451e4d1..44f3752d840 100644 --- a/memfilepersistence/src/tests/device/partitionmonitortest.cpp +++ b/memfilepersistence/src/tests/device/partitionmonitortest.cpp @@ -56,7 +56,7 @@ struct FakeStatter : public PartitionMonitor::Statter { _info.f_bfree -= (size / _info.f_bsize); } - virtual void statFileSystem(const std::string&, struct statvfs& info) { + virtual void statFileSystem(const std::string&, struct statvfs& info) override { info = _info; } }; diff --git a/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp b/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp index b34adc7fa8f..673a72068b7 100644 --- a/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp +++ b/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp @@ -58,8 +58,8 @@ public: void testCachePrefetchRequirements(); void testBucketEvictedFromCacheOnIterateException(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; struct Chunk { diff --git a/memfilepersistence/src/tests/spi/memcachetest.cpp b/memfilepersistence/src/tests/spi/memcachetest.cpp index 939f116b88d..07697b79cac 100644 --- a/memfilepersistence/src/tests/spi/memcachetest.cpp +++ b/memfilepersistence/src/tests/spi/memcachetest.cpp @@ -130,7 +130,7 @@ private: } public: - void tearDown() { + void tearDown() override { _cache.reset(0); _metrics.reset(0); _component.reset(0); diff --git a/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp b/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp index 32fc9096963..eefe962979d 100644 --- a/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp +++ b/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp @@ -15,8 +15,8 @@ namespace memfile { class MemFileAutoRepairTest : public SingleDiskMemFileTestUtils { public: - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testFileMetadataCorruptionIsAutoRepaired(); void testDocumentContentCorruptionIsAutoRepaired(); diff --git a/memfilepersistence/src/tests/spi/memfilev1serializertest.cpp b/memfilepersistence/src/tests/spi/memfilev1serializertest.cpp index a5d1c50d043..ad20a28ed0c 100644 --- a/memfilepersistence/src/tests/spi/memfilev1serializertest.cpp +++ b/memfilepersistence/src/tests/spi/memfilev1serializertest.cpp @@ -15,7 +15,7 @@ namespace memfile { struct MemFileV1SerializerTest : public SingleDiskMemFileTestUtils { - void tearDown(); + void tearDown() override; void setUpPartialWriteEnvironment(); void resetConfig(uint32_t minimumFileSize, uint32_t minimumFileHeaderBlockSize); void doTestPartialWriteRemove(bool readAll); @@ -204,50 +204,50 @@ MemFileV1SerializerTest::resetConfig(uint32_t minimumFileSize, struct DummyMemFileIOInterface : MemFileIOInterface { Document::UP getDocumentHeader(const document::DocumentTypeRepo&, - DataLocation) const + DataLocation) const override { return Document::UP(); } - document::DocumentId getDocumentId(DataLocation) const { + document::DocumentId getDocumentId(DataLocation) const override { return document::DocumentId(""); } void readBody(const document::DocumentTypeRepo&, DataLocation, - Document&) const + Document&) const override { } DataLocation addDocumentIdOnlyHeader( const DocumentId&, - const document::DocumentTypeRepo&) + const document::DocumentTypeRepo&) override { return DataLocation(); } - DataLocation addHeader(const Document&) { return DataLocation(); } - DataLocation addBody(const Document&) { return DataLocation(); } - void clear(DocumentPart) {} - bool verifyConsistent() const { return true; } - void move(const FileSpecification&) {} + DataLocation addHeader(const Document&) override { return DataLocation(); } + DataLocation addBody(const Document&) override { return DataLocation(); } + void clear(DocumentPart) override {} + bool verifyConsistent() const override { return true; } + void move(const FileSpecification&) override {} DataLocation copyCache(const MemFileIOInterface&, DocumentPart, - DataLocation) + DataLocation) override { return DataLocation(); } - void close() {}; - bool isCached(DataLocation, DocumentPart) const { return false; } - bool isPersisted(DataLocation, DocumentPart) const { return false; } + void close() override {} + bool isCached(DataLocation, DocumentPart) const override { return false; } + bool isPersisted(DataLocation, DocumentPart) const override { return false; } uint32_t getSerializedSize(DocumentPart, - DataLocation) const { return 0; } + DataLocation) const override { return 0; } void ensureCached(Environment&, DocumentPart, - const std::vector<DataLocation>&) + const std::vector<DataLocation>&) override {} - size_t getCachedSize(DocumentPart) const { return 0; } + size_t getCachedSize(DocumentPart) const override { return 0; } }; #define VESPA_MEMFILEV1_SETUP_SOURCE \ diff --git a/memfilepersistence/src/tests/spi/memfilev1verifiertest.cpp b/memfilepersistence/src/tests/spi/memfilev1verifiertest.cpp index 0cf04eadaa2..51951e22aea 100644 --- a/memfilepersistence/src/tests/spi/memfilev1verifiertest.cpp +++ b/memfilepersistence/src/tests/spi/memfilev1verifiertest.cpp @@ -17,7 +17,7 @@ struct MemFileV1VerifierTest : public SingleDiskMemFileTestUtils { void testVerify(); - void tearDown(); + void tearDown() override; std::unique_ptr<MemFile> createMemFile(FileSpecification& file, bool callLoadFile) diff --git a/memfilepersistence/src/tests/spi/providerconformancetest.cpp b/memfilepersistence/src/tests/spi/providerconformancetest.cpp index 526f61a812c..8bc2237265b 100644 --- a/memfilepersistence/src/tests/spi/providerconformancetest.cpp +++ b/memfilepersistence/src/tests/spi/providerconformancetest.cpp @@ -39,7 +39,7 @@ struct ProviderConformanceTest : public spi::ConformanceTest { spi::PersistenceProvider::UP getPersistenceImplementation(const document::DocumentTypeRepo::SP& repo, - const document::DocumenttypesConfig&) + const document::DocumenttypesConfig&) override { system("rm -rf vdsroot"); system("mkdir -p vdsroot/disks/d0"); diff --git a/memfilepersistence/src/tests/spi/simplememfileiobuffertest.cpp b/memfilepersistence/src/tests/spi/simplememfileiobuffertest.cpp index 3eac7b57e81..ffe7972552f 100644 --- a/memfilepersistence/src/tests/spi/simplememfileiobuffertest.cpp +++ b/memfilepersistence/src/tests/spi/simplememfileiobuffertest.cpp @@ -51,21 +51,19 @@ class SimpleMemFileIOBufferTest : public SingleDiskMemFileTestUtils public: class DummyFileReader : public VersionSerializer { public: - virtual FileVersion getFileVersion() { return FileVersion(); } - virtual void loadFile(MemFile&, Environment&, - Buffer&, uint64_t ) {} - virtual FlushResult flushUpdatesToFile(MemFile&, Environment&) { + virtual FileVersion getFileVersion() override { return FileVersion(); } + virtual void loadFile(MemFile&, Environment&, Buffer&, uint64_t ) override {} + virtual FlushResult flushUpdatesToFile(MemFile&, Environment&) override { return FlushResult::TooSmall; } - virtual void rewriteFile(MemFile&, Environment&) {} + virtual void rewriteFile(MemFile&, Environment&) override {} virtual bool verify(MemFile&, Environment&, - std::ostream&, bool, - uint16_t) { return false; }; + std::ostream&, bool, uint16_t) override { return false; }; virtual void cacheLocations(MemFileIOInterface&, Environment&, const Options&, DocumentPart, - const std::vector<DataLocation>&) {} + const std::vector<DataLocation>&) override {} }; DummyFileReader dfr; diff --git a/memfilepersistence/src/tests/spi/simulatedfailurefile.h b/memfilepersistence/src/tests/spi/simulatedfailurefile.h index 825c9f53585..515b70e5e5a 100644 --- a/memfilepersistence/src/tests/spi/simulatedfailurefile.h +++ b/memfilepersistence/src/tests/spi/simulatedfailurefile.h @@ -18,7 +18,7 @@ public: : _readOpsBeforeFailure(-1), _writeOpsBeforeFailure(0) { } - vespalib::LazyFile::UP createFile(const std::string& fileName) const; + vespalib::LazyFile::UP createFile(const std::string& fileName) const override; void setReadOpsBeforeFailure(int ops) { _readOpsBeforeFailure = ops; @@ -38,8 +38,8 @@ public: int readOpsBeforeFailure, int writeOpsBeforeFailure); - off_t write(const void *buf, size_t bufsize, off_t offset); - size_t read(void *buf, size_t bufsize, off_t offset) const; + off_t write(const void *buf, size_t bufsize, off_t offset) override; + size_t read(void *buf, size_t bufsize, off_t offset) const override; }; } // ns memfile diff --git a/memfilepersistence/src/tests/tools/vdsdisktooltest.cpp b/memfilepersistence/src/tests/tools/vdsdisktooltest.cpp index 08bfa3bcab3..0f36f0a0571 100644 --- a/memfilepersistence/src/tests/tools/vdsdisktooltest.cpp +++ b/memfilepersistence/src/tests/tools/vdsdisktooltest.cpp @@ -15,7 +15,7 @@ struct VdsDiskToolTest : public SingleDiskMemFileTestUtils { framework::defaultimplementation::FakeClock _clock; - void setUp(); + void setUp() override; void setupRoot(); void testSimple(); diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/environment.h b/memfilepersistence/src/vespa/memfilepersistence/common/environment.h index a73ad4ceea9..243c9054ded 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/environment.h +++ b/memfilepersistence/src/vespa/memfilepersistence/common/environment.h @@ -126,7 +126,7 @@ struct DefaultLazyFileFactory DefaultLazyFileFactory(int flags) : _flags(flags) {} - vespalib::LazyFile::UP createFile(const std::string& fileName) const; + vespalib::LazyFile::UP createFile(const std::string& fileName) const override; }; } // storage diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h b/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h index 63dd0d3172e..23e4857fdb3 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h +++ b/memfilepersistence/src/vespa/memfilepersistence/common/filespecification.h @@ -38,7 +38,7 @@ public: FileVersion getWantedFileVersion() const { return _wantedVersion; } virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; bool operator==(const FileSpecification& o) const { return (_bucketId == o._bucketId && _dir == o._dir diff --git a/memfilepersistence/src/vespa/memfilepersistence/common/options.h b/memfilepersistence/src/vespa/memfilepersistence/common/options.h index a83657a9189..ecc11251f89 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/common/options.h +++ b/memfilepersistence/src/vespa/memfilepersistence/common/options.h @@ -101,7 +101,7 @@ struct Options : public vespalib::Printable /** Printable implementation */ void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; bool operator==(const Options& options) const { if (_minimumFileMetaSlots == options._minimumFileMetaSlots diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp index dfca9dc7d27..b483d4691c4 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/device/partitionmonitor.cpp @@ -26,8 +26,7 @@ namespace { } struct RealStatter : public PartitionMonitor::Statter { - virtual void statFileSystem(const std::string& file, - struct statvfs& info) + virtual void statFileSystem(const std::string& file, struct statvfs& info) override { if (statvfs(file.c_str(), &info) != 0) { vespalib::asciistream ost; diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/locationreadplanner.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/locationreadplanner.h index 915f158eb85..d56f5f80441 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/locationreadplanner.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/locationreadplanner.h @@ -41,7 +41,7 @@ public: uint32_t getTotalBufferSize() const; void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; private: const MemFileIOInterface& _io; diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp index 66e263a88cf..742a37fcf36 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.cpp @@ -742,19 +742,19 @@ namespace { _buffer.resize(firstAligned - _headerBlockIndex); } - virtual uint32_t getCachedAmount() const + virtual uint32_t getCachedAmount() const override { return _buffer.size() + _headerBlockIndex; } - virtual char* getCache(uint32_t pos) { + virtual char* getCache(uint32_t pos) override { // We should never get requests to write prior to header block // index. assert(pos >= _headerBlockIndex); return (&_buffer[0] + (pos - _headerBlockIndex)); } - virtual bool duplicateCacheWrite() const { return true; } + virtual bool duplicateCacheWrite() const override { return true; } - virtual void setData(const char* data, size_t len, uint64_t pos) { + virtual void setData(const char* data, size_t len, uint64_t pos) override { if (pos < _headerBlockIndex) { if (len <= _headerBlockIndex - pos) return; uint32_t diff = (_headerBlockIndex - pos); diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.h index 04d62074f05..283ab174895 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/memfile_v1_serializer.h @@ -22,10 +22,10 @@ public: MemFileV1Serializer(ThreadMetricProvider&); - virtual FileVersion getFileVersion() { return TRADITIONAL_SLOTFILE; } + virtual FileVersion getFileVersion() override { return TRADITIONAL_SLOTFILE; } virtual void loadFile(MemFile& file, Environment&, - Buffer& buffer, uint64_t bytesRead); + Buffer& buffer, uint64_t bytesRead) override; void cacheLocationsForPart(SimpleMemFileIOBuffer& cache, DocumentPart part, @@ -38,15 +38,15 @@ public: Environment& env, const Options& options, DocumentPart part, - const std::vector<DataLocation>& locations); + const std::vector<DataLocation>& locations) override; - virtual FlushResult flushUpdatesToFile(MemFile&, Environment&); + virtual FlushResult flushUpdatesToFile(MemFile&, Environment&) override; - virtual void rewriteFile(MemFile&, Environment&); + virtual void rewriteFile(MemFile&, Environment&) override; virtual bool verify(MemFile&, Environment&, std::ostream& errorReport, bool repairErrors, - uint16_t fileVerifyFlags); + uint16_t fileVerifyFlags) override; uint64_t read(vespalib::LazyFile& file, char* buf, diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h index 40c5ffb4865..6ed529e6c80 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h @@ -213,37 +213,37 @@ public: virtual Document::UP getDocumentHeader( const document::DocumentTypeRepo& repo, - DataLocation loc) const; + DataLocation loc) const override; - virtual document::DocumentId getDocumentId(DataLocation loc) const; + virtual document::DocumentId getDocumentId(DataLocation loc) const override; virtual void readBody( const document::DocumentTypeRepo& repo, DataLocation loc, - Document& doc) const; + Document& doc) const override; virtual DataLocation addDocumentIdOnlyHeader( const DocumentId& id, - const document::DocumentTypeRepo& repo); + const document::DocumentTypeRepo& repo) override; - virtual DataLocation addHeader(const Document& doc); + virtual DataLocation addHeader(const Document& doc) override; - virtual DataLocation addBody(const Document& doc); + virtual DataLocation addBody(const Document& doc) override; - virtual void clear(DocumentPart type); + virtual void clear(DocumentPart type) override; - virtual bool verifyConsistent() const; + virtual bool verifyConsistent() const override; /** * Moves the underlying file to another location. */ - virtual void move(const FileSpecification& target); + virtual void move(const FileSpecification& target) override; - virtual void close(); + virtual void close() override; virtual DataLocation copyCache(const MemFileIOInterface& source, DocumentPart part, - DataLocation loc); + DataLocation loc) override; /** * Add a location -> buffer mapping @@ -256,19 +256,19 @@ public: /** * @return Returns true if the given location is cached. */ - virtual bool isCached(DataLocation loc, DocumentPart type) const; + virtual bool isCached(DataLocation loc, DocumentPart type) const override; /** * @return Returns true if the given location has been persisted to disk. */ - virtual bool isPersisted(DataLocation loc, DocumentPart type) const; + virtual bool isPersisted(DataLocation loc, DocumentPart type) const override; virtual uint32_t getSerializedSize(DocumentPart part, - DataLocation loc) const; + DataLocation loc) const override; virtual void ensureCached(Environment& env, DocumentPart part, - const std::vector<DataLocation>& locations); + const std::vector<DataLocation>& locations) override; /** * Moves the given location into the persisted data area. @@ -293,7 +293,7 @@ public: const char* getBuffer(DataLocation loc, DocumentPart part) const; - size_t getCachedSize(DocumentPart part) const; + size_t getCachedSize(DocumentPart part) const override; BufferAllocation allocateBuffer(DocumentPart part, uint32_t sz, diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/uniqueslotgenerator.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/uniqueslotgenerator.h index c2ce3adede8..72cd6945235 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/uniqueslotgenerator.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/uniqueslotgenerator.h @@ -36,7 +36,7 @@ private: bool operator==(const ContentLocation& other) const; void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; }; void addSlot(DocumentPart, const MemSlot&); @@ -58,7 +58,7 @@ public: return *_slotsInOrder[part][uniqueIndex]; } - void print(std::ostream&, bool verbose, const std::string& indent) const; + void print(std::ostream&, bool verbose, const std::string& indent) const override; }; diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h index ccd8a306332..b3ac15ed376 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfile.h @@ -294,7 +294,7 @@ public: void printEntriesState(std::ostream& out, bool verbose, const std::string& indent) const; void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; /** Stat wants control of printing of slots. */ void printUserFriendly(const MemSlot& slot, diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.cpp b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.cpp index efa26605f37..8ea60d57f80 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.cpp @@ -121,20 +121,20 @@ struct MemFileCache::CacheEntryGuard : public MemFilePtr::EntryGuard { return _entry->_file; } - virtual void deleteFile() { + virtual void deleteFile() override { LOG(debug, "Cache entry guard deleting %s", _file->toString().c_str()); _env._memFileMapper.deleteFile(*_file, _env); erase(); } - virtual void erase() { + virtual void erase() override { LOG(debug, "Cache entry guard erasing %s from cache", _file->toString().c_str()); _cache.erase(document::BucketId(_entry->_file.getFile().getBucketId())); _entry = 0; } - virtual void move(EntryGuard& target) { + virtual void move(EntryGuard& target) override { LOG(debug, "Cache entry guard moving %s", _file->toString().c_str()); _cache.move(*this, static_cast<CacheEntryGuard&>(target)); } diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h b/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h index d62bdf10025..b1d68591b92 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/slotiterator.h @@ -65,8 +65,8 @@ public: Timestamp fromTimestamp, Timestamp toTimestamp); - virtual void iterate() const; - virtual SlotIterator* clone() const; + virtual void iterate() const override; + virtual SlotIterator* clone() const override; }; class AllSlotsIterator : public SlotIterator { @@ -82,8 +82,8 @@ public: Timestamp fromTimestamp, Timestamp toTimestamp); - virtual void iterate() const; - virtual SlotIterator* clone() const; + virtual void iterate() const override; + virtual SlotIterator* clone() const override; }; /** diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/splitoperationhandler.cpp b/memfilepersistence/src/vespa/memfilepersistence/spi/splitoperationhandler.cpp index 34d86259832..247722588f5 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/spi/splitoperationhandler.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/spi/splitoperationhandler.cpp @@ -25,7 +25,7 @@ struct BucketMatcher : public SlotMatcher { _factory(factory), _bid(bid) {} - virtual bool match(const Slot& slot) { + virtual bool match(const Slot& slot) override { document::DocumentId id(slot.getDocumentId()); document::BucketId bucket = _factory.getBucketId(id); bucket.setUsedBits(_bid.getUsedBits()); diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp index 030bac0752e..c794d611767 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp @@ -162,7 +162,7 @@ namespace { const char* documentConfigId); ~EnvironmentImpl(); - MemFilePersistenceThreadMetrics& getMetrics() const { + MemFilePersistenceThreadMetrics& getMetrics() const override { return *_threadMetrics; } diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfileapp.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfileapp.cpp index 3f8941274e8..f8d13714ae9 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfileapp.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfileapp.cpp @@ -8,7 +8,7 @@ namespace { struct DumpSlotFileApp : public FastOS_Application { - int Main() { + int Main() override { try{ config::ConfigUri config(""); return storage::memfile::SlotFileDumper::dump( diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdiskapp.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdiskapp.cpp index 394c4fafffb..7127c75cb1b 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdiskapp.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdiskapp.cpp @@ -10,7 +10,7 @@ LOG_SETUP(".vdsdisktool"); namespace { struct DiskApp : public FastOS_Application { - int Main() { + int Main() override { try { std::string dir = vespa::Defaults::vespaHome(); dir.append("var/db/vespa/vds"); diff --git a/messagebus/src/tests/advancedrouting/advancedrouting.cpp b/messagebus/src/tests/advancedrouting/advancedrouting.cpp index 26e62ca7956..ffd3db9440b 100644 --- a/messagebus/src/tests/advancedrouting/advancedrouting.cpp +++ b/messagebus/src/tests/advancedrouting/advancedrouting.cpp @@ -42,7 +42,7 @@ private: bool testTrace(const std::vector<string> &expected, const Trace &trace); public: - int Main(); + int Main() override; void testAdvanced(TestData &data); }; diff --git a/messagebus/src/tests/bucketsequence/bucketsequence.cpp b/messagebus/src/tests/bucketsequence/bucketsequence.cpp index 2661a0e86e1..9438b60a637 100644 --- a/messagebus/src/tests/bucketsequence/bucketsequence.cpp +++ b/messagebus/src/tests/bucketsequence/bucketsequence.cpp @@ -17,7 +17,7 @@ TEST_SETUP(Test); class MyMessage : public SimpleMessage { public: MyMessage() : SimpleMessage("foo") { } - bool hasBucketSequence() { return true; } + bool hasBucketSequence() override { return true; } }; int diff --git a/messagebus/src/tests/choke/choke.cpp b/messagebus/src/tests/choke/choke.cpp index 4c223f6a55a..2f4005cdb41 100644 --- a/messagebus/src/tests/choke/choke.cpp +++ b/messagebus/src/tests/choke/choke.cpp @@ -39,7 +39,7 @@ private: Message::UP createMessage(const string &msg); public: - int Main(); + int Main() override; void testMaxCount(TestData &data); void testMaxSize(TestData &data); }; diff --git a/messagebus/src/tests/configagent/configagent.cpp b/messagebus/src/tests/configagent/configagent.cpp index 29b58494c8a..eb99cd739a0 100644 --- a/messagebus/src/tests/configagent/configagent.cpp +++ b/messagebus/src/tests/configagent/configagent.cpp @@ -18,8 +18,8 @@ private: bool checkTables(uint32_t numTables); public: - int Main(); - bool setupRouting(const RoutingSpec &spec); + int Main() override; + bool setupRouting(const RoutingSpec &spec) override; }; TEST_APPHOOK(Test); diff --git a/messagebus/src/tests/context/context.cpp b/messagebus/src/tests/context/context.cpp index 99d674c4997..5ad36df7c72 100644 --- a/messagebus/src/tests/context/context.cpp +++ b/messagebus/src/tests/context/context.cpp @@ -27,7 +27,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) { + virtual void handleMessage(Message::UP msg) override { session->acknowledge(std::move(msg)); } }; diff --git a/messagebus/src/tests/loadbalance/loadbalance.cpp b/messagebus/src/tests/loadbalance/loadbalance.cpp index 7e917ee79c7..83ff4c042da 100644 --- a/messagebus/src/tests/loadbalance/loadbalance.cpp +++ b/messagebus/src/tests/loadbalance/loadbalance.cpp @@ -28,7 +28,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) { + virtual void handleMessage(Message::UP msg) override { ++cnt; session->acknowledge(std::move(msg)); } diff --git a/messagebus/src/tests/messagebus/messagebus.cpp b/messagebus/src/tests/messagebus/messagebus.cpp index ecfec5ac873..25d0ed51711 100644 --- a/messagebus/src/tests/messagebus/messagebus.cpp +++ b/messagebus/src/tests/messagebus/messagebus.cpp @@ -117,7 +117,7 @@ private: std::vector<Search*> searchVec; public: - int Main(); + int Main() override; void testSendToAny(); void testSendToCol(); void testSendToAnyThenCol(); diff --git a/messagebus/src/tests/messageordering/messageordering.cpp b/messagebus/src/tests/messageordering/messageordering.cpp index 0c102915cb1..e80505b2e89 100644 --- a/messagebus/src/tests/messageordering/messageordering.cpp +++ b/messagebus/src/tests/messageordering/messageordering.cpp @@ -46,7 +46,7 @@ public: _destinationSession(0), _messageCounter(0) {} - virtual void handleMessage(Message::UP msg) + virtual void handleMessage(Message::UP msg) override { SimpleMessage& simpleMsg(dynamic_cast<SimpleMessage&>(*msg)); LOG(spam, "Attempting to acquire lock for %s", @@ -90,7 +90,7 @@ class VerifyReplyReceptor : public IReplyHandler public: ~VerifyReplyReceptor(); VerifyReplyReceptor(); - void handleReply(Reply::UP reply); + void handleReply(Reply::UP reply) override; void waitUntilDone(int waitForCount) const; const std::string& getFailure() const { return _failure; } }; diff --git a/messagebus/src/tests/messenger/messenger.cpp b/messagebus/src/tests/messenger/messenger.cpp index a736814aa3d..5cf3625523f 100644 --- a/messagebus/src/tests/messenger/messenger.cpp +++ b/messagebus/src/tests/messenger/messenger.cpp @@ -13,11 +13,11 @@ TEST_SETUP(Test); class ThrowException : public Messenger::ITask { public: - void run() { + void run() override { throw std::exception(); } - uint8_t priority() const { + uint8_t priority() const override { return 0; } }; @@ -33,11 +33,11 @@ public: // empty } - void run() { + void run() override { _barrier.await(); } - uint8_t priority() const { + uint8_t priority() const override { return 0; } }; diff --git a/messagebus/src/tests/oos/oos.cpp b/messagebus/src/tests/oos/oos.cpp index 0ff93cecd7d..b19de4a94f8 100644 --- a/messagebus/src/tests/oos/oos.cpp +++ b/messagebus/src/tests/oos/oos.cpp @@ -31,7 +31,7 @@ struct Handler : public IMessageHandler ~Handler() { session.reset(); } - virtual void handleMessage(Message::UP msg) { + virtual void handleMessage(Message::UP msg) override { session->acknowledge(std::move(msg)); } }; @@ -46,7 +46,7 @@ private: public: Test(); - int Main(); + int Main() override; }; TEST_APPHOOK(Test); diff --git a/messagebus/src/tests/protocolrepository/protocolrepository.cpp b/messagebus/src/tests/protocolrepository/protocolrepository.cpp index e1b1d1402dd..cf1d77bdc7e 100644 --- a/messagebus/src/tests/protocolrepository/protocolrepository.cpp +++ b/messagebus/src/tests/protocolrepository/protocolrepository.cpp @@ -23,13 +23,13 @@ public: } const string & - getName() const + getName() const override { return _name; } IRoutingPolicy::UP - createPolicy(const string &name, const string ¶m) const + createPolicy(const string &name, const string ¶m) const override { (void)name; (void)param; @@ -37,7 +37,7 @@ public: } Blob - encode(const vespalib::Version &version, const Routable &routable) const + encode(const vespalib::Version &version, const Routable &routable) const override { (void)version; (void)routable; @@ -45,7 +45,7 @@ public: } Routable::UP - decode(const vespalib::Version &version, BlobRef data) const + decode(const vespalib::Version &version, BlobRef data) const override { (void)version; (void)data; diff --git a/messagebus/src/tests/replygate/replygate.cpp b/messagebus/src/tests/replygate/replygate.cpp index 09368da3974..d190f278be4 100644 --- a/messagebus/src/tests/replygate/replygate.cpp +++ b/messagebus/src/tests/replygate/replygate.cpp @@ -44,7 +44,7 @@ struct MySender : public IMessageHandler { // giving a sync reply here is against the API contract, but it is // ok for testing. - virtual void handleMessage(Message::UP msg) { + virtual void handleMessage(Message::UP msg) override { Reply::UP reply(new MyReply()); msg->swapState(*reply); IReplyHandler &handler = reply->getCallStack().pop(*reply); diff --git a/messagebus/src/tests/resender/resender.cpp b/messagebus/src/tests/resender/resender.cpp index c559f244a62..dad8ef73e68 100644 --- a/messagebus/src/tests/resender/resender.cpp +++ b/messagebus/src/tests/resender/resender.cpp @@ -66,7 +66,7 @@ private: void replyFromDestination(TestData &data, Message::UP msg, uint32_t errorCode, double retryDelay); public: - int Main(); + int Main() override; void testRetryTag(TestData &data); void testRetryEnabledTag(TestData &data); void testTransientError(TestData &data); diff --git a/messagebus/src/tests/result/result.cpp b/messagebus/src/tests/result/result.cpp index 1b081f5fc9e..a404135d64c 100644 --- a/messagebus/src/tests/result/result.cpp +++ b/messagebus/src/tests/result/result.cpp @@ -28,7 +28,7 @@ struct Test : public vespalib::TestApp { Result sendOk(Message::UP msg); Result sendFail(Message::UP msg); - int Main(); + int Main() override; }; Result diff --git a/messagebus/src/tests/routablequeue/routablequeue.cpp b/messagebus/src/tests/routablequeue/routablequeue.cpp index 09d14b03983..a6bd66bd5df 100644 --- a/messagebus/src/tests/routablequeue/routablequeue.cpp +++ b/messagebus/src/tests/routablequeue/routablequeue.cpp @@ -17,7 +17,7 @@ private: public: TestMessage(uint32_t id) : SimpleMessage(""), _id(id) { ++_cnt; } virtual ~TestMessage() { --_cnt; } - virtual uint32_t getType() const { return _id; } + virtual uint32_t getType() const override { return _id; } static uint32_t getCnt() { return _cnt; } }; uint32_t TestMessage::_cnt = 0; @@ -29,7 +29,7 @@ private: public: TestReply(uint32_t id) : SimpleReply(""), _id(id) { ++_cnt; } virtual ~TestReply() { --_cnt; } - virtual uint32_t getType() const { return _id; } + virtual uint32_t getType() const override { return _id; } static uint32_t getCnt() { return _cnt; } }; uint32_t TestReply::_cnt = 0; diff --git a/messagebus/src/tests/routeparser/routeparser.cpp b/messagebus/src/tests/routeparser/routeparser.cpp index d5522a7167a..a00cea825ba 100644 --- a/messagebus/src/tests/routeparser/routeparser.cpp +++ b/messagebus/src/tests/routeparser/routeparser.cpp @@ -20,7 +20,7 @@ using namespace mbus; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; void testHopParser(); void testHopParserErrors(); void testRouteParser(); diff --git a/messagebus/src/tests/routing/routing.cpp b/messagebus/src/tests/routing/routing.cpp index be0a69e855a..506d003a8b7 100644 --- a/messagebus/src/tests/routing/routing.cpp +++ b/messagebus/src/tests/routing/routing.cpp @@ -59,7 +59,7 @@ public: const std::vector<uint32_t> consumableErrors, const std::vector<Route> routes, uint32_t idxRemove); - void merge(RoutingContext &ctx); + void merge(RoutingContext &ctx) override; }; RemoveReplyPolicy::RemoveReplyPolicy(bool selectOnRetry, @@ -87,7 +87,7 @@ public: RemoveReplyPolicyFactory(bool selectOnRetry, const std::vector<uint32_t> &consumableErrors, uint32_t idxRemove); - IRoutingPolicy::UP create(const string ¶m); + IRoutingPolicy::UP create(const string ¶m) override; }; RemoveReplyPolicyFactory::RemoveReplyPolicyFactory(bool selectOnRetry, @@ -115,7 +115,7 @@ public: ReuseReplyPolicy(bool selectOnRetry, const std::vector<uint32_t> &errorMask, const std::vector<Route> &routes); - void merge(RoutingContext &ctx); + void merge(RoutingContext &ctx) override; }; ReuseReplyPolicy::ReuseReplyPolicy(bool selectOnRetry, @@ -164,7 +164,7 @@ private: public: ReuseReplyPolicyFactory(bool selectOnRetry, const std::vector<uint32_t> &errorMask); - IRoutingPolicy::UP create(const string ¶m); + IRoutingPolicy::UP create(const string ¶m) override; }; ReuseReplyPolicyFactory::ReuseReplyPolicyFactory(bool selectOnRetry, @@ -193,8 +193,8 @@ public: SetReplyPolicy(bool selectOnRetry, const std::vector<uint32_t> &errors, const string ¶m); - void select(RoutingContext &ctx); - void merge(RoutingContext &ctx); + void select(RoutingContext &ctx) override; + void merge(RoutingContext &ctx) override; }; SetReplyPolicy::SetReplyPolicy(bool selectOnRetry, @@ -236,7 +236,7 @@ private: public: SetReplyPolicyFactory(bool selectOnRetry, const std::vector<uint32_t> &errors); - IRoutingPolicy::UP create(const string ¶m); + IRoutingPolicy::UP create(const string ¶m) override; }; SetReplyPolicyFactory::SetReplyPolicyFactory(bool selectOnRetry, @@ -254,26 +254,26 @@ SetReplyPolicyFactory::create(const string ¶m) } class TestException : public std::exception { - virtual const char* what() const throw() { + virtual const char* what() const throw() override { return "{test exception}"; } }; class SelectExceptionPolicy : public IRoutingPolicy { public: - void select(RoutingContext &ctx) { + void select(RoutingContext &ctx) override { (void)ctx; throw TestException(); } - void merge(RoutingContext &ctx) { + void merge(RoutingContext &ctx) override { (void)ctx; } }; class SelectExceptionPolicyFactory : public SimpleProtocol::IPolicyFactory { public: - IRoutingPolicy::UP create(const string ¶m) { + IRoutingPolicy::UP create(const string ¶m) override { (void)param; return IRoutingPolicy::UP(new SelectExceptionPolicy()); } @@ -290,11 +290,11 @@ public: // empty } - void select(RoutingContext &ctx) { + void select(RoutingContext &ctx) override { ctx.addChild(Route::parse(_select)); } - void merge(RoutingContext &ctx) { + void merge(RoutingContext &ctx) override { (void)ctx; throw TestException(); } @@ -302,7 +302,7 @@ public: class MergeExceptionPolicyFactory : public SimpleProtocol::IPolicyFactory { public: - IRoutingPolicy::UP create(const string ¶m) { + IRoutingPolicy::UP create(const string ¶m) override { return IRoutingPolicy::UP(new MergeExceptionPolicy(param)); } }; @@ -336,7 +336,7 @@ public: } IRoutingPolicy::UP - create(const string ¶m); + create(const string ¶m) override; static MyPolicyFactory::SP newInstance(const string &selectRoute, @@ -419,7 +419,7 @@ public: } virtual void - select(RoutingContext &ctx) + select(RoutingContext &ctx) override { if (!_parent._selectRoute.empty()) { ctx.addChild(Route::parse(_parent._selectRoute)); @@ -435,7 +435,7 @@ public: } virtual void - merge(RoutingContext &ctx) + merge(RoutingContext &ctx) override { if (_parent._mergeError != ErrorCode::NONE) { Reply::UP reply(new EmptyReply()); @@ -494,7 +494,7 @@ private: static const double RECEPTOR_TIMEOUT; public: - int Main(); + int Main() override; void testNoRoutingTable(TestData &data); void testUnknownRoute(TestData &data); void testNoRoute(TestData &data); diff --git a/messagebus/src/tests/routingcontext/routingcontext.cpp b/messagebus/src/tests/routingcontext/routingcontext.cpp index d8d76a3069c..6ee62b4d697 100644 --- a/messagebus/src/tests/routingcontext/routingcontext.cpp +++ b/messagebus/src/tests/routingcontext/routingcontext.cpp @@ -50,7 +50,7 @@ public: CustomPolicyFactory(bool forward, const std::vector<string> &all, const std::vector<string> &matched); - IRoutingPolicy::UP create(const string ¶m); + IRoutingPolicy::UP create(const string ¶m) override; }; class CustomPolicy : public IRoutingPolicy { @@ -59,8 +59,8 @@ private: public: CustomPolicy(CustomPolicyFactory &factory); - void select(RoutingContext &ctx); - void merge(RoutingContext &ctx); + void select(RoutingContext &ctx) override; + void merge(RoutingContext &ctx) override; }; CustomPolicy::CustomPolicy(CustomPolicyFactory &factory) : @@ -211,7 +211,7 @@ private: Message::UP createMessage(const string &msg); public: - int Main(); + int Main() override; void testSingleDirective(TestData &data); void testMoreDirectives(TestData &data); void testRecipientsRemain(TestData &data); diff --git a/messagebus/src/tests/routingspec/routingspec.cpp b/messagebus/src/tests/routingspec/routingspec.cpp index 32d235c0a11..6ca7fef44db 100644 --- a/messagebus/src/tests/routingspec/routingspec.cpp +++ b/messagebus/src/tests/routingspec/routingspec.cpp @@ -22,7 +22,7 @@ public: // empty } - bool setupRouting(const RoutingSpec &spec) { + bool setupRouting(const RoutingSpec &spec) override { _routing = spec; return true; } @@ -40,7 +40,7 @@ private: public: void testConstructors(); void testConfigGeneration(); - int Main(); + int Main() override; }; TEST_APPHOOK(Test); diff --git a/messagebus/src/tests/sendadapter/sendadapter.cpp b/messagebus/src/tests/sendadapter/sendadapter.cpp index f4973b96e31..bcac60d800a 100644 --- a/messagebus/src/tests/sendadapter/sendadapter.cpp +++ b/messagebus/src/tests/sendadapter/sendadapter.cpp @@ -26,11 +26,11 @@ private: public: typedef std::shared_ptr<TestProtocol> SP; - mbus::Blob encode(const vespalib::Version &version, const mbus::Routable &routable) const { + mbus::Blob encode(const vespalib::Version &version, const mbus::Routable &routable) const override { _lastVersion = version; return mbus::SimpleProtocol::encode(version, routable); } - mbus::Routable::UP decode(const vespalib::Version &version, mbus::BlobRef blob) const { + mbus::Routable::UP decode(const vespalib::Version &version, mbus::BlobRef blob) const override { _lastVersion = version; return mbus::SimpleProtocol::decode(version, blob); } @@ -70,7 +70,7 @@ private: void testSendAdapters(TestData &data); public: - int Main(); + int Main() override; }; TEST_APPHOOK(Test); diff --git a/messagebus/src/tests/sequencer/sequencer.cpp b/messagebus/src/tests/sequencer/sequencer.cpp index b2818cfa57d..6db2455c4a8 100644 --- a/messagebus/src/tests/sequencer/sequencer.cpp +++ b/messagebus/src/tests/sequencer/sequencer.cpp @@ -87,7 +87,7 @@ private: void testSyncId(); public: - int Main() { + int Main() override { TEST_INIT("sequencer_test"); testSyncNone(); TEST_FLUSH(); diff --git a/messagebus/src/tests/serviceaddress/serviceaddress.cpp b/messagebus/src/tests/serviceaddress/serviceaddress.cpp index e8fb670dd9b..ec2d1374e9b 100644 --- a/messagebus/src/tests/serviceaddress/serviceaddress.cpp +++ b/messagebus/src/tests/serviceaddress/serviceaddress.cpp @@ -26,7 +26,7 @@ using namespace mbus; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; void testAddrServiceAddress(); void testNameServiceAddress(); diff --git a/messagebus/src/tests/servicepool/servicepool.cpp b/messagebus/src/tests/servicepool/servicepool.cpp index 5cf4b8b6132..8601cfa8fee 100644 --- a/messagebus/src/tests/servicepool/servicepool.cpp +++ b/messagebus/src/tests/servicepool/servicepool.cpp @@ -14,7 +14,7 @@ private: void testMaxSize(); public: - int Main() { + int Main() override { TEST_INIT("servicepool_test"); testMaxSize(); TEST_FLUSH(); diff --git a/messagebus/src/tests/shutdown/shutdown.cpp b/messagebus/src/tests/shutdown/shutdown.cpp index d4c5544d469..5f5fe847f57 100644 --- a/messagebus/src/tests/shutdown/shutdown.cpp +++ b/messagebus/src/tests/shutdown/shutdown.cpp @@ -26,7 +26,7 @@ private: void requireThatShutdownOnIntermediateWithPendingIsSafe(); public: - int Main() { + int Main() override { TEST_INIT("shutdown_test"); requireThatListenFailedIsExceptionSafe(); TEST_FLUSH(); diff --git a/messagebus/src/tests/sourcesession/sourcesession.cpp b/messagebus/src/tests/sourcesession/sourcesession.cpp index f70789d81af..24d99f5d44f 100644 --- a/messagebus/src/tests/sourcesession/sourcesession.cpp +++ b/messagebus/src/tests/sourcesession/sourcesession.cpp @@ -34,7 +34,7 @@ struct DelayedHandler : public IMessageHandler ~DelayedHandler() { session.reset(); } - virtual void handleMessage(Message::UP msg) { + virtual void handleMessage(Message::UP msg) override { // this will block the transport thread in the server messagebus, // but that should be ok, as we only want to test the timing in the // client messagebus... @@ -77,7 +77,7 @@ public: void testNoServices(); void testBlockingClose(); void testNonBlockingClose(); - int Main(); + int Main() override; }; void diff --git a/messagebus/src/tests/targetpool/targetpool.cpp b/messagebus/src/tests/targetpool/targetpool.cpp index 855784ec557..30744e74202 100644 --- a/messagebus/src/tests/targetpool/targetpool.cpp +++ b/messagebus/src/tests/targetpool/targetpool.cpp @@ -18,7 +18,7 @@ public: // empty } - uint64_t getMilliTime() const { + uint64_t getMilliTime() const override { return millis; } }; diff --git a/messagebus/src/tests/throttling/throttling.cpp b/messagebus/src/tests/throttling/throttling.cpp index 6d543318559..acc5b2ddc4d 100644 --- a/messagebus/src/tests/throttling/throttling.cpp +++ b/messagebus/src/tests/throttling/throttling.cpp @@ -35,7 +35,7 @@ public: // empty } - uint64_t getMilliTime() const { + uint64_t getMilliTime() const override { return _millis; } }; @@ -90,7 +90,7 @@ protected: void testMaxWindowSize(); public: - int Main(); + int Main() override; }; int diff --git a/messagebus/src/tests/timeout/timeout.cpp b/messagebus/src/tests/timeout/timeout.cpp index 8d6b1739776..d51ee34a08b 100644 --- a/messagebus/src/tests/timeout/timeout.cpp +++ b/messagebus/src/tests/timeout/timeout.cpp @@ -18,7 +18,7 @@ using namespace mbus; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; void testZeroTimeout(); void testMessageExpires(); }; diff --git a/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp b/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp index 72158383807..5a9324257b5 100644 --- a/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp +++ b/messagebus/src/tests/trace-roundtrip/trace-roundtrip.cpp @@ -28,8 +28,8 @@ private: IntermediateSession::UP _session; public: Proxy(MessageBus &bus); - void handleMessage(Message::UP msg); - void handleReply(Reply::UP reply); + void handleMessage(Message::UP msg) override; + void handleReply(Reply::UP reply) override; }; Proxy::Proxy(MessageBus &bus) @@ -57,7 +57,7 @@ private: DestinationSession::UP _session; public: Server(MessageBus &bus); - void handleMessage(Message::UP msg); + void handleMessage(Message::UP msg) override; }; Server::Server(MessageBus &bus) diff --git a/messagebus/src/vespa/messagebus/configagent.h b/messagebus/src/vespa/messagebus/configagent.h index 8b00f403061..9b84f84f8df 100644 --- a/messagebus/src/vespa/messagebus/configagent.h +++ b/messagebus/src/vespa/messagebus/configagent.h @@ -26,7 +26,7 @@ public: ConfigAgent(IConfigHandler & handler); // Implements IFetcherCallback - void configure(std::unique_ptr<messagebus::MessagebusConfig> config); + void configure(std::unique_ptr<messagebus::MessagebusConfig> config) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/destinationsession.h b/messagebus/src/vespa/messagebus/destinationsession.h index c69a1a71084..973d65ec152 100644 --- a/messagebus/src/vespa/messagebus/destinationsession.h +++ b/messagebus/src/vespa/messagebus/destinationsession.h @@ -80,7 +80,7 @@ public: * * @param message the Message */ - void handleMessage(Message::UP message); + void handleMessage(Message::UP message) override; /** * Returns the message handler of this session. diff --git a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h index 1e29d82cfc7..d552c3c48e9 100644 --- a/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/dynamicthrottlepolicy.h @@ -165,13 +165,13 @@ public: uint32_t getMaxPendingCount() const { return (uint32_t)_windowSize; } // Implements IThrottlePolicy. - bool canSend(const Message &msg, uint32_t pendingCount); + bool canSend(const Message &msg, uint32_t pendingCount) override; // Implements IThrottlePolicy. - void processMessage(Message &msg); + void processMessage(Message &msg) override; // Implements IThrottlePolicy. - void processReply(Reply &reply); + void processReply(Reply &reply) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/emptyreply.h b/messagebus/src/vespa/messagebus/emptyreply.h index 53639e0fef0..f2d431c8ada 100644 --- a/messagebus/src/vespa/messagebus/emptyreply.h +++ b/messagebus/src/vespa/messagebus/emptyreply.h @@ -26,14 +26,14 @@ public: * * @return "" */ - virtual const string & getProtocol() const; + virtual const string & getProtocol() const override; /** * This method returns the message type id reserved for empty replies: 0 * * @return 0 */ - virtual uint32_t getType() const; + virtual uint32_t getType() const override; /** * Encodes this reply into an empty blob. @@ -42,7 +42,7 @@ public: */ virtual Blob encode() const; - uint8_t priority() const { return 8; } + uint8_t priority() const override { return 8; } }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/intermediatesession.h b/messagebus/src/vespa/messagebus/intermediatesession.h index 4876e30f516..064b223707f 100644 --- a/messagebus/src/vespa/messagebus/intermediatesession.h +++ b/messagebus/src/vespa/messagebus/intermediatesession.h @@ -88,10 +88,10 @@ public: const string getConnectionSpec() const; // Implements IMessageHandler. - void handleMessage(Message::UP message); + void handleMessage(Message::UP message) override; // Implements IReplyHandler. - void handleReply(Reply::UP reply); + void handleReply(Reply::UP reply) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/message.h b/messagebus/src/vespa/messagebus/message.h index 6afe305389a..6fc72af0055 100644 --- a/messagebus/src/vespa/messagebus/message.h +++ b/messagebus/src/vespa/messagebus/message.h @@ -38,7 +38,7 @@ public: virtual ~Message(); // Overrides Routable. - virtual void swapState(Routable &rhs); + virtual void swapState(Routable &rhs) override; /** * Returns the timestamp for when this message was last seen by message @@ -139,7 +139,7 @@ public: * * @return false */ - virtual bool isReply() const { return false; } + virtual bool isReply() const override { return false; } /** * Returns whether or not this message contains a sequence identifier that diff --git a/messagebus/src/vespa/messagebus/messagebus.cpp b/messagebus/src/vespa/messagebus/messagebus.cpp index f5a30c86d45..ecee7f3b57e 100644 --- a/messagebus/src/vespa/messagebus/messagebus.cpp +++ b/messagebus/src/vespa/messagebus/messagebus.cpp @@ -32,11 +32,11 @@ public: // empty } - void run() { + void run() override { _resender->resendScheduled(); } - uint8_t priority() const { + uint8_t priority() const override { return 255; } }; @@ -66,12 +66,12 @@ public: _gate.countDown(); } - void run() { + void run() override { _net.postShutdownHook(); _done = _msn.isEmpty(); } - uint8_t priority() const { + uint8_t priority() const override { return 255; } }; diff --git a/messagebus/src/vespa/messagebus/messagebus.h b/messagebus/src/vespa/messagebus/messagebus.h index bc4a08123a4..f97de608843 100644 --- a/messagebus/src/vespa/messagebus/messagebus.h +++ b/messagebus/src/vespa/messagebus/messagebus.h @@ -284,25 +284,25 @@ public: Messenger & getMessenger() { return *_msn; } // Implements IReplyHandler. - void handleReply(Reply::UP reply); + void handleReply(Reply::UP reply) override; // Implements IDiscardHandler. - void handleDiscard(Context ctx); + void handleDiscard(Context ctx) override; // Implements IMessageHandler. - void handleMessage(Message::UP msg); + void handleMessage(Message::UP msg) override; // Implements IConfigHandler. - bool setupRouting(const RoutingSpec &spec); + bool setupRouting(const RoutingSpec &spec) override; // Implements INetworkOwner. - IProtocol::SP getProtocol(const string &name); + IProtocol::SP getProtocol(const string &name) override; // Implements INetworkOwner. - void deliverMessage(Message::UP msg, const string &session); + void deliverMessage(Message::UP msg, const string &session) override; // Implements INetworkOwner. - void deliverReply(Reply::UP reply, IReplyHandler &handler); + void deliverReply(Reply::UP reply, IReplyHandler &handler) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/messenger.cpp b/messagebus/src/vespa/messagebus/messenger.cpp index 33887ea5cf4..928d38a9069 100644 --- a/messagebus/src/vespa/messagebus/messenger.cpp +++ b/messagebus/src/vespa/messagebus/messenger.cpp @@ -37,11 +37,11 @@ public: } } - void run() { + void run() override { _handler.handleMessage(std::move(_msg)); } - uint8_t priority() const { + uint8_t priority() const override { if (_msg.get() != NULL) { return _msg->priority(); } @@ -69,11 +69,11 @@ public: } } - void run() { + void run() override { _handler.handleReply(std::move(_reply)); } - uint8_t priority() const { + uint8_t priority() const override { if (_reply.get() != NULL) { return _reply->priority(); } @@ -97,11 +97,11 @@ public: _gate.countDown(); } - void run() { + void run() override { // empty } - uint8_t priority() const { + uint8_t priority() const override { return 255; } }; @@ -119,11 +119,11 @@ public: // empty } - void run() { + void run() override { _tasks.push_back(_task.release()); } - uint8_t priority() const { + uint8_t priority() const override { return 255; } }; @@ -140,13 +140,13 @@ public: // empty } - void run() { + void run() override { std::for_each(_tasks.begin(), _tasks.end(), DeleteFunctor<ITask>()); _tasks.clear(); SyncTask::run(); } - uint8_t priority() const { + uint8_t priority() const override { return 255; } }; diff --git a/messagebus/src/vespa/messagebus/messenger.h b/messagebus/src/vespa/messagebus/messenger.h index 2b534301576..fe76513eef9 100644 --- a/messagebus/src/vespa/messagebus/messenger.h +++ b/messagebus/src/vespa/messagebus/messenger.h @@ -48,7 +48,7 @@ private: protected: // Implements FastOS_Runnable. - void Run(FastOS_ThreadInterface *thread, void *arg); + void Run(FastOS_ThreadInterface *thread, void *arg) override; public: /** diff --git a/messagebus/src/vespa/messagebus/reply.h b/messagebus/src/vespa/messagebus/reply.h index 41c9bb2c3e0..8bc4f5921e0 100644 --- a/messagebus/src/vespa/messagebus/reply.h +++ b/messagebus/src/vespa/messagebus/reply.h @@ -42,14 +42,14 @@ public: virtual ~Reply(); // Inherit doc from Routable. - virtual void swapState(Routable &rhs); + virtual void swapState(Routable &rhs) override; /** * Inherited from Routable. Classifies this object as 'a reply'. * * @return true */ - virtual bool isReply() const; + virtual bool isReply() const override; /** * Add an Error to this Reply diff --git a/messagebus/src/vespa/messagebus/replygate.h b/messagebus/src/vespa/messagebus/replygate.h index add66544e02..72c9378c62c 100644 --- a/messagebus/src/vespa/messagebus/replygate.h +++ b/messagebus/src/vespa/messagebus/replygate.h @@ -43,7 +43,7 @@ public: * the matching Reply has been obtained. In order to obtain the matching * Reply, this method will push this object on the CallStack of the Message. */ - void handleMessage(Message::UP msg); + void handleMessage(Message::UP msg) override; /** * Forward or discard Reply. If the gate is still open, it will forward the @@ -51,10 +51,10 @@ public: * the Reply will be discarded. This method also decreases the reference * counter of this object. */ - void handleReply(Reply::UP reply); + void handleReply(Reply::UP reply) override; // Implements IDiscardHandler. - void handleDiscard(Context ctx); + void handleDiscard(Context ctx) override; /** * Close this gate. After this has been invoked, the gate will start to diff --git a/messagebus/src/vespa/messagebus/routablequeue.h b/messagebus/src/vespa/messagebus/routablequeue.h index f3174abf5f5..ea2b14b64f6 100644 --- a/messagebus/src/vespa/messagebus/routablequeue.h +++ b/messagebus/src/vespa/messagebus/routablequeue.h @@ -76,14 +76,14 @@ public: * * @param msg the Message to handle **/ - virtual void handleMessage(Message::UP msg); + virtual void handleMessage(Message::UP msg) override; /** * Handle a Reply by enqueuing it. * * @param reply the Reply to handle **/ - virtual void handleReply(Reply::UP reply); + virtual void handleReply(Reply::UP reply) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/sendproxy.h b/messagebus/src/vespa/messagebus/sendproxy.h index 1bd880947c1..ca0c3f39661 100644 --- a/messagebus/src/vespa/messagebus/sendproxy.h +++ b/messagebus/src/vespa/messagebus/sendproxy.h @@ -35,13 +35,13 @@ public: SendProxy(MessageBus &mbus, INetwork &net, Resender *resender); // Implements IDiscardHandler. - void handleDiscard(Context ctx); + void handleDiscard(Context ctx) override; // Implements IMessageHandler. - void handleMessage(Message::UP msg); + void handleMessage(Message::UP msg) override; // Implements IReplyHandler. - void handleReply(Reply::UP reply); + void handleReply(Reply::UP reply) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/sequencer.h b/messagebus/src/vespa/messagebus/sequencer.h index 4551ee032a2..1b7408ea547 100644 --- a/messagebus/src/vespa/messagebus/sequencer.h +++ b/messagebus/src/vespa/messagebus/sequencer.h @@ -72,7 +72,7 @@ public: * * @param msg The message to send. */ - void handleMessage(Message::UP msg); + void handleMessage(Message::UP msg) override; /** * Lookup the sequencing id of an incoming reply to pop the front of the corresponding queue, and then @@ -80,7 +80,7 @@ public: * * @param reply The reply received. */ - void handleReply(Reply::UP reply); + void handleReply(Reply::UP reply) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/sourcesession.h b/messagebus/src/vespa/messagebus/sourcesession.h index c40b5418ec1..32a68b9c84b 100644 --- a/messagebus/src/vespa/messagebus/sourcesession.h +++ b/messagebus/src/vespa/messagebus/sourcesession.h @@ -91,7 +91,7 @@ public: * * @param reply the Reply **/ - void handleReply(Reply::UP reply); + void handleReply(Reply::UP reply) override; /** * Close this session. This method will block until Reply objects have been obtained for all pending diff --git a/messagebus/src/vespa/messagebus/staticthrottlepolicy.h b/messagebus/src/vespa/messagebus/staticthrottlepolicy.h index e6d75dfd3c7..b7cc6bdfe99 100644 --- a/messagebus/src/vespa/messagebus/staticthrottlepolicy.h +++ b/messagebus/src/vespa/messagebus/staticthrottlepolicy.h @@ -71,13 +71,13 @@ public: uint64_t getPendingSize() const; // Implements IThrottlePolicy. - bool canSend(const Message &msg, uint32_t pendingCount); + bool canSend(const Message &msg, uint32_t pendingCount) override; // Implements IThrottlePolicy. - void processMessage(Message &msg); + void processMessage(Message &msg) override; // Implements IThrottlePolicy. - void processReply(Reply &reply); + void processReply(Reply &reply) override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/systemtimer.h b/messagebus/src/vespa/messagebus/systemtimer.h index b03f847718b..14156253067 100644 --- a/messagebus/src/vespa/messagebus/systemtimer.h +++ b/messagebus/src/vespa/messagebus/systemtimer.h @@ -13,7 +13,7 @@ namespace mbus { class SystemTimer : public ITimer { public: // Implements ITimer. - uint64_t getMilliTime() const; + uint64_t getMilliTime() const override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/testlib/custompolicy.h b/messagebus/src/vespa/messagebus/testlib/custompolicy.h index 83d6cf73eb6..953f4f3c92e 100644 --- a/messagebus/src/vespa/messagebus/testlib/custompolicy.h +++ b/messagebus/src/vespa/messagebus/testlib/custompolicy.h @@ -17,8 +17,8 @@ public: const std::vector<uint32_t> consumableErrors, const std::vector<Route> &routes); - virtual void select(RoutingContext &context); - virtual void merge(RoutingContext &context); + virtual void select(RoutingContext &context) override; + virtual void merge(RoutingContext &context) override; }; class CustomPolicyFactory : public SimpleProtocol::IPolicyFactory { @@ -32,7 +32,7 @@ public: CustomPolicyFactory(bool selectOnRetry, uint32_t consumableError); CustomPolicyFactory(bool selectOnRetry, const std::vector<uint32_t> consumableErrors); - IRoutingPolicy::UP create(const string ¶m); + IRoutingPolicy::UP create(const string ¶m) override; static void parseRoutes(const string &str, std::vector<Route> &routes); }; diff --git a/messagebus/src/vespa/messagebus/testlib/receptor.h b/messagebus/src/vespa/messagebus/testlib/receptor.h index d7a0376596e..c64e60eb6de 100644 --- a/messagebus/src/vespa/messagebus/testlib/receptor.h +++ b/messagebus/src/vespa/messagebus/testlib/receptor.h @@ -20,8 +20,8 @@ private: Receptor &operator=(const Receptor &); public: Receptor(); - virtual void handleMessage(Message::UP msg); - virtual void handleReply(Reply::UP reply); + virtual void handleMessage(Message::UP msg) override; + virtual void handleReply(Reply::UP reply) override; Message::UP getMessage(double maxWait = 120.0); Reply::UP getReply(double maxWait = 120.0); }; diff --git a/messagebus/src/vespa/messagebus/testlib/simplemessage.h b/messagebus/src/vespa/messagebus/testlib/simplemessage.h index c709397a89f..cb14c48dd9f 100644 --- a/messagebus/src/vespa/messagebus/testlib/simplemessage.h +++ b/messagebus/src/vespa/messagebus/testlib/simplemessage.h @@ -20,15 +20,15 @@ public: void setValue(const string &value); const string &getValue() const; int getHash() const; - const string & getProtocol() const; - uint32_t getType() const; - bool hasSequenceId() const; - uint64_t getSequenceId() const; - uint32_t getApproxSize() const; + const string & getProtocol() const override; + uint32_t getType() const override; + bool hasSequenceId() const override; + uint64_t getSequenceId() const override; + uint32_t getApproxSize() const override; - uint8_t priority() const { return 8; } + uint8_t priority() const override { return 8; } - string toString() const { return _value; } + string toString() const override { return _value; } }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.cpp b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.cpp index 564b07135db..c21e2661d6c 100644 --- a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.cpp +++ b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.cpp @@ -16,27 +16,27 @@ const uint32_t SimpleProtocol::REPLY(2); class AllPolicy : public IRoutingPolicy { public: - void select(RoutingContext &ctx) { + void select(RoutingContext &ctx) override { std::vector<Route> recipients; ctx.getMatchedRecipients(recipients); ctx.addChildren(recipients); } - void merge(RoutingContext &ctx) { + void merge(RoutingContext &ctx) override { SimpleProtocol::simpleMerge(ctx); } }; class AllPolicyFactory : public SimpleProtocol::IPolicyFactory { public: - IRoutingPolicy::UP create(const string &) { + IRoutingPolicy::UP create(const string &) override { return IRoutingPolicy::UP(new AllPolicy()); } }; class HashPolicy : public IRoutingPolicy { public: - void select(RoutingContext &ctx) { + void select(RoutingContext &ctx) override { std::vector<Route> recipients; ctx.getMatchedRecipients(recipients); if (!recipients.empty()) { @@ -45,14 +45,14 @@ public: } } - void merge(RoutingContext &ctx) { + void merge(RoutingContext &ctx) override { SimpleProtocol::simpleMerge(ctx); } }; class HashPolicyFactory : public SimpleProtocol::IPolicyFactory { public: - IRoutingPolicy::UP create(const string &) { + IRoutingPolicy::UP create(const string &) override { return IRoutingPolicy::UP(new HashPolicy()); } }; diff --git a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h index 0a0dee5085a..843b7675b96 100644 --- a/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h +++ b/messagebus/src/vespa/messagebus/testlib/simpleprotocol.h @@ -73,17 +73,17 @@ public: static void simpleMerge(RoutingContext &ctx); // Implements IProtocol. - const string & getName() const; + const string & getName() const override; // Implements IProtocol. IRoutingPolicy::UP createPolicy(const string &name, - const string ¶m) const; + const string ¶m) const override; // Implements IProtocol. - Blob encode(const vespalib::Version &version, const Routable &routable) const; + Blob encode(const vespalib::Version &version, const Routable &routable) const override; // Implements IProtocol. - Routable::UP decode(const vespalib::Version &version, BlobRef data) const; + Routable::UP decode(const vespalib::Version &version, BlobRef data) const override; }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/testlib/simplereply.h b/messagebus/src/vespa/messagebus/testlib/simplereply.h index 6a33855976c..8016a517453 100644 --- a/messagebus/src/vespa/messagebus/testlib/simplereply.h +++ b/messagebus/src/vespa/messagebus/testlib/simplereply.h @@ -19,10 +19,10 @@ public: virtual ~SimpleReply(); void setValue(const string &value); const string &getValue() const; - virtual const string & getProtocol() const; - virtual uint32_t getType() const; + virtual const string & getProtocol() const override; + virtual uint32_t getType() const override; - uint8_t priority() const { return 8; } + uint8_t priority() const override { return 8; } }; } // namespace mbus diff --git a/messagebus/src/vespa/messagebus/testlib/slobrok.cpp b/messagebus/src/vespa/messagebus/testlib/slobrok.cpp index 282797d461b..b3f02b1ad58 100644 --- a/messagebus/src/vespa/messagebus/testlib/slobrok.cpp +++ b/messagebus/src/vespa/messagebus/testlib/slobrok.cpp @@ -20,7 +20,7 @@ public: guard.wait(); } } - virtual void PerformTask() { + virtual void PerformTask() override { vespalib::MonitorGuard guard(_mon); _done = true; guard.signal(); diff --git a/messagebus/src/vespa/messagebus/testlib/slobrok.h b/messagebus/src/vespa/messagebus/testlib/slobrok.h index 28053e7b506..2f8d4180ba5 100644 --- a/messagebus/src/vespa/messagebus/testlib/slobrok.h +++ b/messagebus/src/vespa/messagebus/testlib/slobrok.h @@ -20,7 +20,7 @@ private: slobrok::SBEnv *_env; public: void setEnv(slobrok::SBEnv *env); - void Run(FastOS_ThreadInterface *, void *); + void Run(FastOS_ThreadInterface *, void *) override; }; FastOS_ThreadPool _pool; std::unique_ptr<slobrok::SBEnv> _env; diff --git a/messagebus/src/vespa/messagebus/testlib/testserver.h b/messagebus/src/vespa/messagebus/testlib/testserver.h index 8070b499d99..92d2ac51c89 100644 --- a/messagebus/src/vespa/messagebus/testlib/testserver.h +++ b/messagebus/src/vespa/messagebus/testlib/testserver.h @@ -19,7 +19,7 @@ private: vespalib::Version _version; protected: - const vespalib::Version &getVersion() const { return _version; } + const vespalib::Version &getVersion() const override { return _version; } public: VersionedRPCNetwork(const RPCNetworkParams ¶ms); diff --git a/messagebus_test/src/tests/error/cpp-client.cpp b/messagebus_test/src/tests/error/cpp-client.cpp index 4f94a13977c..19cb09b3738 100644 --- a/messagebus_test/src/tests/error/cpp-client.cpp +++ b/messagebus_test/src/tests/error/cpp-client.cpp @@ -20,7 +20,7 @@ using namespace mbus; class App : public FastOS_Application { public: - int Main(); + int Main() override; }; int diff --git a/messagebus_test/src/tests/error/cpp-server.cpp b/messagebus_test/src/tests/error/cpp-server.cpp index 2eb929f6ca9..13cfa76984b 100644 --- a/messagebus_test/src/tests/error/cpp-server.cpp +++ b/messagebus_test/src/tests/error/cpp-server.cpp @@ -23,7 +23,7 @@ private: public: Server(MessageBus &bus); ~Server(); - void handleMessage(Message::UP msg); + void handleMessage(Message::UP msg) override; }; Server::Server(MessageBus &bus) @@ -49,7 +49,7 @@ Server::handleMessage(Message::UP msg) { class App : public FastOS_Application { public: - int Main(); + int Main() override; }; int diff --git a/messagebus_test/src/tests/errorcodes/dumpcodes.cpp b/messagebus_test/src/tests/errorcodes/dumpcodes.cpp index 121d8585726..a381efc2238 100644 --- a/messagebus_test/src/tests/errorcodes/dumpcodes.cpp +++ b/messagebus_test/src/tests/errorcodes/dumpcodes.cpp @@ -11,7 +11,7 @@ class App : public FastOS_Application { public: void dump(const std::string &desc, uint32_t value); - int Main(); + int Main() override; }; void diff --git a/messagebus_test/src/tests/speed/cpp-client.cpp b/messagebus_test/src/tests/speed/cpp-client.cpp index c0c9d621a20..54ccadc9ddd 100644 --- a/messagebus_test/src/tests/speed/cpp-client.cpp +++ b/messagebus_test/src/tests/speed/cpp-client.cpp @@ -28,7 +28,7 @@ public: void send(); void send(uint64_t seq); void sample(uint32_t &okCnt, uint32_t &failCnt); - void handleReply(Reply::UP reply); + void handleReply(Reply::UP reply) override; }; uint64_t Client::_seq = 100000; @@ -87,7 +87,7 @@ Client::handleReply(Reply::UP reply) { class App : public FastOS_Application { public: - int Main(); + int Main() override; }; int diff --git a/messagebus_test/src/tests/speed/cpp-server.cpp b/messagebus_test/src/tests/speed/cpp-server.cpp index c2cd9bf262a..904bf4d6d51 100644 --- a/messagebus_test/src/tests/speed/cpp-server.cpp +++ b/messagebus_test/src/tests/speed/cpp-server.cpp @@ -20,7 +20,7 @@ private: public: Server(MessageBus &bus); ~Server(); - void handleMessage(Message::UP msg); + void handleMessage(Message::UP msg) override; }; Server::Server(MessageBus &bus) @@ -53,7 +53,7 @@ Server::handleMessage(Message::UP msg) { class App : public FastOS_Application { public: - int Main(); + int Main() override; }; int diff --git a/messagebus_test/src/tests/trace/cpp-server.cpp b/messagebus_test/src/tests/trace/cpp-server.cpp index 76e20bc3cfd..ce495090e91 100644 --- a/messagebus_test/src/tests/trace/cpp-server.cpp +++ b/messagebus_test/src/tests/trace/cpp-server.cpp @@ -23,8 +23,8 @@ private: public: Server(MessageBus &bus, const std::string &name); ~Server(); - void handleMessage(Message::UP msg); - void handleReply(Reply::UP reply); + void handleMessage(Message::UP msg) override; + void handleReply(Reply::UP reply) override; }; Server::Server(MessageBus &bus, const std::string &name) @@ -62,7 +62,7 @@ Server::handleReply(Reply::UP reply) { class App : public FastOS_Application { public: - int Main(); + int Main() override; }; int diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp index 7159207e0ff..362cad83a66 100644 --- a/metrics/src/tests/metricmanagertest.cpp +++ b/metrics/src/tests/metricmanagertest.cpp @@ -144,7 +144,7 @@ struct MetricNameVisitor : public MetricVisitor { MetricNameVisitor(bool debug_ = false) : debug(debug_) {} virtual bool visitMetricSet(const MetricSet& metricSet, - bool autoGenerated) + bool autoGenerated) override { if (debug) { ost << "<" << (autoGenerated ? "*" : "") @@ -152,13 +152,13 @@ struct MetricNameVisitor : public MetricVisitor { } return true; } - virtual void doneVisitingMetricSet(const MetricSet& metricSet) { + virtual void doneVisitingMetricSet(const MetricSet& metricSet) override { if (debug) { ost << "</" << metricSet.getPath() << ">\n"; } } - virtual bool visitMetric(const Metric& m, bool autoGenerated) { + virtual bool visitMetric(const Metric& m, bool autoGenerated) override { ost << (autoGenerated ? "*" : "") << m.getPath() << "\n"; return true; } @@ -390,7 +390,7 @@ namespace { struct FakeTimer : public MetricManager::Timer { time_t _time; FakeTimer(time_t startTime = 0) : _time(startTime) {} - virtual time_t getTime() const { return _time; } + virtual time_t getTime() const override { return _time; } }; struct BriefValuePrinter : public MetricVisitor { @@ -399,7 +399,7 @@ namespace { BriefValuePrinter() : count(0), ost() {} - virtual bool visitMetric(const Metric& metric, bool) { + virtual bool visitMetric(const Metric& metric, bool) override { if (++count > 1) ost << ","; //ost << metric.getPath() << ":"; ost << metric.getDoubleValue("value"); diff --git a/metrics/src/tests/metricsettest.cpp b/metrics/src/tests/metricsettest.cpp index 309794cad1e..176572acbd4 100644 --- a/metrics/src/tests/metricsettest.cpp +++ b/metrics/src/tests/metricsettest.cpp @@ -28,7 +28,7 @@ namespace { TestMetricVisitor(uint32_t setsToVisit_ = 100) : ost(), setsToVisit(setsToVisit_) {} - virtual bool visitMetricSet(const MetricSet& set, bool autoGenerated) { + virtual bool visitMetricSet(const MetricSet& set, bool autoGenerated) override { ost << "[" << (autoGenerated ? "*" : "") << set.getName() << "]\n"; if (setsToVisit > 0) { --setsToVisit; @@ -36,7 +36,7 @@ namespace { } return false; } - virtual bool visitMetric(const Metric& m, bool autoGenerated) { + virtual bool visitMetric(const Metric& m, bool autoGenerated) override { ost << (autoGenerated ? "*" : "") << m.getName() << "\n"; return true; } diff --git a/metrics/src/tests/snapshottest.cpp b/metrics/src/tests/snapshottest.cpp index 977f6e4ad68..bee3e910fb3 100644 --- a/metrics/src/tests/snapshottest.cpp +++ b/metrics/src/tests/snapshottest.cpp @@ -41,7 +41,7 @@ struct SubSubMetricSet : public MetricSet { SubSubMetricSet(vespalib::stringref name, const LoadTypeSet& loadTypes_, MetricSet* owner = 0); ~SubSubMetricSet(); virtual MetricSet* clone(std::vector<Metric::UP> &ownerList, CopyType copyType, - metrics::MetricSet* owner, bool includeUnused) const; + metrics::MetricSet* owner, bool includeUnused) const override; void incValues(); }; @@ -194,7 +194,7 @@ struct FakeTimer : public MetricManager::Timer { FakeTimer() : _timeInSecs(1) {} - virtual time_t getTime() const { return _timeInSecs; } + virtual time_t getTime() const override { return _timeInSecs; } }; } // End of anonymous namespace diff --git a/metrics/src/tests/stresstest.cpp b/metrics/src/tests/stresstest.cpp index 905a79252d1..5a2a736e9ba 100644 --- a/metrics/src/tests/stresstest.cpp +++ b/metrics/src/tests/stresstest.cpp @@ -108,7 +108,7 @@ OuterMetricSet::~OuterMetricSet() { } //std::cerr << "Loadgiver thread joined\n"; } - virtual void run() { + virtual void run() override { uint64_t i = 0; while (running()) { ++i; diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java index d49b5ee40c7..0ae807f7f04 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/docker/DockerOperationsImpl.java @@ -171,10 +171,12 @@ public class DockerOperationsImpl implements DockerOperations { long minMainMemoryAvailableMb = (long) (nodeSpec.minMainMemoryAvailableGb.get() * 1024); if (minMainMemoryAvailableMb > 0) { command.withMemoryInMb(minMainMemoryAvailableMb); - // TOTAL_MEMORY_MB is used to make any jdisc container think the machine + // VESPA_TOTAL_MEMORY_MB is used to make any jdisc container think the machine // only has this much physical memory (overrides total memory reported by `free -m`). - command.withEnvironment("TOTAL_MEMORY_MB", Long.toString(minMainMemoryAvailableMb)); command.withEnvironment("VESPA_TOTAL_MEMORY_MB", Long.toString(minMainMemoryAvailableMb)); + + // TODO: Remove once the lowest version in prod is 6.95 + command.withEnvironment("TOTAL_MEMORY_MB", Long.toString(minMainMemoryAvailableMb)); } } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java index 6b4c40f352b..9313d238f9e 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/maintenance/StorageMaintainer.java @@ -33,6 +33,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; +import static com.yahoo.vespa.defaults.Defaults.getDefaults; + /** * @author freva */ @@ -267,10 +269,12 @@ public class StorageMaintainer { try { args = objectMapper.writeValueAsString(jobs); } catch (JsonProcessingException e) { - throw new RuntimeException("Failed trasform list of maintenance jobs to JSON"); + throw new RuntimeException("Failed transform list of maintenance jobs to JSON"); } - String[] command = {"java", "-cp", classPath, "com.yahoo.vespa.hosted.node.maintainer.Maintainer", args}; + String[] command = {"java", "-cp", classPath, + "-Dvespa.log.target=file:" + getDefaults().underVespaHome("logs/vespa/vespa.log"), + "com.yahoo.vespa.hosted.node.maintainer.Maintainer", args}; ProcessResult result = docker.executeInContainerAsRoot(executeIn, command); if (! result.isSuccess()) { diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java index cc953ae729b..42d5536ea05 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImpl.java @@ -3,7 +3,6 @@ package com.yahoo.vespa.hosted.node.admin.nodeadmin; import com.yahoo.collections.Pair; import com.yahoo.net.HostName; -import com.yahoo.vespa.hosted.dockerapi.Container; import com.yahoo.vespa.hosted.dockerapi.metrics.CounterWrapper; import com.yahoo.vespa.hosted.dockerapi.metrics.Dimensions; import com.yahoo.vespa.hosted.dockerapi.metrics.GaugeWrapper; @@ -42,7 +41,7 @@ public class NodeAdminImpl implements NodeAdmin { private final DockerOperations dockerOperations; private final Function<String, NodeAgent> nodeAgentFactory; private final Optional<StorageMaintainer> storageMaintainer; - private boolean isFrozen = false; + private boolean isFrozen = true; private final Map<String, NodeAgent> nodeAgents = new ConcurrentHashMap<>(); @@ -81,10 +80,15 @@ public class NodeAdminImpl implements NodeAdmin { @Override public void refreshContainersToRun(final List<ContainerNodeSpec> containersToRun) { - final List<Container> existingContainers = dockerOperations.getAllManagedContainers(); + final List<String> existingContainerHostnames = dockerOperations.getAllManagedContainers().stream() + .map(container -> container.hostname) + .collect(Collectors.toList()); + final List<String> containersToRunHostnames = containersToRun.stream() + .map(container -> container.hostname) + .collect(Collectors.toList()); storageMaintainer.ifPresent(StorageMaintainer::cleanNodeAdmin); - synchronizeNodeSpecsToNodeAgents(containersToRun, existingContainers); + synchronizeNodeSpecsToNodeAgents(containersToRunHostnames, existingContainerHostnames); dockerOperations.deleteUnusedDockerImages(); updateNodeAgentMetrics(); @@ -153,7 +157,7 @@ public class NodeAdminImpl implements NodeAdmin { boolean metricsSchedulerShutdown = metricsScheduler.awaitTermination(30, TimeUnit.SECONDS); boolean aclSchedulerShutdown = aclScheduler.awaitTermination(30, TimeUnit.SECONDS); if (! (metricsSchedulerShutdown && aclSchedulerShutdown)) { - throw new RuntimeException("Failed shuttingdown all scheduler(s), shutdown status:\n" + + throw new RuntimeException("Failed shutting down all scheduler(s), shutdown status:\n" + "\tMetrics Scheduler: " + metricsSchedulerShutdown + "\n" + "\tACL Scheduler: " + aclSchedulerShutdown); } @@ -187,25 +191,20 @@ public class NodeAdminImpl implements NodeAdmin { .map(key -> new Pair<>(Optional.ofNullable(tMap.get(key)), Optional.ofNullable(uMap.get(key)))); } - // TODO This method should rather take a list of Hostname instead of Container. However, it triggers - // a refactoring of the logic. Which is hard due to the style of programming. // The method streams the list of containers twice. void synchronizeNodeSpecsToNodeAgents( - final List<ContainerNodeSpec> containersToRun, - final List<Container> existingContainers) { - final Stream<Pair<Optional<ContainerNodeSpec>, Optional<Container>>> nodeSpecContainerPairs = fullOuterJoin( - containersToRun.stream(), nodeSpec -> nodeSpec.hostname, - existingContainers.stream(), container -> container.hostname); - - final Set<String> nodeHostNames = containersToRun.stream() - .map(spec -> spec.hostname) - .collect(Collectors.toSet()); - final Set<String> obsoleteAgentHostNames = diff(nodeAgents.keySet(), nodeHostNames); + final List<String> containersToRun, + final List<String> existingContainers) { + final Stream<Pair<Optional<String>, Optional<String>>> nodeSpecContainerPairs = fullOuterJoin( + containersToRun.stream(), hostname -> hostname, + existingContainers.stream(), hostname -> hostname); + + final Set<String> obsoleteAgentHostNames = diff(nodeAgents.keySet(), new HashSet<>(containersToRun)); obsoleteAgentHostNames.forEach(hostName -> nodeAgents.remove(hostName).stop()); nodeSpecContainerPairs.forEach(nodeSpecContainerPair -> { - final Optional<ContainerNodeSpec> nodeSpec = nodeSpecContainerPair.getFirst(); - final Optional<Container> existingContainer = nodeSpecContainerPair.getSecond(); + final Optional<String> nodeSpec = nodeSpecContainerPair.getFirst(); + final Optional<String> existingContainer = nodeSpecContainerPair.getSecond(); if (!nodeSpec.isPresent()) { assert existingContainer.isPresent(); @@ -217,14 +216,14 @@ public class NodeAdminImpl implements NodeAdmin { }); } - private void ensureNodeAgentForNodeIsStarted(final ContainerNodeSpec nodeSpec) { - if (nodeAgents.containsKey(nodeSpec.hostname)) { + private void ensureNodeAgentForNodeIsStarted(final String hostname) { + if (nodeAgents.containsKey(hostname)) { return; } - final NodeAgent agent = nodeAgentFactory.apply(nodeSpec.hostname); + final NodeAgent agent = nodeAgentFactory.apply(hostname); agent.start(nodeAgentScanIntervalMillis); - nodeAgents.put(nodeSpec.hostname, agent); + nodeAgents.put(hostname, agent); try { Thread.sleep(1000); } catch (InterruptedException e) { diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdater.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdater.java index 26139575f92..bdc5994c89e 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdater.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdater.java @@ -34,7 +34,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; */ public class NodeAdminStateUpdater extends AbstractComponent { private final AtomicBoolean terminated = new AtomicBoolean(false); - private State currentState = RESUMED; + private State currentState = SUSPENDED_NODE_ADMIN; private State wantedState = RESUMED; private boolean workToDoNow = true; @@ -131,23 +131,16 @@ public class NodeAdminStateUpdater extends AbstractComponent { } /** - * This method attempts to converge NodeAgent's and NodeAdmin's frozen state with their orchestrator - * state. When trying to suspend node-admin, this method will first attempt to freeze all NodeAgents and - * NodeAdmin, then asking orchestrator for permission to suspend all active nodes on this host, including - * node-admin itself, if the request is denied, this method will unfreeze NodeAgents and NodeAdmin. + * This method attempts to converge node-admin towards one of the {@link State} */ private void convergeState(State wantedState) { - boolean wantFrozen = wantedState != RESUMED; - if (!nodeAdmin.setFrozen(wantFrozen)) { - throw new RuntimeException("NodeAdmin has not yet converged to " + (wantFrozen ? "frozen" : "unfrozen")); - } - - // To get to resumed state, we only need to converge NodeAdmins frozen state if (wantedState == RESUMED) { - synchronized (monitor) { - currentState = RESUMED; + if (!nodeAdmin.setFrozen(false)) { + throw new RuntimeException("NodeAdmin has not yet converged to unfrozen"); } - return; + + orchestrator.resume(dockerHostHostName); + if (wantedState == updateAndGetCurrentState(RESUMED)) return; } // Fetch active nodes from node repo before suspending nodes. @@ -160,26 +153,29 @@ public class NodeAdminStateUpdater extends AbstractComponent { try { nodesInActiveState = getNodesInActiveState(); } catch (IOException e) { - throw new RuntimeException("Failed to get nodes from node repo:" + e.getMessage()); + throw new RuntimeException("Failed to get nodes from node repo: " + e.getMessage()); } if (currentState == RESUMED) { List<String> nodesToSuspend = new ArrayList<>(nodesInActiveState); nodesToSuspend.add(dockerHostHostName); - orchestrator.suspend(dockerHostHostName, nodesToSuspend).ifPresent(orchestratorResponse -> { - nodeAdmin.setFrozen(false); - throw new RuntimeException("Failed to get permission to suspend, resuming. Reason: " + orchestratorResponse); - }); + orchestrator.suspend(dockerHostHostName, nodesToSuspend); - synchronized (monitor) { - currentState = SUSPENDED_NODE_ADMIN; + if (!nodeAdmin.setFrozen(true)) { + throw new RuntimeException("NodeAdmin has not yet converged to frozen"); } - if (wantedState == currentState) return; + + if (wantedState == updateAndGetCurrentState(SUSPENDED_NODE_ADMIN)) return; } nodeAdmin.stopNodeAgentServices(nodesInActiveState); + updateAndGetCurrentState(SUSPENDED); + } + + private State updateAndGetCurrentState(State currentState) { synchronized (monitor) { - currentState = SUSPENDED; + this.currentState = currentState; + return currentState; } } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index 8128bb47eac..556c8c9f307 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -46,7 +46,7 @@ import static com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentImpl.Containe */ public class NodeAgentImpl implements NodeAgent { private final AtomicBoolean terminated = new AtomicBoolean(false); - private boolean isFrozen = false; + private boolean isFrozen = true; private boolean wantFrozen = false; private boolean workToDoNow = true; @@ -333,13 +333,20 @@ public class NodeAgentImpl implements NodeAgent { logger.info("Will remove container " + existingContainer.get() + ": " + removeReason.get()); if (existingContainer.get().state.isRunning()) { - orchestratorSuspendNode(); - stopServices(); + if (nodeSpec.nodeState == Node.State.active) { + orchestratorSuspendNode(); + } + + try { + stopServices(); + } catch (Exception e) { + logger.info("Failed stopping services, ignoring", e); + } } - containerState = ABSENT; vespaVersion = Optional.empty(); dockerOperations.removeContainer(existingContainer.get()); metricReceiver.unsetMetricsForContainer(hostname); + containerState = ABSENT; return Optional.empty(); } return existingContainer; @@ -667,10 +674,6 @@ public class NodeAgentImpl implements NodeAgent { // needs to contain routines for drain and suspend. For many images, these can just be dummy routines. private void orchestratorSuspendNode() { logger.info("Ask Orchestrator for permission to suspend node " + hostname); - if ( ! orchestrator.suspend(hostname)) { - logger.info("Orchestrator rejected suspend of node " + hostname); - // TODO: change suspend() to throw an exception if suspend is denied - throw new OrchestratorException("Failed to get permission to suspend " + hostname); - } + orchestrator.suspend(hostname); } } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/Orchestrator.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/Orchestrator.java index 9728e997647..e16f4d9bf6a 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/Orchestrator.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/Orchestrator.java @@ -2,7 +2,6 @@ package com.yahoo.vespa.hosted.node.admin.orchestrator; import java.util.List; -import java.util.Optional; /** * Abstraction for communicating with Orchestrator. @@ -11,17 +10,22 @@ import java.util.Optional; */ public interface Orchestrator { /** - * Invokes orchestrator suspend of a host. Returns whether suspend was granted. + * Invokes orchestrator suspend of a host. + * @throws OrchestratorException if suspend was denied. + * @throws OrchestratorNotFoundException if host is unknown to the orchestrator */ - boolean suspend(String hostName); + void suspend(String hostName); /** - * Invokes orchestrator resume of a host. Returns whether resume was granted. + * Invokes orchestrator resume of a host. + * @throws OrchestratorException if resume was denied + * @throws OrchestratorNotFoundException if host is unknown to the orchestrator */ - boolean resume(String hostName); + void resume(String hostName); /** - * Invokes orchestrator suspend hosts. Returns failure reasons when failing. + * Invokes orchestrator suspend hosts. + * @throws OrchestratorException if batch suspend was denied. */ - Optional<String> suspend(String parentHostName, List<String> hostNames); + void suspend(String parentHostName, List<String> hostNames); } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImpl.java index 9eae307d335..9fd0b600ca6 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImpl.java @@ -2,10 +2,8 @@ package com.yahoo.vespa.hosted.node.admin.orchestrator; import com.yahoo.vespa.defaults.Defaults; -import com.yahoo.vespa.hosted.dockerapi.ContainerName; import com.yahoo.vespa.hosted.node.admin.util.ConfigServerHttpRequestExecutor; -import com.yahoo.vespa.hosted.node.admin.util.PrefixLogger; import com.yahoo.vespa.orchestrator.restapi.HostApi; import com.yahoo.vespa.orchestrator.restapi.HostSuspensionApi; @@ -21,7 +19,6 @@ import java.util.Optional; * @author dybis */ public class OrchestratorImpl implements Orchestrator { - private static final PrefixLogger NODE_ADMIN_LOGGER = PrefixLogger.getNodeAdminLogger(OrchestratorImpl.class); static final int WEB_SERVICE_PORT = Defaults.getDefaults().vespaWebServicePort(); // TODO: Find a way to avoid duplicating this (present in orchestrator's services.xml also). private static final String ORCHESTRATOR_PATH_PREFIX = "/orchestrator"; @@ -37,59 +34,57 @@ public class OrchestratorImpl implements Orchestrator { } @Override - public boolean suspend(final String hostName) { - PrefixLogger logger = getLogger(hostName); + public void suspend(final String hostName) { + UpdateHostResponse response; try { - String path = getSuspendPath(hostName); - UpdateHostResponse response = requestExecutor.put(path, - WEB_SERVICE_PORT, - Optional.empty(), /* body */ - UpdateHostResponse.class); - return response.reason() == null; + response = requestExecutor.put(getSuspendPath(hostName), + WEB_SERVICE_PORT, + Optional.empty(), /* body */ + UpdateHostResponse.class); } catch (ConfigServerHttpRequestExecutor.NotFoundException n) { - // Orchestrator doesn't care about this node, so don't let that stop us. - logger.info("Got not found on suspending, allowed to suspend"); - return true; + throw new OrchestratorNotFoundException("Failed to suspend " + hostName + ", host not found"); } catch (Exception e) { - logger.info("Got error on suspend", e); - return false; + throw new RuntimeException("Got error on suspend", e); } + + Optional.ofNullable(response.reason()).ifPresent(reason -> { + throw new OrchestratorException(reason.message()); + }); } @Override - public Optional<String> suspend(String parentHostName, List<String> hostNames) { + public void suspend(String parentHostName, List<String> hostNames) { + final BatchOperationResult batchOperationResult; try { - final BatchOperationResult batchOperationResult = requestExecutor.put( + batchOperationResult = requestExecutor.put( ORCHESTRATOR_PATH_PREFIX_HOST_SUSPENSION_API, WEB_SERVICE_PORT, Optional.of(new BatchHostSuspendRequest(parentHostName, hostNames)), BatchOperationResult.class); - return batchOperationResult.getFailureReason(); } catch (Exception e) { - NODE_ADMIN_LOGGER.info("Got error on batch suspend for " + parentHostName + ", with nodes " + hostNames, e); - return Optional.of(e.getMessage()); + throw new RuntimeException("Got error on batch suspend for " + parentHostName + ", with nodes " + hostNames, e); } + + batchOperationResult.getFailureReason().ifPresent(reason -> { + throw new OrchestratorException(reason); + }); } @Override - public boolean resume(final String hostName) { - PrefixLogger logger = getLogger(hostName); + public void resume(final String hostName) { + UpdateHostResponse response; try { String path = getSuspendPath(hostName); - UpdateHostResponse response = requestExecutor.delete(path, WEB_SERVICE_PORT, UpdateHostResponse.class); - return response.reason() == null; + response = requestExecutor.delete(path, WEB_SERVICE_PORT, UpdateHostResponse.class); } catch (ConfigServerHttpRequestExecutor.NotFoundException n) { - // Orchestrator doesn't care about this node, so don't let that stop us. - logger.info("Got not found on resuming, allowed to resume"); - return true; + throw new OrchestratorNotFoundException("Failed to resume " + hostName + ", host not found"); } catch (Exception e) { - logger.info("Got error on resume", e); - return false; + throw new RuntimeException("Got error on resume", e); } - } - private PrefixLogger getLogger(String hostName) { - return PrefixLogger.getNodeAgentLogger(OrchestratorImpl.class, ContainerName.fromHostname(hostName)); + Optional.ofNullable(response.reason()).ifPresent(reason -> { + throw new OrchestratorException(reason.message()); + }); } private String getSuspendPath(String hostName) { diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorNotFoundException.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorNotFoundException.java new file mode 100644 index 00000000000..c20fed566dc --- /dev/null +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorNotFoundException.java @@ -0,0 +1,9 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.node.admin.orchestrator; + +@SuppressWarnings("serial") +public class OrchestratorNotFoundException extends OrchestratorException { + public OrchestratorNotFoundException(String message) { + super(message); + } +} diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java index ba57bd65470..8832d493a13 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/restapi/RestApiHandler.java @@ -76,7 +76,7 @@ public class RestApiHandler extends LoggingRequestHandler{ } }; } - return new SimpleResponse(400, "unknown path" + path); + return new SimpleResponse(400, "unknown path " + path); } private HttpResponse handlePut(HttpRequest request) { @@ -96,7 +96,7 @@ public class RestApiHandler extends LoggingRequestHandler{ new SimpleResponse(200, "ok") : new SimpleResponse(409, "fail"); } - return new SimpleResponse(400, "unknown path" + path); + return new SimpleResponse(400, "unknown path " + path); } private static class SimpleResponse extends HttpResponse { diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/OrchestratorMock.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/OrchestratorMock.java index 8796a38a451..38cb6d8e87f 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/OrchestratorMock.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/OrchestratorMock.java @@ -4,7 +4,6 @@ package com.yahoo.vespa.hosted.node.admin.integrationTests; import com.yahoo.vespa.hosted.node.admin.orchestrator.Orchestrator; import java.util.List; -import java.util.Optional; /** * Mock with some simple logic @@ -14,56 +13,22 @@ import java.util.Optional; public class OrchestratorMock implements Orchestrator { private final CallOrderVerifier callOrderVerifier; - private boolean forceSingleSuspendResponse = true; - private boolean forceSingleResumeResponse = true; - private Optional<String> forceGroupSuspendResponse = Optional.empty(); - - private static final Object monitor = new Object(); - - public OrchestratorMock(CallOrderVerifier callOrderVerifier) { + OrchestratorMock(CallOrderVerifier callOrderVerifier) { this.callOrderVerifier = callOrderVerifier; } @Override - public boolean suspend(String hostName) { - synchronized (monitor) { - callOrderVerifier.add("Suspend for " + hostName); - return forceSingleSuspendResponse; - } + public void suspend(String hostName) { + callOrderVerifier.add("Suspend for " + hostName); } @Override - public boolean resume(String hostName) { - synchronized (monitor) { - callOrderVerifier.add("Resume for " + hostName); - return forceSingleResumeResponse; - } + public void resume(String hostName) { + callOrderVerifier.add("Resume for " + hostName); } @Override - public Optional<String> suspend(String parentHostName, List<String> hostNames) { - synchronized (monitor) { - callOrderVerifier.add("Suspend with parent: " + parentHostName + " and hostnames: " + hostNames + - " - Forced response: " + forceGroupSuspendResponse); - return forceGroupSuspendResponse; - } - } - - public void setForceSingleSuspendResponse(boolean forceSingleSuspendResponse) { - synchronized (monitor) { - this.forceSingleSuspendResponse = forceSingleSuspendResponse; - } - } - - public void setForceSingleResumeResponse(boolean forceSingleResumeResponse) { - synchronized (monitor) { - this.forceSingleResumeResponse = forceSingleResumeResponse; - } - } - - public void setForceGroupSuspendResponse(Optional<String> forceGroupSuspendResponse) { - synchronized (monitor) { - this.forceGroupSuspendResponse = forceGroupSuspendResponse; - } + public void suspend(String parentHostName, List<String> hostNames) { + callOrderVerifier.add("Suspend with parent: " + parentHostName + " and hostnames: " + hostNames); } } diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java index b154663092e..ddebcdd7a3f 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integrationTests/RunInContainerTest.java @@ -6,6 +6,8 @@ import com.yahoo.application.container.JDisc; import com.yahoo.vespa.hosted.dockerapi.ContainerName; import com.yahoo.vespa.hosted.dockerapi.DockerImage; import com.yahoo.vespa.hosted.node.admin.ContainerNodeSpec; +import com.yahoo.vespa.hosted.node.admin.orchestrator.Orchestrator; +import com.yahoo.vespa.hosted.node.admin.orchestrator.OrchestratorException; import com.yahoo.vespa.hosted.provision.Node; import org.apache.commons.io.IOUtils; import org.apache.http.HttpEntity; @@ -26,20 +28,20 @@ import java.nio.charset.StandardCharsets; import java.time.Instant; import java.util.Arrays; import java.util.Collections; -import java.util.Optional; -import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.when; /** * @author dybis */ public class RunInContainerTest { + private final Orchestrator orchestrator = ComponentsProviderWithMocks.orchestratorMock; + private final String parentHostname = "localhost.test.yahoo.com"; private JDisc container; private int port; @@ -51,6 +53,10 @@ public class RunInContainerTest { @Before public void startContainer() throws Exception { + // To test the initial NodeAdminStateUpdater convergence towards RESUME, orchestrator should + // deny permission to resume for parent host, otherwise it'll converge to RESUME before REST + // handler comes up + doThrow(new RuntimeException()).when(orchestrator).resume(parentHostname); port = findRandomOpenPort(); System.out.println("PORT IS " + port); container = JDisc.fromServicesXml(createServiceXml(port), Networking.enable); @@ -110,19 +116,20 @@ public class RunInContainerTest { @Test public void testGetContainersToRunAPi() throws IOException, InterruptedException { waitForJdiscContainerToServe(); - final String parentHostname = "localhost.test.yahoo.com"; - assertThat(doPutCall("resume"), is(true)); + assertFalse(doPutCall("resume")); // Initial is false to force convergence + doNothing().when(orchestrator).resume(parentHostname); + Thread.sleep(50); + assertTrue(doPutCall("resume")); // No nodes are allocated to this host yet, so freezing should be fine, but orchestrator doesnt allow node-admin suspend - when(ComponentsProviderWithMocks.orchestratorMock.suspend(parentHostname, Collections.singletonList(parentHostname))) - .thenReturn(Optional.of("Cannot suspend because...")); + doThrow(new OrchestratorException("Cannot suspend because...")) + .when(orchestrator).suspend(parentHostname, Collections.singletonList(parentHostname)); assertFalse(doPutCall("suspend/node-admin")); // Orchestrator changes its mind, allows node-admin to suspend when(ComponentsProviderWithMocks.nodeRepositoryMock.getContainersToRun()).thenReturn(Collections.emptyList()); - when(ComponentsProviderWithMocks.orchestratorMock.suspend(parentHostname, Collections.singletonList(parentHostname))) - .thenReturn(Optional.empty()); + doNothing().when(orchestrator).suspend(parentHostname, Collections.singletonList(parentHostname)); Thread.sleep(50); assertTrue(doPutCall("suspend/node-admin")); // Tick loop should've run several times by now, expect to be suspended @@ -145,18 +152,17 @@ public class RunInContainerTest { .nodeType("tenant") .nodeFlavor("docker") .build())); - when(ComponentsProviderWithMocks.orchestratorMock.suspend("localhost.test.yahoo.com", - Arrays.asList("host1.test.yahoo.com", parentHostname))) - .thenReturn(Optional.of("Cant suspend because...")); + doThrow(new OrchestratorException("Cannot suspend because...")).when(orchestrator) + .suspend("localhost.test.yahoo.com", Arrays.asList("host1.test.yahoo.com", parentHostname)); // Orchestrator doesn't allow to suspend either the container or the node-admin assertFalse(doPutCall("suspend/node-admin")); Thread.sleep(50); assertFalse(doPutCall("suspend/node-admin")); - when(ComponentsProviderWithMocks.orchestratorMock.suspend("localhost.test.yahoo.com", - Arrays.asList("host1.test.yahoo.com", parentHostname))) - .thenReturn(Optional.empty()); + doNothing().when(orchestrator) + .suspend("localhost.test.yahoo.com", Arrays.asList("host1.test.yahoo.com", parentHostname)); + // Orchestrator successfully suspended everything Thread.sleep(50); assertTrue(doPutCall("suspend/node-admin")); diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java index 3594a16b182..7dc3d0e8ac2 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminImplTest.java @@ -4,14 +4,9 @@ package com.yahoo.vespa.hosted.node.admin.nodeadmin; import com.yahoo.collections.Pair; import com.yahoo.metrics.simple.MetricReceiver; import com.yahoo.vespa.hosted.dockerapi.metrics.MetricReceiverWrapper; -import com.yahoo.vespa.hosted.node.admin.ContainerNodeSpec; -import com.yahoo.vespa.hosted.dockerapi.Container; -import com.yahoo.vespa.hosted.dockerapi.ContainerName; -import com.yahoo.vespa.hosted.dockerapi.DockerImage; import com.yahoo.vespa.hosted.node.admin.docker.DockerOperations; import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgent; import com.yahoo.vespa.hosted.node.admin.nodeagent.NodeAgentImpl; -import com.yahoo.vespa.hosted.provision.Node; import org.junit.Test; import org.mockito.InOrder; @@ -31,6 +26,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.mock; @@ -54,47 +50,41 @@ public class NodeAdminImplTest { final NodeAdminImpl nodeAdmin = new NodeAdminImpl(dockerOperations, nodeAgentFactory, Optional.empty(), 100, new MetricReceiverWrapper(MetricReceiver.nullImplementation), Optional.empty()); + final String hostName1 = "host1.test.yahoo.com"; + final String hostName2 = "host2.test.yahoo.com"; final NodeAgent nodeAgent1 = mock(NodeAgentImpl.class); final NodeAgent nodeAgent2 = mock(NodeAgentImpl.class); - when(nodeAgentFactory.apply(any(String.class))).thenReturn(nodeAgent1).thenReturn(nodeAgent2); - - final String hostName = "host1.test.yahoo.com"; - final DockerImage dockerImage = new DockerImage("image"); - final ContainerName containerName = new ContainerName("host1"); - final Container existingContainer = new Container(hostName, dockerImage, containerName, Container.State.RUNNING, 5); - final ContainerNodeSpec nodeSpec = new ContainerNodeSpec.Builder() - .hostname(hostName) - .wantedDockerImage(dockerImage) - .nodeState(Node.State.active) - .nodeType("tenant") - .nodeFlavor("docker") - .build(); + when(nodeAgentFactory.apply(eq(hostName1))).thenReturn(nodeAgent1); + when(nodeAgentFactory.apply(eq(hostName2))).thenReturn(nodeAgent2); + final InOrder inOrder = inOrder(nodeAgentFactory, nodeAgent1, nodeAgent2); - nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.emptyList(), Collections.singletonList(existingContainer)); + nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.emptyList(), Collections.singletonList(hostName1)); verifyNoMoreInteractions(nodeAgentFactory); - nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.singletonList(nodeSpec), Collections.singletonList(existingContainer)); - inOrder.verify(nodeAgentFactory).apply(hostName); + nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.singletonList(hostName1), Collections.singletonList(hostName1)); + inOrder.verify(nodeAgentFactory).apply(hostName1); inOrder.verify(nodeAgent1).start(100); inOrder.verify(nodeAgent1, never()).stop(); - nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.singletonList(nodeSpec), Collections.singletonList(existingContainer)); + nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.singletonList(hostName1), Collections.singletonList(hostName1)); inOrder.verify(nodeAgentFactory, never()).apply(any(String.class)); - inOrder.verify(nodeAgent1, never()).start(1); + inOrder.verify(nodeAgent1, never()).start(anyInt()); inOrder.verify(nodeAgent1, never()).stop(); - nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.emptyList(), Collections.singletonList(existingContainer)); + + nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.emptyList(), Collections.singletonList(hostName1)); inOrder.verify(nodeAgentFactory, never()).apply(any(String.class)); verify(nodeAgent1).stop(); - nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.singletonList(nodeSpec), Collections.singletonList(existingContainer)); - inOrder.verify(nodeAgentFactory).apply(hostName); + nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.singletonList(hostName2), Collections.singletonList(hostName1)); + inOrder.verify(nodeAgentFactory).apply(hostName2); inOrder.verify(nodeAgent2).start(100); inOrder.verify(nodeAgent2, never()).stop(); + verify(nodeAgent1).stop(); nodeAdmin.synchronizeNodeSpecsToNodeAgents(Collections.emptyList(), Collections.emptyList()); inOrder.verify(nodeAgentFactory, never()).apply(any(String.class)); - inOrder.verify(nodeAgent2, never()).start(1); + inOrder.verify(nodeAgent2, never()).start(anyInt()); inOrder.verify(nodeAgent2).stop(); verifyNoMoreInteractions(nodeAgent1); @@ -110,30 +100,22 @@ public class NodeAdminImplTest { new MetricReceiverWrapper(MetricReceiver.nullImplementation), Optional.empty()); List<NodeAgent> nodeAgents = new ArrayList<>(); - List<Container> existingContainers = new ArrayList<>(); - List<ContainerNodeSpec> nodeSpecs = new ArrayList<>(); - final DockerImage dockerImage = new DockerImage("image"); + List<String> existingContainerHostnames = new ArrayList<>(); for (int i = 0; i < 3; i++) { final String hostName = "host" + i + ".test.yahoo.com"; NodeAgent nodeAgent = mock(NodeAgent.class); nodeAgents.add(nodeAgent); when(nodeAgentFactory.apply(eq(hostName))).thenReturn(nodeAgent); - final ContainerName containerName = new ContainerName("host" + i); - existingContainers.add( - new Container(hostName, dockerImage, containerName, Container.State.RUNNING, 5)); + existingContainerHostnames.add(hostName); + } - nodeSpecs.add( - new ContainerNodeSpec.Builder() - .hostname(hostName) - .wantedDockerImage(dockerImage) - .nodeState(Node.State.active) - .nodeType("tenant") - .nodeFlavor("docker") - .build()); + nodeAdmin.synchronizeNodeSpecsToNodeAgents(existingContainerHostnames, existingContainerHostnames); + + assertTrue(nodeAdmin.isFrozen()); // Initially everything is frozen to force convergence + mockNodeAgentSetFrozenResponse(nodeAgents, true, true, true); + assertTrue(nodeAdmin.setFrozen(false)); // Unfreeze everything - } - nodeAdmin.synchronizeNodeSpecsToNodeAgents(nodeSpecs, existingContainers); mockNodeAgentSetFrozenResponse(nodeAgents, false, false, false); assertFalse(nodeAdmin.setFrozen(true)); // NodeAdmin freezes only when all the NodeAgents are frozen diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdaterTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdaterTest.java index 28da1192b3b..2ce7e2a3699 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdaterTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeadmin/NodeAdminStateUpdaterTest.java @@ -5,6 +5,7 @@ import com.yahoo.test.ManualClock; import com.yahoo.vespa.hosted.node.admin.ContainerNodeSpec; import com.yahoo.vespa.hosted.node.admin.noderepository.NodeRepository; import com.yahoo.vespa.hosted.node.admin.orchestrator.Orchestrator; +import com.yahoo.vespa.hosted.node.admin.orchestrator.OrchestratorException; import com.yahoo.vespa.hosted.provision.Node; import org.junit.Test; @@ -13,11 +14,11 @@ import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Optional; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -62,14 +63,21 @@ public class NodeAdminStateUpdaterTest { when(nodeRepository.getContainersToRun()).thenReturn(containersToRun); - // Initially we start with everything running and we want to continue running, therefore we are converged - // and ticks should complete without ever calling NodeAdmin - tickAfter(0); + // Initially everything is frozen to force convergence + assertFalse(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.RESUMED)); + when(nodeAdmin.setFrozen(eq(false))).thenReturn(true); + doNothing().when(orchestrator).resume(parentHostname); + tickAfter(0); // The first tick should unfreeze + verify(orchestrator, times(1)).resume(parentHostname); // Resume host + verify(orchestrator, times(1)).resume(parentHostname); + + // Everything is running and we want to continue running, therefore we have converged assertTrue(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.RESUMED)); tickAfter(35); tickAfter(35); assertTrue(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.RESUMED)); verify(refresher, never()).signalWorkToBeDone(); // No attempt in changing state + verify(orchestrator, times(1)).resume(parentHostname); // Already resumed // Lets try to suspend node admin only, immediately we get false back, and need to wait until next // tick before any change can happen @@ -84,13 +92,12 @@ public class NodeAdminStateUpdaterTest { verify(refresher, times(1)).signalWorkToBeDone(); // No change in desired state when(nodeAdmin.setFrozen(eq(true))).thenReturn(true); - when(orchestrator.suspend(eq(parentHostname), eq(suspendHostnames))) - .thenReturn(Optional.of("Cannot allow to suspend because some reason")) - .thenReturn(Optional.empty()); + doThrow(new RuntimeException("Cannot allow to suspend because some reason")).doNothing() + .when(orchestrator).suspend(eq(parentHostname), eq(suspendHostnames)); tickAfter(35); assertFalse(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.SUSPENDED_NODE_ADMIN)); verify(refresher, times(1)).signalWorkToBeDone(); - verify(nodeAdmin, times(1)).setFrozen(eq(false)); // Roll back + verify(nodeAdmin, times(1)).setFrozen(eq(false)); tickAfter(35); assertTrue(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.SUSPENDED_NODE_ADMIN)); @@ -117,13 +124,15 @@ public class NodeAdminStateUpdaterTest { // Lets try going back to resumed - when(nodeAdmin.setFrozen(eq(false))).thenReturn(false); // NodeAgents not converged to yet + when(nodeAdmin.setFrozen(eq(false))).thenReturn(false).thenReturn(true); // NodeAgents not converged to yet assertFalse(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.RESUMED)); tickAfter(35); assertFalse(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.RESUMED)); - when(nodeAdmin.setFrozen(eq(false))).thenReturn(true); - assertFalse(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.RESUMED)); // Still false before tick + doThrow(new OrchestratorException("Cannot allow to suspend " + parentHostname)).doNothing() + .when(orchestrator).resume(parentHostname); + tickAfter(35); + assertFalse(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.RESUMED)); tickAfter(35); assertTrue(refresher.setResumeStateAndCheckIfResumed(NodeAdminStateUpdater.State.RESUMED)); } diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java index 2ebfb6a6618..64c37fedd53 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java @@ -323,7 +323,6 @@ public class NodeAgentImplTest { NodeAgentImpl nodeAgent = makeNodeAgent(dockerImage, true); when(nodeRepository.getContainerNodeSpec(hostName)).thenReturn(Optional.of(nodeSpec)); - when(orchestrator.suspend(eq(hostName))).thenReturn(true); nodeAgent.converge(); @@ -335,6 +334,7 @@ public class NodeAgentImplTest { verify(dockerOperations, never()).startContainer(eq(containerName), any()); verify(orchestrator, never()).resume(any(String.class)); + verify(orchestrator, never()).suspend(any(String.class)); // current Docker image and vespa version should be cleared verify(nodeRepository, times(1)).updateNodeAttributes( any(String.class), eq(new NodeAttributes() diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImplTest.java index 39af637a45a..c618b5c4648 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/orchestrator/OrchestratorImplTest.java @@ -13,11 +13,10 @@ import java.util.Arrays; import java.util.List; import java.util.Optional; -import static org.junit.Assert.*; import static org.mockito.Mockito.*; /** - * @author valerijf + * @author freva */ public class OrchestratorImplTest { private static final String hostName = "host123.yahoo.com"; @@ -39,11 +38,10 @@ public class OrchestratorImplTest { UpdateHostResponse.class )).thenReturn(new UpdateHostResponse(hostName, null)); - boolean response = orchestrator.suspend(hostName); - assertTrue("Expected Orchestrator to approve", response); + orchestrator.suspend(hostName); } - @Test + @Test(expected=OrchestratorException.class) public void testSuspendCallWithFailureReason() { when(requestExecutor.put( OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName+ "/suspended", @@ -52,11 +50,10 @@ public class OrchestratorImplTest { UpdateHostResponse.class )).thenReturn(new UpdateHostResponse(hostName, new HostStateChangeDenialReason("hostname", "service", "fail"))); - boolean response = orchestrator.suspend(hostName); - assertFalse("Expected Orchestrator to deny when presented with HostChangeDenialReason", response); + orchestrator.suspend(hostName); } - @Test + @Test(expected=OrchestratorNotFoundException.class) public void testSuspendCallWithNotFound() { when(requestExecutor.put( any(String.class), @@ -65,11 +62,10 @@ public class OrchestratorImplTest { any() )).thenThrow(requestExecutor.new NotFoundException("Not Found")); - boolean response = orchestrator.suspend(hostName); - assertTrue("Expected Orchestrator to respond with true even when NotFoundException is thrown", response); + orchestrator.suspend(hostName); } - @Test + @Test(expected=RuntimeException.class) public void testSuspendCallWithSomeOtherException() { when(requestExecutor.put( any(String.class), @@ -78,8 +74,7 @@ public class OrchestratorImplTest { any() )).thenThrow(new RuntimeException("Some parameter was wrong")); - boolean response = orchestrator.suspend(hostName); - assertFalse("Expected Orchestrator to respond with false when some other exception is thrown", response); + orchestrator.suspend(hostName); } @@ -91,11 +86,10 @@ public class OrchestratorImplTest { UpdateHostResponse.class )).thenReturn(new UpdateHostResponse(hostName, null)); - boolean response = orchestrator.resume(hostName); - assertTrue("Expected Orchestrator to approve", response); + orchestrator.resume(hostName); } - @Test + @Test(expected=OrchestratorException.class) public void testResumeCallWithFailureReason() { when(requestExecutor.delete( OrchestratorImpl.ORCHESTRATOR_PATH_PREFIX_HOST_API + "/" + hostName+ "/suspended", @@ -103,11 +97,10 @@ public class OrchestratorImplTest { UpdateHostResponse.class )).thenReturn(new UpdateHostResponse(hostName, new HostStateChangeDenialReason("hostname", "service", "fail"))); - boolean response = orchestrator.resume(hostName); - assertFalse("Expected Orchestrator to deny when presented with HostChangeDenialReason", response); + orchestrator.resume(hostName); } - @Test + @Test(expected=OrchestratorNotFoundException.class) public void testResumeCallWithNotFound() { when(requestExecutor.delete( any(String.class), @@ -115,11 +108,10 @@ public class OrchestratorImplTest { any() )).thenThrow(requestExecutor.new NotFoundException("Not Found")); - boolean response = orchestrator.resume(hostName); - assertTrue("Expected Orchestrator to respond with true even when NotFoundException is thrown", response); + orchestrator.resume(hostName); } - @Test + @Test(expected=RuntimeException.class) public void testResumeCallWithSomeOtherException() { when(requestExecutor.put( any(String.class), @@ -128,8 +120,7 @@ public class OrchestratorImplTest { any() )).thenThrow(new RuntimeException("Some parameter was wrong")); - boolean response = orchestrator.suspend(hostName); - assertFalse("Expected Orchestrator to respond with false when some other exception is thrown", response); + orchestrator.suspend(hostName); } @@ -145,11 +136,10 @@ public class OrchestratorImplTest { BatchOperationResult.class )).thenReturn(BatchOperationResult.successResult()); - Optional<String> response = orchestrator.suspend(parentHostName, hostNames); - assertFalse("Expected failureReason to be empty", response.isPresent()); + orchestrator.suspend(parentHostName, hostNames); } - @Test + @Test(expected=OrchestratorException.class) public void testBatchSuspendCallWithFailureReason() { String parentHostName = "host1.test.yahoo.com"; List<String> hostNames = Arrays.asList("a1.host1.test.yahoo.com", "a2.host1.test.yahoo.com"); @@ -162,11 +152,10 @@ public class OrchestratorImplTest { BatchOperationResult.class )).thenReturn(new BatchOperationResult(failureReason)); - Optional<String> response = orchestrator.suspend(parentHostName, hostNames); - assertEquals("Expected failureReason to be empty", response, Optional.of(failureReason)); + orchestrator.suspend(parentHostName, hostNames); } - @Test + @Test(expected=RuntimeException.class) public void testBatchSuspendCallWithSomeException() { String parentHostName = "host1.test.yahoo.com"; List<String> hostNames = Arrays.asList("a1.host1.test.yahoo.com", "a2.host1.test.yahoo.com"); @@ -179,7 +168,6 @@ public class OrchestratorImplTest { BatchOperationResult.class )).thenThrow(new RuntimeException(exceptionMessage)); - Optional<String> response = orchestrator.suspend(parentHostName, hostNames); - assertEquals("Expected failureReason to be empty", response, Optional.of(exceptionMessage)); + orchestrator.suspend(parentHostName, hostNames); } } diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutorTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutorTest.java index 2fcb3df9b82..cc1db1eb3c7 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutorTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/util/ConfigServerHttpRequestExecutorTest.java @@ -17,15 +17,10 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.List; import java.util.Set; -import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.startsWith; import static org.hamcrest.Matchers.arrayContainingInAnyOrder; -import static org.hamcrest.Matchers.containsString; import static org.hamcrest.junit.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java index 96691f8402e..90527c69b2d 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollector.java @@ -57,7 +57,7 @@ public class CoreCollector { Path readBinPathFallback(Path coredumpPath) throws IOException, InterruptedException { String command = GDB_PATH + " -n -batch -core " + coredumpPath + " | grep \'^Core was generated by\'"; - Pair<Integer, String> result = processExecuter.exec(new String[]{"sh", "-c", "\"" + command + "\""}); + Pair<Integer, String> result = processExecuter.exec(new String[]{"sh", "-c", command}); Matcher matcher = CORE_GENERATOR_PATH_PATTERN.matcher(result.getSecond()); if (! matcher.find()) { @@ -111,7 +111,7 @@ public class CoreCollector { data.put("backtrace", readBacktrace(coredumpPath, binPath, false)); data.put("backtrace_all_threads", readBacktrace(coredumpPath, binPath, true)); } catch (Throwable e) { - logger.log(Level.WARNING, "Failed to extrect backtrace", e); + logger.log(Level.WARNING, "Failed to extract backtrace", e); } yinstStatePath.ifPresent(yinstState -> { @@ -131,7 +131,7 @@ public class CoreCollector { try { deleteDecompressedCoredump(coredumpPath); } catch (IOException e) { - logger.log(Level.WARNING, "Failed to deleting compressed core dump", e); + logger.log(Level.WARNING, "Failed to delete decompressed core dump", e); } return data; } diff --git a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/Maintainer.java b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/Maintainer.java index 8a1751fe9a7..932681c4c26 100644 --- a/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/Maintainer.java +++ b/node-maintainer/src/main/java/com/yahoo/vespa/hosted/node/maintainer/Maintainer.java @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.maintainer; +import com.yahoo.log.LogSetup; import com.yahoo.slime.ArrayTraverser; import com.yahoo.slime.Inspector; import com.yahoo.slime.Type; @@ -26,13 +27,14 @@ public class Maintainer { private static final HttpClient httpClient = HttpClientBuilder.create().build(); public static void main(String[] args) { + LogSetup.initVespaLogging("node-maintainer"); if (args.length != 1) { throw new RuntimeException("Expected only 1 argument - a JSON list of maintainer jobs to execute"); } Inspector object = SlimeUtils.jsonToSlime(args[0].getBytes()).get(); if (object.type() != Type.ARRAY) { - throw new IllegalArgumentException("Expected a list maintainer jobs to execute"); + throw new IllegalArgumentException("Expected a list of maintainer jobs to execute"); } // Variable must be effectively final to be used in lambda expression diff --git a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java index ae771504729..7c32a8a9912 100644 --- a/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java +++ b/node-maintainer/src/test/java/com/yahoo/vespa/hosted/node/maintainer/CoreCollectorTest.java @@ -87,7 +87,7 @@ public class CoreCollectorTest { Path fallbackResponse = Paths.get("/response/from/fallback"); - mockExec(new String[]{"sh", "-c", "\"/home/y/bin64/gdb -n -batch -core /tmp/core.1234 | grep '^Core was generated by'\""}, + mockExec(new String[]{"sh", "-c", "/home/y/bin64/gdb -n -batch -core /tmp/core.1234 | grep '^Core was generated by'"}, "Core was generated by `/response/from/fallback'."); mockExec(cmd, "/tmp/core.1234: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style"); @@ -100,7 +100,7 @@ public class CoreCollectorTest { @Test public void extractsBinaryPathUsingGdbTest() throws IOException, InterruptedException { final String[] cmd = new String[]{"sh", "-c", - "\"/home/y/bin64/gdb -n -batch -core /tmp/core.1234 | grep '^Core was generated by'\""}; + "/home/y/bin64/gdb -n -batch -core /tmp/core.1234 | grep '^Core was generated by'"}; mockExec(cmd, "Core was generated by `/usr/bin/program-from-gdb --identity foo/search/cluster.content_'."); assertEquals(Paths.get("/usr/bin/program-from-gdb"), coreCollector.readBinPathFallback(TEST_CORE_PATH)); diff --git a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java index a12d77ecbd5..d89541daebb 100644 --- a/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java +++ b/node-repository/src/test/java/com/yahoo/vespa/hosted/provision/provisioning/ProvisioningTest.java @@ -12,6 +12,7 @@ import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.HostFilter; import com.yahoo.config.provision.HostSpec; import com.yahoo.config.provision.InstanceName; +import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.OutOfCapacityException; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.TenantName; @@ -238,7 +239,8 @@ public class ProvisioningTest { config.defaultFlavor("not-used"); config.defaultContainerFlavor("small"); config.defaultContentFlavor("large"); - ProvisioningTester tester = new ProvisioningTester(new Zone(new ConfigserverConfig(config))); + ProvisioningTester tester = new ProvisioningTester(new Zone(new ConfigserverConfig(config), + new NodeFlavors(new FlavorsConfig(new FlavorsConfig.Builder())))); ApplicationId application1 = tester.makeApplicationId(); diff --git a/persistence/src/tests/dummyimpl/dummyimpltest.cpp b/persistence/src/tests/dummyimpl/dummyimpltest.cpp index 764eb08af83..4b107fde324 100644 --- a/persistence/src/tests/dummyimpl/dummyimpltest.cpp +++ b/persistence/src/tests/dummyimpl/dummyimpltest.cpp @@ -14,19 +14,13 @@ namespace spi { struct DummyImplTest : public ConformanceTest { struct Factory : public PersistenceFactory { using Repo = document::DocumentTypeRepo; + PersistenceProvider::UP - getPersistenceImplementation(const Repo::SP& repo, const Repo::DocumenttypesConfig&) { + getPersistenceImplementation(const Repo::SP& repo, const Repo::DocumenttypesConfig&) override { return PersistenceProvider::UP(new dummy::DummyPersistence(repo, 4)); } - bool - supportsActiveState() const - { - return true; - } - bool - supportsRevert() const - { + bool supportsActiveState() const override { return true; } }; diff --git a/persistence/src/tests/proxy/dummy_provider_factory.h b/persistence/src/tests/proxy/dummy_provider_factory.h index 8330b4a917b..61cb6f02874 100644 --- a/persistence/src/tests/proxy/dummy_provider_factory.h +++ b/persistence/src/tests/proxy/dummy_provider_factory.h @@ -22,7 +22,7 @@ struct DummyProviderFactory : ProviderStub::PersistenceProviderFactory DummyProviderFactory(std::unique_ptr<Provider> p) : provider(std::move(p)) {} - std::unique_ptr<Provider> create() const { + std::unique_ptr<Provider> create() const override { ASSERT_TRUE(provider.get() != 0); std::unique_ptr<Provider> ret = std::move(provider); ASSERT_TRUE(provider.get() == 0); diff --git a/persistence/src/tests/proxy/mockprovider.h b/persistence/src/tests/proxy/mockprovider.h index fa15334625d..b7019239847 100644 --- a/persistence/src/tests/proxy/mockprovider.h +++ b/persistence/src/tests/proxy/mockprovider.h @@ -20,35 +20,34 @@ struct MockProvider : PersistenceProvider { MockProvider() : last_called(NONE) {} - virtual Result initialize() { + virtual Result initialize() override { last_called = INITIALIZE; return Result(); } - virtual PartitionStateListResult getPartitionStates() const { + virtual PartitionStateListResult getPartitionStates() const override { last_called = GET_PARTITION_STATES; return PartitionStateListResult(PartitionStateList(1u)); } - virtual BucketIdListResult listBuckets(PartitionId id) const { + virtual BucketIdListResult listBuckets(PartitionId id) const override { last_called = LIST_BUCKETS; BucketIdListResult::List result; result.push_back(document::BucketId(id)); return BucketIdListResult(result); } - virtual Result setClusterState(const ClusterState &) { + virtual Result setClusterState(const ClusterState &) override { last_called = SET_CLUSTER_STATE; return Result(); } - virtual Result setActiveState(const Bucket &, - BucketInfo::ActiveState) { + virtual Result setActiveState(const Bucket &, BucketInfo::ActiveState) override { last_called = SET_ACTIVE_STATE; return Result(); } - virtual BucketInfoResult getBucketInfo(const Bucket &bucket) const { + virtual BucketInfoResult getBucketInfo(const Bucket &bucket) const override { last_called = GET_BUCKET_INFO; return BucketInfoResult(BucketInfo(BucketChecksum(1), 2, 3, bucket.getBucketId().getRawId(), @@ -57,19 +56,17 @@ struct MockProvider : PersistenceProvider { BucketInfo::ACTIVE)); } - virtual Result put(const Bucket &, Timestamp, const DocumentSP&, Context&) { + virtual Result put(const Bucket &, Timestamp, const DocumentSP&, Context&) override { last_called = PUT; return Result(); } - virtual RemoveResult remove(const Bucket &, Timestamp, - const DocumentId &, Context&) { + virtual RemoveResult remove(const Bucket &, Timestamp, const DocumentId &, Context&) override { last_called = REMOVE_BY_ID; return RemoveResult(true); } - virtual RemoveResult removeIfFound(const Bucket &, Timestamp, - const DocumentId &, Context&) { + virtual RemoveResult removeIfFound(const Bucket &, Timestamp, const DocumentId &, Context&) override { last_called = REMOVE_IF_FOUND; return RemoveResult(true); } @@ -80,19 +77,17 @@ struct MockProvider : PersistenceProvider { return RemoveResult(true); } - virtual UpdateResult update(const Bucket &, Timestamp timestamp, - const DocumentUpdateSP&, Context&) { + virtual UpdateResult update(const Bucket &, Timestamp timestamp, const DocumentUpdateSP&, Context&) override { last_called = UPDATE; return UpdateResult(Timestamp(timestamp - 10)); } - virtual Result flush(const Bucket&, Context&) { + virtual Result flush(const Bucket&, Context&) override { last_called = FLUSH; return Result(); } - virtual GetResult get(const Bucket &, const document::FieldSet&, - const DocumentId&, Context&) const { + virtual GetResult get(const Bucket &, const document::FieldSet&, const DocumentId&, Context&) const override { last_called = GET; return GetResult(Document::UP(new Document), Timestamp(6u)); @@ -102,34 +97,34 @@ struct MockProvider : PersistenceProvider { const document::FieldSet&, const Selection&, IncludedVersions, - Context&) + Context&) override { last_called = CREATE_ITERATOR; return CreateIteratorResult(IteratorId(bucket.getPartition())); } - virtual IterateResult iterate(IteratorId, uint64_t, Context&) const { + virtual IterateResult iterate(IteratorId, uint64_t, Context&) const override { last_called = ITERATE; IterateResult::List result; result.push_back(DocEntry::UP(new DocEntry(Timestamp(1), 0))); return IterateResult(std::move(result), true); } - virtual Result destroyIterator(IteratorId, Context&) { + virtual Result destroyIterator(IteratorId, Context&) override { last_called = DESTROY_ITERATOR; return Result(); } - virtual Result createBucket(const Bucket&, Context&) { + virtual Result createBucket(const Bucket&, Context&) override { last_called = CREATE_BUCKET; return Result(); } - virtual Result deleteBucket(const Bucket&, Context&) { + virtual Result deleteBucket(const Bucket&, Context&) override { last_called = DELETE_BUCKET; return Result(); } - virtual BucketIdListResult getModifiedBuckets() const { + virtual BucketIdListResult getModifiedBuckets() const override { last_called = GET_MODIFIED_BUCKETS; BucketIdListResult::List list; list.push_back(document::BucketId(2)); @@ -137,32 +132,30 @@ struct MockProvider : PersistenceProvider { return BucketIdListResult(list); } - virtual Result split(const Bucket &, const Bucket &, const Bucket &, - Context&) + virtual Result split(const Bucket &, const Bucket &, const Bucket &, Context&) override { last_called = SPLIT; return Result(); } - virtual Result join(const Bucket &, const Bucket &, const Bucket &, - Context&) + virtual Result join(const Bucket &, const Bucket &, const Bucket &, Context&) override { last_called = JOIN; return Result(); } - virtual Result move(const Bucket &, PartitionId, Context&) { + virtual Result move(const Bucket &, PartitionId, Context&) override { last_called = MOVE; return Result(); } - virtual Result maintain(const Bucket &, MaintenanceLevel) { + virtual Result maintain(const Bucket &, MaintenanceLevel) override { last_called = MAINTAIN; return Result(); } - virtual Result removeEntry(const Bucket &, Timestamp, Context&) { + virtual Result removeEntry(const Bucket &, Timestamp, Context&) override { last_called = REMOVE_ENTRY; return Result(); } diff --git a/persistence/src/tests/proxy/providerproxy_conformancetest.cpp b/persistence/src/tests/proxy/providerproxy_conformancetest.cpp index 8fca5303a53..a33b736a12d 100644 --- a/persistence/src/tests/proxy/providerproxy_conformancetest.cpp +++ b/persistence/src/tests/proxy/providerproxy_conformancetest.cpp @@ -17,12 +17,12 @@ namespace { struct DummyFactory : Factory { PersistenceProvider::UP getPersistenceImplementation(const Repo::SP& repo, - const Repo::DocumenttypesConfig &) { + const Repo::DocumenttypesConfig &) override { return PersistenceProvider::UP(new dummy::DummyPersistence(repo, 4)); } virtual bool - supportsActiveState() const + supportsActiveState() const override { return true; } diff --git a/persistence/src/tests/proxy/proxy_factory_wrapper.h b/persistence/src/tests/proxy/proxy_factory_wrapper.h index 19f763201c4..5d7899e7ff9 100644 --- a/persistence/src/tests/proxy/proxy_factory_wrapper.h +++ b/persistence/src/tests/proxy/proxy_factory_wrapper.h @@ -48,7 +48,7 @@ struct ProxyFactoryWrapper : ConformanceTest::PersistenceFactory } virtual bool - supportsActiveState() const + supportsActiveState() const override { return factory->supportsActiveState(); } diff --git a/persistence/src/tests/proxy/proxyfactory.h b/persistence/src/tests/proxy/proxyfactory.h index dd19a80dc35..3a18440a6e7 100644 --- a/persistence/src/tests/proxy/proxyfactory.h +++ b/persistence/src/tests/proxy/proxyfactory.h @@ -26,12 +26,12 @@ struct ProxyFactory : ConformanceTest::PersistenceFactory ProxyFactory() {} Provider::UP - getPersistenceImplementation(const Repo::SP &repo, const Repo::DocumenttypesConfig &) { + getPersistenceImplementation(const Repo::SP &repo, const Repo::DocumenttypesConfig &) override { return Provider::UP(new Client("tcp/localhost:3456", *repo)); } virtual bool - supportsActiveState() const + supportsActiveState() const override { return false; } diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h index 940e72d1668..1dee3fb60c3 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h @@ -132,8 +132,8 @@ public: DummyPersistence(const document::DocumentTypeRepo::SP& repo, uint16_t partitionCount = 1); - PartitionStateListResult getPartitionStates() const; - BucketIdListResult listBuckets(PartitionId) const; + PartitionStateListResult getPartitionStates() const override; + BucketIdListResult listBuckets(PartitionId) const override; void setModifiedBuckets(const BucketIdListResult::List& result); @@ -141,52 +141,52 @@ public: * Returns the list set by setModifiedBuckets(), then clears * the list. */ - BucketIdListResult getModifiedBuckets() const; + BucketIdListResult getModifiedBuckets() const override; - Result setClusterState(const ClusterState& newState); + Result setClusterState(const ClusterState& newState) override; Result setActiveState(const Bucket& bucket, - BucketInfo::ActiveState newState); + BucketInfo::ActiveState newState) override; - BucketInfoResult getBucketInfo(const Bucket&) const; + BucketInfoResult getBucketInfo(const Bucket&) const override; + + Result put(const Bucket&, Timestamp, const DocumentSP&, Context&) override; - Result put(const Bucket&, Timestamp, const DocumentSP&, Context&); GetResult get(const Bucket&, const document::FieldSet& fieldSet, const DocumentId&, - Context&) const; + Context&) const override; RemoveResult remove(const Bucket& b, Timestamp t, const DocumentId& did, - Context&); + Context&) override; CreateIteratorResult createIterator(const Bucket&, const document::FieldSet& fs, const Selection&, IncludedVersions, - Context&); + Context&) override; - IterateResult iterate(IteratorId, uint64_t maxByteSize, Context&) const; - Result destroyIterator(IteratorId, Context&); + IterateResult iterate(IteratorId, uint64_t maxByteSize, Context&) const override; + Result destroyIterator(IteratorId, Context&) override; - Result createBucket(const Bucket&, Context&); - Result deleteBucket(const Bucket&, Context&); + Result createBucket(const Bucket&, Context&) override; + Result deleteBucket(const Bucket&, Context&) override; Result split(const Bucket& source, const Bucket& target1, const Bucket& target2, - Context&); + Context&) override; Result join(const Bucket& source1, const Bucket& source2, const Bucket& target, - Context&); + Context&) override; Result revert(const Bucket&, Timestamp, Context&); - Result maintain(const Bucket& bucket, - MaintenanceLevel level); + Result maintain(const Bucket& bucket, MaintenanceLevel level) override; /** * The following methods are used only for unit testing. diff --git a/persistence/src/vespa/persistence/proxy/providerstub.h b/persistence/src/vespa/persistence/proxy/providerstub.h index 3d946845fa5..27e726ca538 100644 --- a/persistence/src/vespa/persistence/proxy/providerstub.h +++ b/persistence/src/vespa/persistence/proxy/providerstub.h @@ -29,7 +29,7 @@ private: vespalib::ThreadStackExecutor &e, std::unique_ptr<PersistenceProvider> &p) : FNET_Task(s), executor(e), provider(p) {} - virtual void PerformTask() { + virtual void PerformTask() override { executor.sync(); assert(provider.get() != 0); provider.reset(); diff --git a/searchcommon/src/tests/schema/imported-fields-cfg/imported-fields.cfg b/searchcommon/src/tests/schema/imported-fields-cfg/imported-fields.cfg index ccfec672134..d41ccc4bd61 100644 --- a/searchcommon/src/tests/schema/imported-fields-cfg/imported-fields.cfg +++ b/searchcommon/src/tests/schema/imported-fields-cfg/imported-fields.cfg @@ -2,6 +2,10 @@ attribute[2] attribute[0].name imported_a attribute[0].referencefield ref_a attribute[0].targetfield target_a +attribute[0].datatype INT32 +attribute[0].collectiontype SINGLE attribute[1].name imported_b attribute[1].referencefield ref_b attribute[1].targetfield target_b +attribute[1].datatype STRING +attribute[1].collectiontype ARRAY diff --git a/searchcommon/src/tests/schema/schema_test.cpp b/searchcommon/src/tests/schema/schema_test.cpp index f399215dbda..9368e92f691 100644 --- a/searchcommon/src/tests/schema/schema_test.cpp +++ b/searchcommon/src/tests/schema/schema_test.cpp @@ -13,6 +13,8 @@ using vespalib::string; namespace search { namespace index { +using schema::DataType; +using schema::CollectionType; using SIAF = Schema::ImportedAttributeField; void assertField(const Schema::Field & exp, const Schema::Field & act) { @@ -72,34 +74,34 @@ TEST("testBasic") { EXPECT_EQUAL(0u, s.getNumSummaryFields()); EXPECT_EQUAL(0u, s.getNumImportedAttributeFields()); - s.addIndexField(Schema::IndexField("foo", schema::STRING)); - s.addIndexField(Schema::IndexField("bar", schema::INT32)); + s.addIndexField(Schema::IndexField("foo", DataType::STRING)); + s.addIndexField(Schema::IndexField("bar", DataType::INT32)); - s.addAttributeField(Schema::AttributeField("foo", schema::STRING, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("bar", schema::INT32, schema::WEIGHTEDSET)); - s.addAttributeField(Schema::AttributeField("cox", schema::STRING)); + s.addAttributeField(Schema::AttributeField("foo", DataType::STRING, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("bar", DataType::INT32, CollectionType::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("cox", DataType::STRING)); - s.addSummaryField(Schema::SummaryField("foo", schema::STRING, schema::ARRAY)); - s.addSummaryField(Schema::SummaryField("bar", schema::INT32, schema::WEIGHTEDSET)); - s.addSummaryField(Schema::SummaryField("cox", schema::STRING)); - s.addSummaryField(Schema::SummaryField("fox", schema::RAW)); + s.addSummaryField(Schema::SummaryField("foo", DataType::STRING, CollectionType::ARRAY)); + s.addSummaryField(Schema::SummaryField("bar", DataType::INT32, CollectionType::WEIGHTEDSET)); + s.addSummaryField(Schema::SummaryField("cox", DataType::STRING)); + s.addSummaryField(Schema::SummaryField("fox", DataType::RAW)); s.addFieldSet(Schema::FieldSet("default").addField("foo").addField("bar")); - s.addImportedAttributeField(SIAF("imported", schema::INT32)); + s.addImportedAttributeField(SIAF("imported", DataType::INT32)); EXPECT_EQUAL(2u, s.getNumIndexFields()); { EXPECT_EQUAL("foo", s.getIndexField(0).getName()); - EXPECT_EQUAL(schema::STRING, s.getIndexField(0).getDataType()); - EXPECT_EQUAL(schema::SINGLE, s.getIndexField(0).getCollectionType()); + EXPECT_EQUAL(DataType::STRING, s.getIndexField(0).getDataType()); + EXPECT_EQUAL(CollectionType::SINGLE, s.getIndexField(0).getCollectionType()); EXPECT_TRUE(!s.getIndexField(0).hasPrefix()); EXPECT_TRUE(!s.getIndexField(0).hasPhrases()); EXPECT_TRUE(s.getIndexField(0).hasPositions()); EXPECT_EQUAL("bar", s.getIndexField(1).getName()); - EXPECT_EQUAL(schema::INT32, s.getIndexField(1).getDataType()); - EXPECT_EQUAL(schema::SINGLE, s.getIndexField(1).getCollectionType()); + EXPECT_EQUAL(DataType::INT32, s.getIndexField(1).getDataType()); + EXPECT_EQUAL(CollectionType::SINGLE, s.getIndexField(1).getCollectionType()); EXPECT_EQUAL(0u, s.getIndexFieldId("foo")); EXPECT_EQUAL(1u, s.getIndexFieldId("bar")); @@ -108,16 +110,16 @@ TEST("testBasic") { EXPECT_EQUAL(3u, s.getNumAttributeFields()); { EXPECT_EQUAL("foo", s.getAttributeField(0).getName()); - EXPECT_EQUAL(schema::STRING, s.getAttributeField(0).getDataType()); - EXPECT_EQUAL(schema::ARRAY, s.getAttributeField(0).getCollectionType()); + EXPECT_EQUAL(DataType::STRING, s.getAttributeField(0).getDataType()); + EXPECT_EQUAL(CollectionType::ARRAY, s.getAttributeField(0).getCollectionType()); EXPECT_EQUAL("bar", s.getAttributeField(1).getName()); - EXPECT_EQUAL(schema::INT32, s.getAttributeField(1).getDataType()); - EXPECT_EQUAL(schema::WEIGHTEDSET, s.getAttributeField(1).getCollectionType()); + EXPECT_EQUAL(DataType::INT32, s.getAttributeField(1).getDataType()); + EXPECT_EQUAL(CollectionType::WEIGHTEDSET, s.getAttributeField(1).getCollectionType()); EXPECT_EQUAL("cox", s.getAttributeField(2).getName()); - EXPECT_EQUAL(schema::STRING, s.getAttributeField(2).getDataType()); - EXPECT_EQUAL(schema::SINGLE, s.getAttributeField(2).getCollectionType()); + EXPECT_EQUAL(DataType::STRING, s.getAttributeField(2).getDataType()); + EXPECT_EQUAL(CollectionType::SINGLE, s.getAttributeField(2).getCollectionType()); EXPECT_EQUAL(0u, s.getAttributeFieldId("foo")); EXPECT_EQUAL(1u, s.getAttributeFieldId("bar")); @@ -127,20 +129,20 @@ TEST("testBasic") { EXPECT_EQUAL(4u, s.getNumSummaryFields()); { EXPECT_EQUAL("foo", s.getSummaryField(0).getName()); - EXPECT_EQUAL(schema::STRING, s.getSummaryField(0).getDataType()); - EXPECT_EQUAL(schema::ARRAY, s.getSummaryField(0).getCollectionType()); + EXPECT_EQUAL(DataType::STRING, s.getSummaryField(0).getDataType()); + EXPECT_EQUAL(CollectionType::ARRAY, s.getSummaryField(0).getCollectionType()); EXPECT_EQUAL("bar", s.getSummaryField(1).getName()); - EXPECT_EQUAL(schema::INT32, s.getSummaryField(1).getDataType()); - EXPECT_EQUAL(schema::WEIGHTEDSET, s.getSummaryField(1).getCollectionType()); + EXPECT_EQUAL(DataType::INT32, s.getSummaryField(1).getDataType()); + EXPECT_EQUAL(CollectionType::WEIGHTEDSET, s.getSummaryField(1).getCollectionType()); EXPECT_EQUAL("cox", s.getSummaryField(2).getName()); - EXPECT_EQUAL(schema::STRING, s.getSummaryField(2).getDataType()); - EXPECT_EQUAL(schema::SINGLE, s.getSummaryField(2).getCollectionType()); + EXPECT_EQUAL(DataType::STRING, s.getSummaryField(2).getDataType()); + EXPECT_EQUAL(CollectionType::SINGLE, s.getSummaryField(2).getCollectionType()); EXPECT_EQUAL("fox", s.getSummaryField(3).getName()); - EXPECT_EQUAL(schema::RAW, s.getSummaryField(3).getDataType()); - EXPECT_EQUAL(schema::SINGLE, s.getSummaryField(3).getCollectionType()); + EXPECT_EQUAL(DataType::RAW, s.getSummaryField(3).getDataType()); + EXPECT_EQUAL(CollectionType::SINGLE, s.getSummaryField(3).getCollectionType()); EXPECT_EQUAL(0u, s.getSummaryFieldId("foo")); EXPECT_EQUAL(1u, s.getSummaryFieldId("bar")); @@ -159,7 +161,7 @@ TEST("testBasic") { { const auto &imported = s.getImportedAttributeFields(); EXPECT_EQUAL(1u, imported.size()); - TEST_DO(assertField(SIAF("imported", schema::INT32, schema::SINGLE), imported[0])); + TEST_DO(assertField(SIAF("imported", DataType::INT32, CollectionType::SINGLE), imported[0])); } } @@ -219,7 +221,7 @@ TEST("testLoadAndSave") { EXPECT_TRUE(s3.loadFromFile("schema.txt")); assertSchema(s, s3); // test that saved file is loaded correctly s3.addIndexField(SIF("foo", SDT::STRING)); - s3.addImportedAttributeField(SIAF("imported", schema::INT32)); + s3.addImportedAttributeField(SIAF("imported", DataType::INT32)); EXPECT_TRUE(s3.loadFromFile("schema.txt")); // load should clear the current content assertSchema(s, s3); } @@ -228,7 +230,7 @@ TEST("testLoadAndSave") { EXPECT_TRUE(s.saveToFile("schema2.txt")); Schema s2; s2.addIndexField(SIF("foo", SDT::STRING)); - s2.addImportedAttributeField(SIAF("imported", schema::INT32)); + s2.addImportedAttributeField(SIAF("imported", DataType::INT32)); EXPECT_TRUE(s2.loadFromFile("schema2.txt")); assertSchema(s, s2); } @@ -243,7 +245,7 @@ TEST("require that schema can save and load timestamps for fields") { const fastos::TimeStamp timestamp(42); const std::string file_name = "schema-with-timestamps.txt"; Schema s; - Schema::IndexField f("foo", schema::STRING); + Schema::IndexField f("foo", DataType::STRING); f.setTimestamp(timestamp); s.addIndexField(f); ASSERT_TRUE(s.saveToFile(file_name)); @@ -256,7 +258,7 @@ TEST("require that schema can save and load timestamps for fields") { TEST("require that timestamps are omitted when 0.") { const std::string file_name = "schema-without-timestamps.txt"; Schema s; - s.addIndexField(Schema::IndexField("foo", schema::STRING)); + s.addIndexField(Schema::IndexField("foo", DataType::STRING)); ASSERT_TRUE(s.saveToFile(file_name)); std::ifstream file(file_name.c_str()); @@ -274,15 +276,15 @@ TEST("require that timestamps are omitted when 0.") { void addAllFieldTypes(const string &name, Schema &schema, fastos::TimeStamp timestamp) { - Schema::IndexField index_field(name, schema::STRING); + Schema::IndexField index_field(name, DataType::STRING); index_field.setTimestamp(timestamp); schema.addIndexField(index_field); - Schema::AttributeField attribute_field(name, schema::STRING); + Schema::AttributeField attribute_field(name, DataType::STRING); attribute_field.setTimestamp(timestamp); schema.addAttributeField(attribute_field); - Schema::SummaryField summary_field(name, schema::STRING); + Schema::SummaryField summary_field(name, DataType::STRING); summary_field.setTimestamp(timestamp); schema.addSummaryField(summary_field); @@ -387,9 +389,9 @@ TEST("require that schema can calculate intersection") { TEST("require that incompatible fields are removed from intersection") { const string name = "foo"; Schema s1; - s1.addIndexField(Schema::IndexField(name, schema::STRING)); + s1.addIndexField(Schema::IndexField(name, DataType::STRING)); Schema s2; - s2.addIndexField(Schema::IndexField(name, schema::INT32)); + s2.addIndexField(Schema::IndexField(name, DataType::INT32)); Schema::UP schema = Schema::intersect(s1, s2); EXPECT_EQUAL(0u, schema->getNumIndexFields()); EXPECT_FALSE(schema->isIndexField(name)); @@ -400,7 +402,7 @@ TEST("require that imported attribute fields are not saved to disk") const vespalib::string fileName = "schema-no-imported-fields.txt"; { Schema s; - s.addImportedAttributeField(Schema::ImportedAttributeField("imported", schema::INT32)); + s.addImportedAttributeField(Schema::ImportedAttributeField("imported", DataType::INT32)); s.saveToFile(fileName); } { @@ -416,8 +418,8 @@ TEST("require that schema can be built from imported-fields config") SchemaConfigurer configurer(s, "dir:" + TEST_PATH("imported-fields-cfg")); const auto &imported = s.getImportedAttributeFields(); EXPECT_EQUAL(2u, imported.size()); - TEST_DO(assertField(SIAF("imported_a", schema::STRING, schema::SINGLE), imported[0])); - TEST_DO(assertField(SIAF("imported_b", schema::STRING, schema::SINGLE), imported[1])); + TEST_DO(assertField(SIAF("imported_a", DataType::INT32, CollectionType::SINGLE), imported[0])); + TEST_DO(assertField(SIAF("imported_b", DataType::STRING, CollectionType::ARRAY), imported[1])); } } // namespace index diff --git a/searchcommon/src/vespa/searchcommon/common/datatype.cpp b/searchcommon/src/vespa/searchcommon/common/datatype.cpp index b28fc06b3fd..6b620e17195 100644 --- a/searchcommon/src/vespa/searchcommon/common/datatype.cpp +++ b/searchcommon/src/vespa/searchcommon/common/datatype.cpp @@ -13,20 +13,20 @@ using config::InvalidConfigException; DataType dataTypeFromName(const vespalib::stringref &name) { - if (name == "UINT1") { return UINT1; } - else if (name == "UINT2") { return UINT2; } - else if (name == "UINT4") { return UINT4; } - else if (name == "INT8") { return INT8; } - else if (name == "INT16") { return INT16; } - else if (name == "INT32") { return INT32; } - else if (name == "INT64") { return INT64; } - else if (name == "FLOAT") { return FLOAT; } - else if (name == "DOUBLE") { return DOUBLE; } - else if (name == "STRING") { return STRING; } - else if (name == "RAW") { return RAW; } - else if (name == "BOOLEANTREE") { return BOOLEANTREE; } - else if (name == "TENSOR") { return TENSOR; } - else if (name == "REFERENCE") { return REFERENCE; } + if (name == "UINT1") { return DataType::UINT1; } + else if (name == "UINT2") { return DataType::UINT2; } + else if (name == "UINT4") { return DataType::UINT4; } + else if (name == "INT8") { return DataType::INT8; } + else if (name == "INT16") { return DataType::INT16; } + else if (name == "INT32") { return DataType::INT32; } + else if (name == "INT64") { return DataType::INT64; } + else if (name == "FLOAT") { return DataType::FLOAT; } + else if (name == "DOUBLE") { return DataType::DOUBLE; } + else if (name == "STRING") { return DataType::STRING; } + else if (name == "RAW") { return DataType::RAW; } + else if (name == "BOOLEANTREE") { return DataType::BOOLEANTREE; } + else if (name == "TENSOR") { return DataType::TENSOR; } + else if (name == "REFERENCE") { return DataType::REFERENCE; } else { throw InvalidConfigException("Illegal enum value '" + name + "'"); } @@ -50,19 +50,27 @@ const char *datatype_str[] = { "UINT1", vespalib::string getTypeName(DataType type) { - if (type > vespalib::arraysize(datatype_str)) { + size_t typeAsNum = static_cast<size_t>(type); + if (typeAsNum > vespalib::arraysize(datatype_str)) { vespalib::asciistream ost; - ost << "UNKNOWN(" << type << ")"; + ost << "UNKNOWN(" << typeAsNum << ")"; return ost.str(); } - return datatype_str[type]; + return datatype_str[typeAsNum]; +} + +std::ostream & +operator<<(std::ostream &os, const DataType &type) +{ + os << getTypeName(type); + return os; } CollectionType collectionTypeFromName(const vespalib::stringref &name) { - if (name == "SINGLE") { return SINGLE; } - else if (name == "ARRAY") { return ARRAY; } - else if (name == "WEIGHTEDSET") { return WEIGHTEDSET; } + if (name == "SINGLE") { return CollectionType::SINGLE; } + else if (name == "ARRAY") { return CollectionType::ARRAY; } + else if (name == "WEIGHTEDSET") { return CollectionType::WEIGHTEDSET; } else { throw InvalidConfigException("Illegal enum value '" + name + "'"); } @@ -74,14 +82,21 @@ const char *collectiontype_str[] = { "SINGLE", vespalib::string getTypeName(CollectionType type) { - if (type > vespalib::arraysize(collectiontype_str)) { + size_t typeAsNum = static_cast<size_t>(type); + if (typeAsNum > vespalib::arraysize(collectiontype_str)) { vespalib::asciistream ost; - ost << "UNKNOWN(" << type << ")"; + ost << "UNKNOWN(" << typeAsNum << ")"; return ost.str(); } - return collectiontype_str[type]; + return collectiontype_str[typeAsNum]; } +std::ostream & +operator<<(std::ostream &os, const CollectionType &type) +{ + os << getTypeName(type); + return os; +} } } diff --git a/searchcommon/src/vespa/searchcommon/common/datatype.h b/searchcommon/src/vespa/searchcommon/common/datatype.h index f73274d58c0..1570bfdb688 100644 --- a/searchcommon/src/vespa/searchcommon/common/datatype.h +++ b/searchcommon/src/vespa/searchcommon/common/datatype.h @@ -11,7 +11,7 @@ namespace schema { /** * Basic data type for a field. **/ -enum DataType { UINT1 = 0, +enum class DataType { UINT1 = 0, UINT2 = 1, UINT4 = 2, INT8 = 3, @@ -31,15 +31,19 @@ enum DataType { UINT1 = 0, /** * Collection type for a field. **/ -enum CollectionType { SINGLE = 0, +enum class CollectionType { SINGLE = 0, ARRAY = 1, WEIGHTEDSET = 2 }; DataType dataTypeFromName(const vespalib::stringref &name); vespalib::string getTypeName(DataType type); +std::ostream &operator<<(std::ostream &os, const DataType &type); + CollectionType collectionTypeFromName(const vespalib::stringref &n); vespalib::string getTypeName(CollectionType type); +std::ostream &operator<<(std::ostream &os, const CollectionType &type); + } } diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp index f2e64cd943e..720b4572fa8 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.cpp +++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp @@ -72,7 +72,7 @@ const uint32_t Schema::UNKNOWN_FIELD_ID(std::numeric_limits<uint32_t>::max()); Schema::Field::Field(const vespalib::stringref &n, DataType dt) : _name(n), _dataType(dt), - _collectionType(schema::SINGLE), + _collectionType(schema::CollectionType::SINGLE), _timestamp(0) { } diff --git a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp index 195483855cd..61571efa9e6 100644 --- a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp +++ b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.cpp @@ -12,120 +12,125 @@ using namespace vespa::config::search; namespace search { namespace index { +using schema::DataType; +using schema::CollectionType; + +namespace { Schema::DataType -SchemaBuilder::convert(const IndexschemaConfig::Indexfield::Datatype &type) +convertIndexDataType(const IndexschemaConfig::Indexfield::Datatype &type) { switch (type) { case IndexschemaConfig::Indexfield::STRING: - return schema::STRING; + return DataType::STRING; case IndexschemaConfig::Indexfield::INT64: - return schema::INT64; + return DataType::INT64; case IndexschemaConfig::Indexfield::BOOLEANTREE: - return schema::BOOLEANTREE; + return DataType::BOOLEANTREE; } - return schema::STRING; + return DataType::STRING; } Schema::CollectionType -SchemaBuilder::convert(const IndexschemaConfig::Indexfield::Collectiontype & type) +convertIndexCollectionType(const IndexschemaConfig::Indexfield::Collectiontype &type) { switch (type) { case IndexschemaConfig::Indexfield::SINGLE: - return schema::SINGLE; + return CollectionType::SINGLE; case IndexschemaConfig::Indexfield::ARRAY: - return schema::ARRAY; + return CollectionType::ARRAY; case IndexschemaConfig::Indexfield::WEIGHTEDSET: - return schema::WEIGHTEDSET; + return CollectionType::WEIGHTEDSET; } - return schema::SINGLE; + return CollectionType::SINGLE; } - +template <typename ConfigType> Schema::DataType -SchemaBuilder::convert(const AttributesConfig::Attribute::Datatype &type) +convertDataType(const ConfigType &type) { switch (type) { - case AttributesConfig::Attribute::STRING: - return schema::STRING; - case AttributesConfig::Attribute::UINT1: - return schema::UINT1; - case AttributesConfig::Attribute::UINT2: - return schema::UINT2; - case AttributesConfig::Attribute::UINT4: - return schema::UINT4; - case AttributesConfig::Attribute::INT8: - return schema::INT8; - case AttributesConfig::Attribute::INT16: - return schema::INT16; - case AttributesConfig::Attribute::INT32: - return schema::INT32; - case AttributesConfig::Attribute::INT64: - return schema::INT64; - case AttributesConfig::Attribute::FLOAT: - return schema::FLOAT; - case AttributesConfig::Attribute::DOUBLE: - return schema::DOUBLE; - case AttributesConfig::Attribute::PREDICATE: - return schema::BOOLEANTREE; - case AttributesConfig::Attribute::TENSOR: - return schema::TENSOR; - case AttributesConfig::Attribute::REFERENCE: - return schema::REFERENCE; + case ConfigType::STRING: + return DataType::STRING; + case ConfigType::UINT1: + return DataType::UINT1; + case ConfigType::UINT2: + return DataType::UINT2; + case ConfigType::UINT4: + return DataType::UINT4; + case ConfigType::INT8: + return DataType::INT8; + case ConfigType::INT16: + return DataType::INT16; + case ConfigType::INT32: + return DataType::INT32; + case ConfigType::INT64: + return DataType::INT64; + case ConfigType::FLOAT: + return DataType::FLOAT; + case ConfigType::DOUBLE: + return DataType::DOUBLE; + case ConfigType::PREDICATE: + return DataType::BOOLEANTREE; + case ConfigType::TENSOR: + return DataType::TENSOR; + case ConfigType::REFERENCE: + return DataType::REFERENCE; default: break; } // TODO: exception? - return schema::STRING; + return DataType::STRING; } - +template <typename ConfigType> Schema::CollectionType -SchemaBuilder::convert(const AttributesConfig::Attribute::Collectiontype &type) +convertCollectionType(const ConfigType &type) { switch (type) { - case AttributesConfig::Attribute::SINGLE: - return schema::SINGLE; - case AttributesConfig::Attribute::ARRAY: - return schema::ARRAY; - case AttributesConfig::Attribute::WEIGHTEDSET: - return schema::WEIGHTEDSET; + case ConfigType::SINGLE: + return CollectionType::SINGLE; + case ConfigType::ARRAY: + return CollectionType::ARRAY; + case ConfigType::WEIGHTEDSET: + return CollectionType::WEIGHTEDSET; } - return schema::SINGLE; + return CollectionType::SINGLE; } Schema::DataType -SchemaBuilder::convertSummaryType(const vespalib::string & type) +convertSummaryType(const vespalib::string &type) { if (type == "byte") { - return schema::INT8; + return DataType::INT8; } else if (type == "short") { - return schema::INT16; + return DataType::INT16; } else if (type == "integer") { - return schema::INT32; + return DataType::INT32; } else if (type == "int64") { - return schema::INT64; + return DataType::INT64; } else if (type == "float") { - return schema::FLOAT; + return DataType::FLOAT; } else if (type == "double") { - return schema::DOUBLE; + return DataType::DOUBLE; } else if (type == "string" || type == "longstring" || type == "xmlstring" || type == "featuredata" || type == "jsonstring") { - return schema::STRING; + return DataType::STRING; } else if (type == "data" || type == "longdata") { - return schema::RAW; + return DataType::RAW; } - return schema::RAW; + return DataType::RAW; } +} void SchemaBuilder::build(const IndexschemaConfig &cfg, Schema &schema) @@ -139,8 +144,8 @@ SchemaBuilder::build(const IndexschemaConfig &cfg, Schema &schema) LOG(warning, "Your field '%s' is a rise index. Those are no longer supported as of Vespa-5.89.\n" " Redeploy and follow instructions to mitigate.", f.name.c_str()); } else { - schema.addIndexField(Schema::IndexField(f.name, convert(f.datatype), - convert(f.collectiontype)). + schema.addIndexField(Schema::IndexField(f.name, convertIndexDataType(f.datatype), + convertIndexCollectionType(f.collectiontype)). setPrefix(f.prefix). setPhrases(f.phrases). setPositions(f.positions). @@ -164,8 +169,8 @@ SchemaBuilder::build(const AttributesConfig &cfg, Schema &schema) for (size_t i = 0; i < cfg.attribute.size(); ++i) { const AttributesConfig::Attribute & a = cfg.attribute[i]; schema.addAttributeField(Schema::Field(a.name, - convert(a.datatype), - convert(a.collectiontype))); + convertDataType(a.datatype), + convertCollectionType(a.collectiontype))); } } @@ -204,9 +209,9 @@ void SchemaBuilder::build(const ImportedFieldsConfig &cfg, Schema &schema) { for (const auto &attr : cfg.attribute) { - // TODO: Use correct datatype and collection type when available in config. schema.addImportedAttributeField(Schema::ImportedAttributeField(attr.name, - schema::DataType::STRING)); + convertDataType(attr.datatype), + convertCollectionType(attr.collectiontype))); } } diff --git a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.h b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.h index 4a2f8e5149e..962dc50c5ad 100644 --- a/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.h +++ b/searchcommon/src/vespa/searchcommon/common/schemaconfigurer.h @@ -19,20 +19,6 @@ namespace index { **/ class SchemaBuilder { - static Schema::DataType - convert(const vespa::config::search::IndexschemaConfig::Indexfield::Datatype &type); - - static Schema::CollectionType - convert(const vespa::config::search::IndexschemaConfig::Indexfield::Collectiontype &type); - - static Schema::DataType - convert(const vespa::config::search::AttributesConfig::Attribute::Datatype &type); - - static Schema::CollectionType - convert(const vespa::config::search::AttributesConfig::Attribute::Collectiontype &type); - - static Schema::DataType - convertSummaryType(const vespalib::string &type); public: /** * Build from indexschema config. diff --git a/searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h b/searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h index d2b5570770f..0c5960fb362 100644 --- a/searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h +++ b/searchcommon/src/vespa/searchcommon/config/subscriptionproxyng.h @@ -54,7 +54,7 @@ public: _subscriber = NULL; _cfgId = ""; } - virtual void configure(std::unique_ptr<CFG> cfg) { + virtual void configure(std::unique_ptr<CFG> cfg) override { (_target.*_method)(*cfg); } }; diff --git a/searchcore/src/apps/fdispatch/fdispatch.cpp b/searchcore/src/apps/fdispatch/fdispatch.cpp index efca70b2b6a..799c42887da 100644 --- a/searchcore/src/apps/fdispatch/fdispatch.cpp +++ b/searchcore/src/apps/fdispatch/fdispatch.cpp @@ -38,7 +38,7 @@ protected: bool GetOptions(int *exitCode); public: - int Main(); + int Main() override; FastS_FDispatchApp(void); ~FastS_FDispatchApp(void); }; diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp index cf22158071f..b24a94f0bea 100644 --- a/searchcore/src/apps/proton/proton.cpp +++ b/searchcore/src/apps/proton/proton.cpp @@ -14,6 +14,7 @@ LOG_SETUP("proton"); typedef vespalib::SignalHandler SIG; +using vespa::config::search::core::ProtonConfig; struct Params { @@ -31,7 +32,7 @@ private: void setupSignals(); Params parseParams(); public: - int Main(); + int Main() override; }; void @@ -101,9 +102,9 @@ public: PersistenceProvider *downPersistence); ~ProtonServiceLayerProcess() { shutdown(); } - virtual void shutdown(); - virtual void setupProvider(); - virtual storage::spi::PersistenceProvider& getProvider(); + virtual void shutdown() override; + virtual void setupProvider() override; + virtual storage::spi::PersistenceProvider& getProvider() override; void setMetricManager(metrics::MetricManager& mm) { // The service layer will call init(...) and stop() on the metric diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index 1aa85baccb7..f7d40d766a8 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -5,14 +5,19 @@ LOG_SETUP("persistenceconformance_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/config-imported-fields.h> +#include <vespa/config-rank-profiles.h> +#include <vespa/config-summarymap.h> +#include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/document/base/testdocman.h> #include <vespa/persistence/conformancetest/conformancetest.h> #include <vespa/searchcommon/common/schemaconfigurer.h> +#include <vespa/searchcore/proton/matching/querylimiter.h> #include <vespa/searchcore/proton/persistenceengine/ipersistenceengineowner.h> #include <vespa/searchcore/proton/persistenceengine/persistenceengine.h> #include <vespa/searchcore/proton/server/document_db_maintenance_config.h> #include <vespa/searchcore/proton/server/documentdb.h> #include <vespa/searchcore/proton/server/documentdbconfigmanager.h> +#include <vespa/searchcore/proton/server/fileconfigmanager.h> #include <vespa/searchcore/proton/server/memoryconfigstore.h> #include <vespa/searchcore/proton/server/bootstrapconfig.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> @@ -274,7 +279,7 @@ protected: class MyPersistenceEngineOwner : public IPersistenceEngineOwner { virtual void - setClusterState(const storage::spi::ClusterState &calc) + setClusterState(const storage::spi::ClusterState &calc) override { (void) calc; } @@ -362,7 +367,7 @@ public: { } virtual PersistenceProvider::UP getPersistenceImplementation(const DocumentTypeRepo::SP &repo, - const DocumenttypesConfig &typesCfg) { + const DocumenttypesConfig &typesCfg) override { ConfigFactory cfgFactory(repo, DocumenttypesConfigSP(new DocumenttypesConfig(typesCfg)), _schemaFactory); _docDbRepo.reset(new DocumentDBRepo(cfgFactory, _docDbFactory)); PersistenceEngine::UP engine(new MyPersistenceEngine(_engineOwner, @@ -373,12 +378,12 @@ public: return PersistenceProvider::UP(engine.release()); } - virtual void clear() { + virtual void clear() override { FastOS_FileInterface::EmptyAndRemoveDirectory(_baseDir.c_str()); } - virtual bool hasPersistence() const { return true; } - virtual bool supportsActiveState() const { return true; } + virtual bool hasPersistence() const override { return true; } + virtual bool supportsActiveState() const override { return true; } }; diff --git a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp index e1f2716ac16..87c85f99752 100644 --- a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp +++ b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp @@ -56,13 +56,13 @@ public: const ImportedFieldsConfig &importedFieldsCfg); int usage(); - int Main(); + int Main() override; }; struct DummyConstantValueRepo : IConstantValueRepo { const RankingConstantsConfig &cfg; DummyConstantValueRepo(const RankingConstantsConfig &cfg_in) : cfg(cfg_in) {} - virtual vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const { + virtual vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const override { for (const auto &entry: cfg.constant) { if (entry.name == name) { const auto &engine = DefaultTensorEngine::ref(); diff --git a/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp b/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp index bb26c0d88ec..423a3f509c0 100644 --- a/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp +++ b/searchcore/src/apps/vespa-dump-feed/vespa-dump-feed.cpp @@ -56,7 +56,7 @@ private: size_t _numDocs; void handleDocumentPut(document::Document::SP doc); - virtual void handleMessage(mbus::Message::UP message); + virtual void handleMessage(mbus::Message::UP message) override; public: FeedHandler(document::DocumentTypeRepo::SP repo, OutputFile &idx, OutputFile &dat); @@ -121,8 +121,8 @@ FeedHandler::~FeedHandler() class App : public FastOS_Application { public: - virtual bool useProcessStarter() const { return true; } - virtual int Main(); + virtual bool useProcessStarter() const override { return true; } + virtual int Main() override; }; template <typename CFG> diff --git a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp index f57e464fae6..7b7527da6ef 100644 --- a/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp +++ b/searchcore/src/apps/vespa-gen-testdocs/vespa-gen-testdocs.cpp @@ -232,21 +232,19 @@ public: ~RandTextFieldGenerator(void); virtual void - setup(void); + setup(void) override; virtual void - clear(void); + clear(void) override; virtual void - deleteHistogram(const string &baseDir, - const string &name); + deleteHistogram(const string &baseDir, const string &name) override; virtual void - writeHistogram(const string &baseDir, - const string &name); + writeHistogram(const string &baseDir, const string &name) override; virtual void - generate(vespalib::asciistream &doc, uint32_t id); + generate(vespalib::asciistream &doc, uint32_t id) override; }; @@ -368,13 +366,13 @@ public: ~ModTextFieldGenerator(void); virtual void - clear(void); + clear(void) override; virtual void writeHistogram(const string &name); virtual void - generate(vespalib::asciistream &doc, uint32_t id); + generate(vespalib::asciistream &doc, uint32_t id) override; }; @@ -432,13 +430,13 @@ public: ~IdTextFieldGenerator(void); virtual void - clear(void); + clear(void) override; virtual void writeHistogram(const string &name); virtual void - generate(vespalib::asciistream &doc, uint32_t id); + generate(vespalib::asciistream &doc, uint32_t id) override; }; @@ -491,13 +489,13 @@ public: ~RandIntFieldGenerator(void); virtual void - clear(void); + clear(void) override; virtual void writeHistogram(const string &name); virtual void - generate(vespalib::asciistream &doc, uint32_t id); + generate(vespalib::asciistream &doc, uint32_t id) override; }; @@ -755,13 +753,13 @@ public: } virtual void - usage(bool showHeader); + usage(bool showHeader) override; virtual bool - getOptions(void); + getOptions(void) override; virtual int - run(void); + run(void) override; }; @@ -923,7 +921,7 @@ public: usage(void); int - Main(void); + Main(void) override; }; diff --git a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp index 8c57758f67a..626bbb3b3f4 100644 --- a/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp +++ b/searchcore/src/apps/vespa-proton-cmd/vespa-proton-cmd.cpp @@ -214,7 +214,7 @@ public: } - int Main() + int Main() override { if (_argc < 3) { return usage(); diff --git a/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp b/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp index 6a984c7c9a1..73e1fcd09a5 100644 --- a/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp +++ b/searchcore/src/apps/vespa-transactionlog-inspect/vespa-transactionlog-inspect.cpp @@ -31,7 +31,7 @@ typedef std::unique_ptr<IReplayPacketHandler> IReplayPacketHandlerUP; struct DummyFileHeaderContext : public FileHeaderContext { typedef std::unique_ptr<DummyFileHeaderContext> UP; - virtual void addTags(vespalib::GenericHeader &, const vespalib::string &) const {} + virtual void addTags(vespalib::GenericHeader &, const vespalib::string &) const override {} }; @@ -115,12 +115,12 @@ struct DummyStreamHandler : public NewConfigOperation::IStreamHandler { } virtual void - serializeConfig(SerialNum, vespalib::nbostream &) + serializeConfig(SerialNum, vespalib::nbostream &) override { } virtual void - deserializeConfig(SerialNum, vespalib::nbostream &is) + deserializeConfig(SerialNum, vespalib::nbostream &is) override { _cfs.clear(); uint32_t numConfigs; @@ -173,11 +173,11 @@ public: _counter(0) { } - virtual void replay(const PutOperation &op) { print(op); } - virtual void replay(const RemoveOperation &op) { print(op); } - virtual void replay(const UpdateOperation &op) { print(op); } - virtual void replay(const NoopOperation &op) { print(op); } - virtual void replay(const NewConfigOperation &op) + virtual void replay(const PutOperation &op) override { print(op); } + virtual void replay(const RemoveOperation &op) override { print(op); } + virtual void replay(const UpdateOperation &op) override { print(op); } + virtual void replay(const NoopOperation &op) override { print(op); } + virtual void replay(const NewConfigOperation &op) override { print(op); typedef std::map<std::string, ConfigFile>::const_iterator I; @@ -187,20 +187,20 @@ public: } } - virtual void replay(const WipeHistoryOperation &op) { print(op); } - virtual void replay(const DeleteBucketOperation &op) { print(op); } - virtual void replay(const SplitBucketOperation &op) { print(op); } - virtual void replay(const JoinBucketsOperation &op) { print(op); } - virtual void replay(const PruneRemovedDocumentsOperation &op) { print(op); } - virtual void replay(const SpoolerReplayStartOperation &op) { print(op); } - virtual void replay(const SpoolerReplayCompleteOperation &op) { print(op); } - virtual void replay(const MoveOperation &op) { print(op); } - virtual void replay(const CreateBucketOperation &op) { print(op); } - virtual void replay(const CompactLidSpaceOperation &op) { print(op); } - virtual NewConfigOperation::IStreamHandler &getNewConfigStreamHandler() { + virtual void replay(const WipeHistoryOperation &op) override { print(op); } + virtual void replay(const DeleteBucketOperation &op) override { print(op); } + virtual void replay(const SplitBucketOperation &op) override { print(op); } + virtual void replay(const JoinBucketsOperation &op) override { print(op); } + virtual void replay(const PruneRemovedDocumentsOperation &op) override { print(op); } + virtual void replay(const SpoolerReplayStartOperation &op) override { print(op); } + virtual void replay(const SpoolerReplayCompleteOperation &op) override { print(op); } + virtual void replay(const MoveOperation &op) override { print(op); } + virtual void replay(const CreateBucketOperation &op) override { print(op); } + virtual void replay(const CompactLidSpaceOperation &op) override { print(op); } + virtual NewConfigOperation::IStreamHandler &getNewConfigStreamHandler() override { return _streamHandler; } - virtual document::DocumentTypeRepo &getDeserializeRepo() { + virtual document::DocumentTypeRepo &getDeserializeRepo() override { return _repo; } }; @@ -245,7 +245,7 @@ public: _verbose(verbose) { } - virtual void replay(const PutOperation &op) { + virtual void replay(const PutOperation &op) override { print(op); if (op.getDocument().get() != NULL) { if (_printXml) { @@ -255,10 +255,10 @@ public: } } } - virtual void replay(const RemoveOperation &op) { + virtual void replay(const RemoveOperation &op) override { print(op); } - virtual void replay(const UpdateOperation &op) { + virtual void replay(const UpdateOperation &op) override { print(op); if (op.getUpdate().get() != NULL) { if (_printXml) { @@ -268,17 +268,17 @@ public: } } } - virtual void replay(const NoopOperation &) { } - virtual void replay(const NewConfigOperation &) { } - virtual void replay(const WipeHistoryOperation &) { } - virtual void replay(const DeleteBucketOperation &) { } - virtual void replay(const SplitBucketOperation &) { } - virtual void replay(const JoinBucketsOperation &) { } - virtual void replay(const PruneRemovedDocumentsOperation &) { } - virtual void replay(const SpoolerReplayStartOperation &) { } - virtual void replay(const SpoolerReplayCompleteOperation &) { } - virtual void replay(const MoveOperation &) { } - virtual void replay(const CreateBucketOperation &) { } + virtual void replay(const NoopOperation &) override { } + virtual void replay(const NewConfigOperation &) override { } + virtual void replay(const WipeHistoryOperation &) override { } + virtual void replay(const DeleteBucketOperation &) override { } + virtual void replay(const SplitBucketOperation &) override { } + virtual void replay(const JoinBucketsOperation &) override { } + virtual void replay(const PruneRemovedDocumentsOperation &) override { } + virtual void replay(const SpoolerReplayStartOperation &) override { } + virtual void replay(const SpoolerReplayCompleteOperation &) override { } + virtual void replay(const MoveOperation &) override { } + virtual void replay(const CreateBucketOperation &) override { } }; @@ -299,7 +299,7 @@ public: _eof(false) { } - virtual RPC::Result receive(const Packet &packet) { + virtual RPC::Result receive(const Packet &packet) override { vespalib::nbostream_longlivedbuf handle(packet.getHandle().c_str(), packet.getHandle().size()); try { while (handle.size() > 0) { @@ -314,8 +314,8 @@ public: } return RPC::OK; } - virtual void inSync() { } - virtual void eof() { _eof = true; } + virtual void inSync() override { } + virtual void eof() override { _eof = true; } bool isEof() const { return _eof; } }; @@ -383,7 +383,7 @@ public: _client(vespalib::make_string("tcp/localhost:%d", _bopts.listenPort)) { } - virtual int run() = 0; + virtual int run() override = 0; }; @@ -398,7 +398,7 @@ struct ListDomainsOptions : public BaseOptions _opts.setSyntaxMessage("Utility to list all domains in a tls"); } static std::string command() { return "listdomains"; } - virtual Utility::UP createUtility() const; + virtual Utility::UP createUtility() const override; }; /** @@ -411,7 +411,7 @@ public: : BaseUtility(opts) { } - virtual int run() { + virtual int run() override { std::cout << ListDomainsOptions::command() << ": " << _bopts.toString() << std::endl; std::vector<vespalib::string> domains; @@ -449,13 +449,13 @@ struct DumpOperationsOptions : public BaseOptions DumpOperationsOptions(int argc, const char* const* argv); ~DumpOperationsOptions(); static std::string command() { return "dumpoperations"; } - virtual std::string toString() const { + virtual std::string toString() const override { return vespalib::make_string("%s, domain=%s, first=%" PRIu64 ", last=%" PRIu64 ", configdir=%s", BaseOptions::toString().c_str(), domainName.c_str(), firstSerialNum, lastSerialNum, configDir.c_str()); } - virtual Utility::UP createUtility() const; + virtual Utility::UP createUtility() const override; }; DumpOperationsOptions::DumpOperationsOptions(int argc, const char* const* argv) @@ -505,7 +505,7 @@ public: _oopts(oopts) { } - virtual int run() { + virtual int run() override { std::cout << DumpOperationsOptions::command() << ": " << _oopts.toString() << std::endl; return doRun(); } @@ -528,18 +528,18 @@ struct DumpDocumentsOptions : public DumpOperationsOptions DumpDocumentsOptions(int argc, const char* const* argv); ~DumpDocumentsOptions(); static std::string command() { return "dumpdocuments"; } - virtual void parse() { + virtual void parse() override { DumpOperationsOptions::parse(); if (format != "xml" && format != "text") { throw vespalib::InvalidCommandLineArgumentsException("Expected 'format' to be 'xml' or 'text'"); } } - virtual std::string toString() const { + virtual std::string toString() const override { return vespalib::make_string("%s, format=%s, verbose=%s", DumpOperationsOptions::toString().c_str(), format.c_str(), (verbose ? "true" : "false")); } - virtual Utility::UP createUtility() const; + virtual Utility::UP createUtility() const override; }; DumpDocumentsOptions::DumpDocumentsOptions(int argc, const char* const* argv) @@ -559,7 +559,7 @@ class DumpDocumentsUtility : public DumpOperationsUtility { protected: const DumpDocumentsOptions &_dopts; - virtual IReplayPacketHandlerUP createHandler(DocumentTypeRepo &repo) { + virtual IReplayPacketHandlerUP createHandler(DocumentTypeRepo &repo) override { return IReplayPacketHandlerUP(new DocumentPrinter(repo, _dopts.format == "xml", _dopts.verbose)); } @@ -569,7 +569,7 @@ public: _dopts(dopts) { } - virtual int run() { + virtual int run() override { std::cout << DumpDocumentsOptions::command() << ": " << _oopts.toString() << std::endl; return doRun(); } @@ -615,7 +615,7 @@ private: public: App(); ~App(); - int Main(); + int Main() override; }; App::App() {} diff --git a/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp b/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp index 234edd7d45a..dd539233489 100644 --- a/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp +++ b/searchcore/src/tests/applyattrupdates/applyattrupdates.cpp @@ -139,7 +139,7 @@ private: public: Test(); - int Main(); + int Main() override; }; namespace { diff --git a/searchcore/src/tests/grouping/grouping.cpp b/searchcore/src/tests/grouping/grouping.cpp index 12abe0eb3b5..638eb40c3dc 100644 --- a/searchcore/src/tests/grouping/grouping.cpp +++ b/searchcore/src/tests/grouping/grouping.cpp @@ -41,15 +41,15 @@ public: return _vectors.find(name)->second; } virtual const IAttributeVector * - getAttribute(const string &name) const { + getAttribute(const string &name) const override { return get(name); } virtual const IAttributeVector * - getAttributeStableEnum(const string &name) const { + getAttributeStableEnum(const string &name) const override { return get(name); } virtual void - getAttributeList(std::vector<const IAttributeVector *> & list) const { + getAttributeList(std::vector<const IAttributeVector *> & list) const override { Map::const_iterator pos = _vectors.begin(); Map::const_iterator end = _vectors.end(); for (; pos != end; ++pos) { diff --git a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp index e4647a58735..49869d99978 100644 --- a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp @@ -77,7 +77,7 @@ struct Fixture AttributeFactory _factory; Fixture(); ~Fixture(); - std::unique_ptr<AttributeInitializer> createInitializer(const vespalib::string &name, const Config &cfg, SerialNum serialNum); + std::unique_ptr<AttributeInitializer> createInitializer(const AttributeSpec &spec, SerialNum serialNum); }; Fixture::Fixture() @@ -90,16 +90,16 @@ Fixture::Fixture() Fixture::~Fixture() {} std::unique_ptr<AttributeInitializer> -Fixture::createInitializer(const vespalib::string &name, const Config &cfg, SerialNum serialNum) +Fixture::createInitializer(const AttributeSpec &spec, SerialNum serialNum) { - return std::make_unique<AttributeInitializer>(_diskLayout->createAttributeDir(name), "test.subdb", cfg, serialNum, _factory); + return std::make_unique<AttributeInitializer>(_diskLayout->createAttributeDir(spec.getName()), "test.subdb", spec, serialNum, _factory); } TEST("require that integer attribute can be initialized") { saveAttr("a", int32_sv, 10, 2); Fixture f; - auto av = f.createInitializer("a", int32_sv, 5)->init(); + auto av = f.createInitializer({"a", int32_sv}, 5)->init().getAttribute(); EXPECT_EQUAL(2, av->getCreateSerialNum()); EXPECT_EQUAL(2, av->getNumDocs()); } @@ -108,7 +108,7 @@ TEST("require that mismatching base type is not loaded") { saveAttr("a", int32_sv, 10, 2); Fixture f; - auto av = f.createInitializer("a", int16_sv, 5)->init(); + auto av = f.createInitializer({"a", int16_sv}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av->getCreateSerialNum()); EXPECT_EQUAL(1, av->getNumDocs()); } @@ -117,7 +117,7 @@ TEST("require that mismatching collection type is not loaded") { saveAttr("a", int32_sv, 10, 2); Fixture f; - auto av = f.createInitializer("a", int32_array, 5)->init(); + auto av = f.createInitializer({"a", int32_array}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av->getCreateSerialNum()); EXPECT_EQUAL(1, av->getNumDocs()); } @@ -127,10 +127,10 @@ TEST("require that mismatching weighted set collection type params is not loaded saveAttr("a", string_wset, 10, 2); saveAttr("b", string_wset2, 10, 2); Fixture f; - auto av = f.createInitializer("a", string_wset2, 5)->init(); + auto av = f.createInitializer({"a", string_wset2}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av->getCreateSerialNum()); EXPECT_EQUAL(1, av->getNumDocs()); - auto av2 = f.createInitializer("b", string_wset, 5)->init(); + auto av2 = f.createInitializer({"b", string_wset}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av2->getCreateSerialNum()); EXPECT_EQUAL(1, av2->getNumDocs()); } @@ -139,7 +139,7 @@ TEST("require that predicate attributes can be initialized") { saveAttr("a", predicate, 10, 2); Fixture f; - auto av = f.createInitializer("a", predicate, 5)->init(); + auto av = f.createInitializer({"a", predicate}, 5)->init().getAttribute(); EXPECT_EQUAL(2, av->getCreateSerialNum()); EXPECT_EQUAL(2, av->getNumDocs()); } @@ -148,7 +148,7 @@ TEST("require that predicate attributes will not be initialized with future-crea { saveAttr("a", predicate, 10, 8); Fixture f; - auto av = f.createInitializer("a", predicate, 5)->init(); + auto av = f.createInitializer({"a", predicate}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av->getCreateSerialNum()); EXPECT_EQUAL(1, av->getNumDocs()); } @@ -157,7 +157,7 @@ TEST("require that predicate attributes will not be initialized with mismatching { saveAttr("a", predicate, 10, 2); Fixture f; - auto av = f.createInitializer("a", getPredicateWithArity(4), 5)->init(); + auto av = f.createInitializer({"a", getPredicateWithArity(4)}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av->getCreateSerialNum()); EXPECT_EQUAL(1, av->getNumDocs()); } @@ -166,7 +166,7 @@ TEST("require that tensor attribute can be initialized") { saveAttr("a", getTensor("tensor(x[10])"), 10, 2); Fixture f; - auto av = f.createInitializer("a", getTensor("tensor(x[10])"), 5)->init(); + auto av = f.createInitializer({"a", getTensor("tensor(x[10])")}, 5)->init().getAttribute(); EXPECT_EQUAL(2, av->getCreateSerialNum()); EXPECT_EQUAL(2, av->getNumDocs()); } @@ -175,7 +175,7 @@ TEST("require that tensor attributes will not be initialized with future-created { saveAttr("a", getTensor("tensor(x[10])"), 10, 8); Fixture f; - auto av = f.createInitializer("a", getTensor("tensor(x[10])"), 5)->init(); + auto av = f.createInitializer({"a", getTensor("tensor(x[10])")}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av->getCreateSerialNum()); EXPECT_EQUAL(1, av->getNumDocs()); } @@ -184,7 +184,7 @@ TEST("require that tensor attributes will not be initialized with mismatching ty { saveAttr("a", getTensor("tensor(x[10])"), 10, 2); Fixture f; - auto av = f.createInitializer("a", getTensor("tensor(x[11])"), 5)->init(); + auto av = f.createInitializer({"a", getTensor("tensor(x[11])")}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av->getCreateSerialNum()); EXPECT_EQUAL(1, av->getNumDocs()); } @@ -193,7 +193,7 @@ TEST("require that too old attribute is not loaded") { saveAttr("a", int32_sv, 3, 2); Fixture f; - auto av = f.createInitializer("a", int32_sv, 5)->init(); + auto av = f.createInitializer({"a", int32_sv}, 5)->init().getAttribute(); EXPECT_EQUAL(5, av->getCreateSerialNum()); EXPECT_EQUAL(1, av->getNumDocs()); } diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp index 4d0a96aa638..4e33a433655 100644 --- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp @@ -28,6 +28,7 @@ LOG_SETUP("attribute_manager_test"); #include <vespa/searchlib/attribute/reference_attribute.h> #include <vespa/searchlib/attribute/singlenumericattribute.hpp> #include <vespa/searchlib/common/foregroundtaskexecutor.h> +#include <vespa/searchlib/common/indexmetainfo.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/predicate/predicate_index.h> #include <vespa/searchlib/predicate/predicate_tree_annotator.h> @@ -166,7 +167,7 @@ struct AttributeManagerFixture AttributeManagerFixture(BaseFixture &bf); ~AttributeManagerFixture(); AttributeVector::SP addAttribute(const vespalib::string &name) { - return _m.addAttribute(name, INT32_SINGLE, createSerialNum); + return _m.addAttribute({name, INT32_SINGLE}, createSerialNum); } void addImportedAttribute(const vespalib::string &name) { _builder.add(name); @@ -262,7 +263,7 @@ TEST_F("require that attributes are added", Fixture) TEST_F("require that predicate attributes are added", Fixture) { - EXPECT_TRUE(f._m.addAttribute("p1", AttributeUtils::getPredicateConfig(), + EXPECT_TRUE(f._m.addAttribute({"p1", AttributeUtils::getPredicateConfig()}, createSerialNum).get() != NULL); EXPECT_EQUAL("p1", (*f._m.getAttribute("p1"))->getName()); EXPECT_EQUAL("p1", (*f._m.getAttributeStableEnum("p1"))->getName()); @@ -352,10 +353,7 @@ TEST_F("require that predicate attributes are flushed and loaded", BaseFixture) { AttributeManagerFixture amf(f); proton::AttributeManager &am = amf._m; - AttributeVector::SP a1 = - am.addAttribute("a1", - AttributeUtils::getPredicateConfig(), - createSerialNum); + AttributeVector::SP a1 = am.addAttribute({"a1", AttributeUtils::getPredicateConfig()}, createSerialNum); EXPECT_EQUAL(1u, a1->getNumDocs()); PredicateAttribute &pa = static_cast<PredicateAttribute &>(*a1); @@ -375,9 +373,7 @@ TEST_F("require that predicate attributes are flushed and loaded", BaseFixture) { AttributeManagerFixture amf(f); proton::AttributeManager &am = amf._m; - AttributeVector::SP a1 = - am.addAttribute("a1", AttributeUtils::getPredicateConfig(), - createSerialNum); // loaded + AttributeVector::SP a1 = am.addAttribute({"a1", AttributeUtils::getPredicateConfig()}, createSerialNum); // loaded EXPECT_EQUAL(2u, a1->getNumDocs()); PredicateAttribute &pa = static_cast<PredicateAttribute &>(*a1); @@ -488,9 +484,7 @@ TEST_F("require that removed attributes cannot resurrect", BaseFixture) f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo)); { - AttributeVector::SP a1 = - am1->addAttribute("a1", INT32_SINGLE, - 0); + AttributeVector::SP a1 = am1->addAttribute({"a1", INT32_SINGLE}, 0); fillAttribute(a1, 2, 10, 15); EXPECT_EQUAL(3u, a1->getNumDocs()); } @@ -762,12 +756,12 @@ TEST_F("require that attribute vector of wrong type is dropped", BaseFixture) auto am1(std::make_shared<proton::AttributeManager> (test_dir, "test.subdb", TuneFileAttributes(), f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo)); - am1->addAttribute("a1", INT32_SINGLE, 1); - am1->addAttribute("a2", INT32_SINGLE, 2); - am1->addAttribute("a3", generic_tensor, 3); - am1->addAttribute("a4", generic_tensor, 4); - am1->addAttribute("a5", predicate, 5); - am1->addAttribute("a6", predicate, 6); + am1->addAttribute({"a1", INT32_SINGLE}, 1); + am1->addAttribute({"a2", INT32_SINGLE}, 2); + am1->addAttribute({"a3", generic_tensor}, 3); + am1->addAttribute({"a4", generic_tensor}, 4); + am1->addAttribute({"a5", predicate}, 5); + am1->addAttribute({"a6", predicate}, 6); AttrSpecList newSpec; newSpec.push_back(AttributeSpec("a1", INT32_SINGLE)); newSpec.push_back(AttributeSpec("a2", INT32_ARRAY)); diff --git a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp index 19bfedfcd31..402615e42bc 100644 --- a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp @@ -71,7 +71,7 @@ struct Fixture _pop(_mgr, 1, "test", CREATE_SERIAL_NUM), _ctx() { - _mgr->addAttribute("a1", AVConfig(AVBasicType::INT32), + _mgr->addAttribute({ "a1", AVConfig(AVBasicType::INT32)}, CREATE_SERIAL_NUM); } AttributeGuard::UP getAttr() { diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index a8b2f8c44ac..3eb69b045f9 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -42,18 +42,20 @@ LOG_SETUP("attribute_test"); namespace vespa { namespace config { namespace search {}}} -using std::string; -using namespace vespa::config::search; using namespace config; using namespace document; using namespace proton; -using namespace search; using namespace search::index; -using search::tensor::TensorAttribute; +using namespace search; +using namespace vespa::config::search; + using search::TuneFileAttributes; using search::index::DummyFileHeaderContext; -using search::predicate::PredicateIndex; +using search::index::schema::CollectionType; using search::predicate::PredicateHash; +using search::predicate::PredicateIndex; +using search::tensor::TensorAttribute; +using std::string; using vespalib::eval::ValueType; using vespalib::tensor::Tensor; using vespalib::tensor::TensorCells; @@ -118,7 +120,7 @@ struct Fixture { } AttributeVector::SP addAttribute(const vespalib::string &name) { - return _m->addAttribute(name, AVConfig(AVBasicType::INT32), + return _m->addAttribute({name, AVConfig(AVBasicType::INT32)}, createSerialNum); } void put(SerialNum serialNum, const Document &doc, DocumentIdT lid, @@ -141,26 +143,18 @@ struct Fixture TEST_F("require that attribute adapter handles put", Fixture) { Schema s; - s.addAttributeField(Schema::AttributeField("a1", schema::INT32, schema::SINGLE)); - s.addAttributeField(Schema::AttributeField("a2", schema::INT32, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("a3", schema::FLOAT, schema::SINGLE)); - s.addAttributeField(Schema::AttributeField("a4", schema::STRING, schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a1", schema::DataType::INT32, CollectionType::SINGLE)); + s.addAttributeField(Schema::AttributeField("a2", schema::DataType::INT32, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("a3", schema::DataType::FLOAT, CollectionType::SINGLE)); + s.addAttributeField(Schema::AttributeField("a4", schema::DataType::STRING, CollectionType::SINGLE)); DocBuilder idb(s); proton::AttributeManager & am = *f._m; AttributeVector::SP a1 = f.addAttribute("a1"); - AttributeVector::SP a2 = - am.addAttribute("a2", - AVConfig(AVBasicType::INT32, - AVCollectionType::ARRAY), - createSerialNum); - AttributeVector::SP a3 = - am.addAttribute("a3", AVConfig(AVBasicType::FLOAT), - createSerialNum); - AttributeVector::SP a4 = am.addAttribute("a4", - AVConfig(AVBasicType::STRING), - createSerialNum); + AttributeVector::SP a2 = am.addAttribute({"a2", AVConfig(AVBasicType::INT32, AVCollectionType::ARRAY)}, createSerialNum); + AttributeVector::SP a3 = am.addAttribute({"a3", AVConfig(AVBasicType::FLOAT)}, createSerialNum); + AttributeVector::SP a4 = am.addAttribute({"a4", AVConfig(AVBasicType::STRING)}, createSerialNum); attribute::IntegerContent ibuf; attribute::FloatContent fbuf; @@ -235,13 +229,11 @@ TEST_F("require that attribute adapter handles put", Fixture) TEST_F("require that attribute adapter handles predicate put", Fixture) { Schema s; - s.addAttributeField(Schema::AttributeField("a1", schema::BOOLEANTREE, schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a1", schema::DataType::BOOLEANTREE, CollectionType::SINGLE)); DocBuilder idb(s); proton::AttributeManager & am = *f._m; - AttributeVector::SP a1 = am.addAttribute("a1", - AVConfig(AVBasicType::PREDICATE), - createSerialNum); + AttributeVector::SP a1 = am.addAttribute({"a1", AVConfig(AVBasicType::PREDICATE)}, createSerialNum); PredicateIndex &index = static_cast<PredicateAttribute &>(*a1).getIndex(); @@ -283,8 +275,8 @@ TEST_F("require that attribute adapter handles remove", Fixture) AttributeVector::SP a1 = f.addAttribute("a1"); AttributeVector::SP a2 = f.addAttribute("a2"); Schema s; - s.addAttributeField(Schema::AttributeField("a1", schema::INT32, schema::SINGLE)); - s.addAttributeField(Schema::AttributeField("a2", schema::INT32, schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a1", schema::DataType::INT32, CollectionType::SINGLE)); + s.addAttributeField(Schema::AttributeField("a2", schema::DataType::INT32, CollectionType::SINGLE)); DocBuilder idb(s); @@ -317,11 +309,9 @@ void verifyAttributeContent(const AttributeVector & v, uint32_t lid, vespalib::s TEST_F("require that visibilitydelay is honoured", Fixture) { proton::AttributeManager & am = *f._m; - AttributeVector::SP a1 = am.addAttribute("a1", - AVConfig(AVBasicType::STRING), - createSerialNum); + AttributeVector::SP a1 = am.addAttribute({"a1", AVConfig(AVBasicType::STRING)}, createSerialNum); Schema s; - s.addAttributeField(Schema::AttributeField("a1", schema::STRING, schema::SINGLE)); + s.addAttributeField(Schema::AttributeField("a1", schema::DataType::STRING, CollectionType::SINGLE)); DocBuilder idb(s); EXPECT_EQUAL(1u, a1->getNumDocs()); EXPECT_EQUAL(0u, a1->getStatus().getLastSyncToken()); @@ -366,12 +356,10 @@ TEST_F("require that visibilitydelay is honoured", Fixture) TEST_F("require that attribute adapter handles predicate remove", Fixture) { proton::AttributeManager & am = *f._m; - AttributeVector::SP a1 = am.addAttribute("a1", - AVConfig(AVBasicType::PREDICATE), - createSerialNum); + AttributeVector::SP a1 = am.addAttribute({"a1", AVConfig(AVBasicType::PREDICATE)}, createSerialNum); Schema s; s.addAttributeField( - Schema::AttributeField("a1", schema::BOOLEANTREE, schema::SINGLE)); + Schema::AttributeField("a1", schema::DataType::BOOLEANTREE, CollectionType::SINGLE)); DocBuilder idb(s); PredicateSlimeBuilder builder; @@ -397,8 +385,8 @@ TEST_F("require that attribute adapter handles update", Fixture) fillAttribute(a2, 1, 20, 1); Schema schema; - schema.addAttributeField(Schema::AttributeField("a1", schema::INT32, schema::SINGLE)); - schema.addAttributeField(Schema::AttributeField("a2", schema::INT32, schema::SINGLE)); + schema.addAttributeField(Schema::AttributeField("a1", schema::DataType::INT32, CollectionType::SINGLE)); + schema.addAttributeField(Schema::AttributeField("a2", schema::DataType::INT32, CollectionType::SINGLE)); DocBuilder idb(schema); const document::DocumentType &dt(idb.getDocumentType()); DocumentUpdate upd(dt, DocumentId("doc::1")); @@ -431,11 +419,9 @@ TEST_F("require that attribute adapter handles update", Fixture) TEST_F("require that attribute adapter handles predicate update", Fixture) { proton::AttributeManager & am = *f._m; - AttributeVector::SP a1 = am.addAttribute("a1", - AVConfig(AVBasicType::PREDICATE), - createSerialNum); + AttributeVector::SP a1 = am.addAttribute({"a1", AVConfig(AVBasicType::PREDICATE)}, createSerialNum); Schema schema; - schema.addAttributeField(Schema::AttributeField("a1", schema::BOOLEANTREE, schema::SINGLE)); + schema.addAttributeField(Schema::AttributeField("a1", schema::DataType::BOOLEANTREE, CollectionType::SINGLE)); DocBuilder idb(schema); PredicateSlimeBuilder builder; @@ -537,8 +523,8 @@ struct FilterFixture _hwInfo)), _filterMgr(ACCEPTED_ATTRIBUTES, _baseMgr) { - _baseMgr->addAttribute("a1", INT32_SINGLE, createSerialNum); - _baseMgr->addAttribute("a2", INT32_SINGLE, createSerialNum); + _baseMgr->addAttribute({"a1", INT32_SINGLE}, createSerialNum); + _baseMgr->addAttribute({"a2", INT32_SINGLE}, createSerialNum); } }; @@ -572,13 +558,13 @@ AttributeVector::SP createTensorAttribute(Fixture &f) { AVConfig cfg(AVBasicType::TENSOR); cfg.setTensorType(ValueType::from_spec("tensor(x{},y{})")); - return f._m->addAttribute("a1", cfg, createSerialNum); + return f._m->addAttribute({"a1", cfg}, createSerialNum); } Schema createTensorSchema() { Schema schema; - schema.addAttributeField(Schema::AttributeField("a1", schema::TENSOR, schema::SINGLE)); + schema.addAttributeField(Schema::AttributeField("a1", schema::DataType::TENSOR, CollectionType::SINGLE)); return schema; } diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp index 79a10b8da37..50502767395 100644 --- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp @@ -29,6 +29,8 @@ using search::index::DummyFileHeaderContext; typedef search::attribute::Config AVConfig; typedef search::attribute::BasicType AVBasicType; typedef search::attribute::CollectionType AVCollectionType; +using searchcorespi::IFlushTarget; +using searchcorespi::FlushStats; typedef std::shared_ptr<Gate> GateSP; @@ -54,7 +56,7 @@ public: } virtual void - run(void) + run(void) override { _task->run(); _gate->countDown(); @@ -225,7 +227,7 @@ private: void requireThatFlushedAttributeCanBeLoaded(); public: int - Main(void); + Main(void) override; }; @@ -264,12 +266,12 @@ struct AttributeManagerFixture AttributeManagerFixture(BaseFixture &bf); ~AttributeManagerFixture(); AttributeVector::SP addAttribute(const vespalib::string &name) { - return _m.addAttribute(name, getInt32Config(), createSerialNum); + return _m.addAttribute({name, getInt32Config()}, createSerialNum); } AttributeVector::SP addPostingAttribute(const vespalib::string &name) { AVConfig cfg(getInt32Config()); cfg.setFastSearch(true); - return _m.addAttribute(name, cfg, createSerialNum); + return _m.addAttribute({name, cfg}, createSerialNum); } }; diff --git a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp index 4047a02121c..49def82ec59 100644 --- a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp @@ -45,7 +45,7 @@ struct Fixture addExtraAttribute("extra"); } void addAttribute(const vespalib::string &name) { - _mgr->addAttribute(name, AttributeUtils::getInt32Config(), 1); + _mgr->addAttribute({name, AttributeUtils::getInt32Config()}, 1); } void addExtraAttribute(const vespalib::string &name) { _mgr->addExtraAttribute(AttributeVector::SP(new Int32Attribute(name))); diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp index da549cc7be0..6030c9c6fad 100644 --- a/searchcore/src/tests/proton/common/cachedselect_test.cpp +++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp @@ -27,39 +27,40 @@ #include <vespa/log/log.h> LOG_SETUP("cachedselect_test"); -using search::index::Schema; -using document::DocumentTypeRepo; -using document::DocumentType; -using document::select::Node; -using document::select::Result; -using document::select::ResultSet; -using document::select::CloningVisitor; -using document::select::Context; -using vespalib::string; - -using document::config_builder::DocumenttypesConfigBuilderHelper; -using document::config_builder::Struct; -using document::config_builder::Array; -using document::config_builder::Wset; -using document::config_builder::Map; using document::DataType; using document::Document; using document::DocumentId; -using document::StringFieldValue; +using document::DocumentType; +using document::DocumentTypeRepo; using document::IntFieldValue; +using document::StringFieldValue; +using document::config_builder::Array; +using document::config_builder::DocumenttypesConfigBuilderHelper; +using document::config_builder::Map; +using document::config_builder::Struct; +using document::config_builder::Wset; +using document::select::CloningVisitor; +using document::select::Context; +using document::select::Node; +using document::select::Result; +using document::select::ResultSet; using proton::CachedSelect; using proton::SelectContext; -using search::AttributeVector; -using search::AttributeGuard; -using search::AttributeEnumGuard; using search::AttributeContext; -using search::EnumAttribute; +using search::AttributeEnumGuard; +using search::AttributeGuard; using search::AttributePosting; -using search::SingleValueNumericPostingAttribute; +using search::AttributeVector; +using search::EnumAttribute; using search::IntegerAttribute; using search::IntegerAttributeTemplate; +using search::SingleValueNumericPostingAttribute; using search::attribute::IAttributeContext; using search::attribute::test::MockAttributeManager; +using search::index::Schema; +using search::index::schema::CollectionType; +using vespalib::string; + using namespace search::index; typedef Node::UP NodeUP; @@ -77,10 +78,10 @@ namespace { void makeSchema(Schema &s) { - s.addIndexField(Schema::IndexField("ia", schema::STRING)); - s.addAttributeField(Schema::AttributeField("aa", schema::INT32)); - s.addAttributeField(Schema::AttributeField("aaa", schema::INT32, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("aaw", schema::INT32, schema::WEIGHTEDSET)); + s.addIndexField(Schema::IndexField("ia", schema::DataType::STRING)); + s.addAttributeField(Schema::AttributeField("aa", schema::DataType::INT32)); + s.addAttributeField(Schema::AttributeField("aaa", schema::DataType::INT32, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("aaw", schema::DataType::INT32, CollectionType::WEIGHTEDSET)); } const int32_t doc_type_id = 787121340; @@ -194,7 +195,7 @@ public: } virtual uint32_t - get(AttributeVector::DocId doc, largeint_t *v, uint32_t sz) const + get(AttributeVector::DocId doc, largeint_t *v, uint32_t sz) const override { ++_gets; return SvIntAttr::get(doc, v, sz); diff --git a/searchcore/src/tests/proton/common/schemautil_test.cpp b/searchcore/src/tests/proton/common/schemautil_test.cpp index 465c7a2a3b0..d21582c5111 100644 --- a/searchcore/src/tests/proton/common/schemautil_test.cpp +++ b/searchcore/src/tests/proton/common/schemautil_test.cpp @@ -6,25 +6,27 @@ #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/testkit/testapp.h> +using namespace proton; using namespace search::index; +using search::index::schema::CollectionType; +using search::index::schema::DataType; using vespalib::string; -using namespace proton; namespace { void addAllFieldTypes(const string &name, Schema &schema, fastos::TimeStamp timestamp) { - Schema::IndexField index_field(name, schema::STRING); + Schema::IndexField index_field(name, DataType::STRING); index_field.setTimestamp(timestamp); schema.addIndexField(index_field); - Schema::AttributeField attribute_field(name, schema::STRING); + Schema::AttributeField attribute_field(name, DataType::STRING); attribute_field.setTimestamp(timestamp); schema.addAttributeField(attribute_field); - Schema::SummaryField summary_field(name, schema::STRING); + Schema::SummaryField summary_field(name, DataType::STRING); summary_field.setTimestamp(timestamp); schema.addSummaryField(summary_field); } @@ -109,9 +111,9 @@ assertSchemaResult(const vespalib::string &name, TEST("require that listSchema can list all fields") { Schema schema; - schema.addIndexField(Schema::IndexField("if", schema::STRING)); - schema.addAttributeField(Schema::AttributeField("af", schema::INT32)); - schema.addSummaryField(Schema::SummaryField("sf", schema::FLOAT, schema::ARRAY)); + schema.addIndexField(Schema::IndexField("if", DataType::STRING)); + schema.addAttributeField(Schema::AttributeField("af", DataType::INT32)); + schema.addSummaryField(Schema::SummaryField("sf", DataType::FLOAT, CollectionType::ARRAY)); ListSchemaResult r; SchemaUtil::listSchema(schema, r.fieldNames, r.fieldDataTypes, r.fieldCollectionTypes, r.fieldLocations); diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp index 7bea3ee12e0..7199cda27d6 100644 --- a/searchcore/src/tests/proton/common/selectpruner_test.cpp +++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp @@ -12,22 +12,22 @@ LOG_SETUP("selectpruner_test"); using namespace search::index; -using document::DocumentTypeRepo; +using document::DataType; +using document::Document; using document::DocumentType; -using document::select::Node; -using document::select::Result; -using document::select::ResultSet; -using document::select::CloningVisitor; -using vespalib::string; - +using document::DocumentTypeRepo; +using document::config_builder::Array; using document::config_builder::DocumenttypesConfigBuilderHelper; +using document::config_builder::Map; using document::config_builder::Struct; -using document::config_builder::Array; using document::config_builder::Wset; -using document::config_builder::Map; -using document::DataType; -using document::Document; +using document::select::CloningVisitor; +using document::select::Node; +using document::select::Result; +using document::select::ResultSet; using proton::SelectPruner; +using search::index::schema::CollectionType; +using vespalib::string; typedef Node::UP NodeUP; @@ -37,12 +37,12 @@ namespace void makeSchema(Schema &s) { - s.addIndexField(Schema::IndexField("ia", schema::STRING)); - s.addAttributeField(Schema::AttributeField("aa", schema::INT32)); - s.addAttributeField(Schema::AttributeField("aaa", schema::INT32, - schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("aaw", schema::INT32, - schema::WEIGHTEDSET)); + s.addIndexField(Schema::IndexField("ia", schema::DataType::STRING)); + s.addAttributeField(Schema::AttributeField("aa", schema::DataType::INT32)); + s.addAttributeField(Schema::AttributeField("aaa", schema::DataType::INT32, + CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("aaw", schema::DataType::INT32, + CollectionType::WEIGHTEDSET)); } const int32_t doc_type_id = 787121340; diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 411730ce188..e0e0c477753 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -2,12 +2,19 @@ #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/common/bucketfactory.h> +#include <vespa/searchcore/proton/documentmetastore/documentmetastore.h> #include <vespa/searchcore/proton/docsummary/docsumcontext.h> #include <vespa/searchcore/proton/docsummary/documentstoreadapter.h> #include <vespa/searchcore/proton/docsummary/summarymanager.h> +#include <vespa/searchcore/proton/feedoperation/putoperation.h> +#include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcore/proton/server/documentdb.h> #include <vespa/searchcore/proton/server/bootstrapconfig.h> +#include <vespa/searchcore/proton/server/documentdbconfigmanager.h> +#include <vespa/searchcore/proton/server/idocumentsubdb.h> #include <vespa/searchcore/proton/server/memoryconfigstore.h> +#include <vespa/searchcore/proton/server/searchview.h> +#include <vespa/searchcore/proton/server/summaryadapter.h> #include <vespa/searchlib/common/idestructorcallback.h> #include <vespa/searchlib/common/transport.h> #include <vespa/searchlib/docstore/logdocumentstore.h> @@ -29,17 +36,19 @@ #include <vespa/log/log.h> LOG_SETUP("docsummary_test"); +using namespace cloud::config::filedistribution; using namespace document; -using namespace search; using namespace search::docsummary; using namespace search::engine; using namespace search::index; using namespace search::transactionlog; -using namespace cloud::config::filedistribution; -using search::TuneFileDocumentDB; +using namespace search; + using document::DocumenttypesConfig; -using storage::spi::Timestamp; +using search::TuneFileDocumentDB; using search::index::DummyFileHeaderContext; +using search::index::schema::CollectionType; +using storage::spi::Timestamp; using vespa::config::search::core::ProtonConfig; using vespalib::tensor::Tensor; using vespalib::tensor::TensorCells; @@ -372,7 +381,7 @@ private: public: Test(); - int Main(); + int Main() override; }; @@ -490,18 +499,18 @@ void Test::requireThatAdapterHandlesAllFieldTypes() { Schema s; - s.addSummaryField(Schema::SummaryField("a", schema::INT8)); - s.addSummaryField(Schema::SummaryField("b", schema::INT16)); - s.addSummaryField(Schema::SummaryField("c", schema::INT32)); - s.addSummaryField(Schema::SummaryField("d", schema::INT64)); - s.addSummaryField(Schema::SummaryField("e", schema::FLOAT)); - s.addSummaryField(Schema::SummaryField("f", schema::DOUBLE)); - s.addSummaryField(Schema::SummaryField("g", schema::STRING)); - s.addSummaryField(Schema::SummaryField("h", schema::STRING)); - s.addSummaryField(Schema::SummaryField("i", schema::RAW)); - s.addSummaryField(Schema::SummaryField("j", schema::RAW)); - s.addSummaryField(Schema::SummaryField("k", schema::STRING)); - s.addSummaryField(Schema::SummaryField("l", schema::STRING)); + s.addSummaryField(Schema::SummaryField("a", schema::DataType::INT8)); + s.addSummaryField(Schema::SummaryField("b", schema::DataType::INT16)); + s.addSummaryField(Schema::SummaryField("c", schema::DataType::INT32)); + s.addSummaryField(Schema::SummaryField("d", schema::DataType::INT64)); + s.addSummaryField(Schema::SummaryField("e", schema::DataType::FLOAT)); + s.addSummaryField(Schema::SummaryField("f", schema::DataType::DOUBLE)); + s.addSummaryField(Schema::SummaryField("g", schema::DataType::STRING)); + s.addSummaryField(Schema::SummaryField("h", schema::DataType::STRING)); + s.addSummaryField(Schema::SummaryField("i", schema::DataType::RAW)); + s.addSummaryField(Schema::SummaryField("j", schema::DataType::RAW)); + s.addSummaryField(Schema::SummaryField("k", schema::DataType::STRING)); + s.addSummaryField(Schema::SummaryField("l", schema::DataType::STRING)); BuildContext bc(s); bc._bld.startDocument("doc::0"); @@ -550,7 +559,7 @@ void Test::requireThatAdapterHandlesMultipleDocuments() { Schema s; - s.addSummaryField(Schema::SummaryField("a", schema::INT32)); + s.addSummaryField(Schema::SummaryField("a", schema::DataType::INT32)); BuildContext bc(s); bc._bld.startDocument("doc::0"). @@ -592,7 +601,7 @@ void Test::requireThatAdapterHandlesDocumentIdField() { Schema s; - s.addSummaryField(Schema::SummaryField("documentid", schema::STRING)); + s.addSummaryField(Schema::SummaryField("documentid", schema::DataType::STRING)); BuildContext bc(s); bc._bld.startDocument("doc::0"). startSummaryField("documentid"). @@ -619,7 +628,7 @@ void Test::requireThatDocsumRequestIsProcessed() { Schema s; - s.addSummaryField(Schema::SummaryField("a", schema::INT32)); + s.addSummaryField(Schema::SummaryField("a", schema::DataType::INT32)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); @@ -678,8 +687,8 @@ void Test::requireThatRewritersAreUsed() { Schema s; - s.addSummaryField(Schema::SummaryField("aa", schema::INT32)); - s.addSummaryField(Schema::SummaryField("ab", schema::INT32)); + s.addSummaryField(Schema::SummaryField("aa", schema::DataType::INT32)); + s.addSummaryField(Schema::SummaryField("ab", schema::DataType::INT32)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); @@ -717,16 +726,16 @@ void Test::requireThatAttributesAreUsed() { Schema s; - addField(s, "ba", schema::INT32, schema::SINGLE); - addField(s, "bb", schema::FLOAT, schema::SINGLE); - addField(s, "bc", schema::STRING, schema::SINGLE); - addField(s, "bd", schema::INT32, schema::ARRAY); - addField(s, "be", schema::FLOAT, schema::ARRAY); - addField(s, "bf", schema::STRING, schema::ARRAY); - addField(s, "bg", schema::INT32, schema::WEIGHTEDSET); - addField(s, "bh", schema::FLOAT, schema::WEIGHTEDSET); - addField(s, "bi", schema::STRING, schema::WEIGHTEDSET); - addField(s, "bj", schema::TENSOR, schema::SINGLE); + addField(s, "ba", schema::DataType::INT32, CollectionType::SINGLE); + addField(s, "bb", schema::DataType::FLOAT, CollectionType::SINGLE); + addField(s, "bc", schema::DataType::STRING, CollectionType::SINGLE); + addField(s, "bd", schema::DataType::INT32, CollectionType::ARRAY); + addField(s, "be", schema::DataType::FLOAT, CollectionType::ARRAY); + addField(s, "bf", schema::DataType::STRING, CollectionType::ARRAY); + addField(s, "bg", schema::DataType::INT32, CollectionType::WEIGHTEDSET); + addField(s, "bh", schema::DataType::FLOAT, CollectionType::WEIGHTEDSET); + addField(s, "bi", schema::DataType::STRING, CollectionType::WEIGHTEDSET); + addField(s, "bj", schema::DataType::TENSOR, CollectionType::SINGLE); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); @@ -866,7 +875,7 @@ void Test::requireThatSummaryAdapterHandlesPutAndRemove() { Schema s; - s.addSummaryField(Schema::SummaryField("f1", schema::STRING, schema::SINGLE)); + s.addSummaryField(Schema::SummaryField("f1", schema::DataType::STRING, CollectionType::SINGLE)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); Document::UP exp = bc._bld.startDocument("doc::1"). @@ -900,10 +909,10 @@ void Test::requireThatAnnotationsAreUsed() { Schema s; - s.addIndexField(Schema::IndexField("g", schema::STRING, schema::SINGLE)); - s.addSummaryField(Schema::SummaryField("g", schema::STRING, schema::SINGLE)); - s.addIndexField(Schema::IndexField("dynamicstring", schema::STRING, schema::SINGLE)); - s.addSummaryField(Schema::SummaryField("dynamicstring", schema::STRING, schema::SINGLE)); + s.addIndexField(Schema::IndexField("g", schema::DataType::STRING, CollectionType::SINGLE)); + s.addSummaryField(Schema::SummaryField("g", schema::DataType::STRING, CollectionType::SINGLE)); + s.addIndexField(Schema::IndexField("dynamicstring", schema::DataType::STRING, CollectionType::SINGLE)); + s.addSummaryField(Schema::SummaryField("dynamicstring", schema::DataType::STRING, CollectionType::SINGLE)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); Document::UP exp = bc._bld.startDocument("doc::0"). @@ -953,12 +962,12 @@ void Test::requireThatUrisAreUsed() { Schema s; - s.addUriIndexFields(Schema::IndexField("urisingle", schema::STRING, schema::SINGLE)); - s.addSummaryField(Schema::SummaryField("urisingle", schema::STRING, schema::SINGLE)); - s.addUriIndexFields(Schema::IndexField("uriarray", schema::STRING, schema::ARRAY)); - s.addSummaryField(Schema::SummaryField("uriarray", schema::STRING, schema::ARRAY)); - s.addUriIndexFields(Schema::IndexField("uriwset", schema::STRING, schema::WEIGHTEDSET)); - s.addSummaryField(Schema::SummaryField("uriwset", schema::STRING, schema::WEIGHTEDSET)); + s.addUriIndexFields(Schema::IndexField("urisingle", schema::DataType::STRING, CollectionType::SINGLE)); + s.addSummaryField(Schema::SummaryField("urisingle", schema::DataType::STRING, CollectionType::SINGLE)); + s.addUriIndexFields(Schema::IndexField("uriarray", schema::DataType::STRING, CollectionType::ARRAY)); + s.addSummaryField(Schema::SummaryField("uriarray", schema::DataType::STRING, CollectionType::ARRAY)); + s.addUriIndexFields(Schema::IndexField("uriwset", schema::DataType::STRING, CollectionType::WEIGHTEDSET)); + s.addSummaryField(Schema::SummaryField("uriwset", schema::DataType::STRING, CollectionType::WEIGHTEDSET)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); Document::UP exp = bc._bld.startDocument("doc::0"). @@ -1127,9 +1136,9 @@ void Test::requireThatPositionsAreUsed() { Schema s; - s.addAttributeField(Schema::AttributeField("sp2", schema::INT64)); - s.addAttributeField(Schema::AttributeField("ap2", schema::INT64, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("wp2", schema::INT64, schema::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("sp2", schema::DataType::INT64)); + s.addAttributeField(Schema::AttributeField("ap2", schema::DataType::INT64, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("wp2", schema::DataType::INT64, CollectionType::WEIGHTEDSET)); BuildContext bc(s); DBContext dc(bc._repo, getDocTypeName()); @@ -1179,9 +1188,9 @@ void Test::requireThatRawFieldsWorks() { Schema s; - s.addSummaryField(Schema::AttributeField("i", schema::RAW)); - s.addSummaryField(Schema::AttributeField("araw", schema::RAW, schema::ARRAY)); - s.addSummaryField(Schema::AttributeField("wraw", schema::RAW, schema::WEIGHTEDSET)); + s.addSummaryField(Schema::AttributeField("i", schema::DataType::RAW)); + s.addSummaryField(Schema::AttributeField("araw", schema::DataType::RAW, CollectionType::ARRAY)); + s.addSummaryField(Schema::AttributeField("wraw", schema::DataType::RAW, CollectionType::WEIGHTEDSET)); std::vector<char> binaryBlob; binaryBlob.push_back('\0'); @@ -1267,7 +1276,7 @@ void Test::requireThatFieldCacheRepoCanReturnDefaultFieldCache() { Schema s; - s.addSummaryField(Schema::SummaryField("a", schema::INT32)); + s.addSummaryField(Schema::SummaryField("a", schema::DataType::INT32)); BuildContext bc(s); FieldCacheRepo::UP repo = bc.createFieldCacheRepo(getResultConfig()); FieldCache::CSP cache = repo->getFieldCache(""); diff --git a/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp b/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp index f3f495925f0..487e84c02d6 100644 --- a/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp +++ b/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp @@ -50,8 +50,6 @@ #include <vespa/eval/tensor/tensor_factory.h> #include <vespa/vespalib/data/slime/slime.h> -using vespa::config::search::SummarymapConfig; -using vespa::config::search::SummarymapConfigBuilder; using document::Annotation; using document::AnnotationType; using document::ArrayDataType; @@ -59,11 +57,11 @@ using document::ArrayFieldValue; using document::ByteFieldValue; using document::DataType; using document::Document; -using document::DocumenttypesConfig; -using document::DocumenttypesConfigBuilder; using document::DocumentId; using document::DocumentType; using document::DocumentTypeRepo; +using document::DocumenttypesConfig; +using document::DocumenttypesConfigBuilder; using document::DoubleFieldValue; using document::FeatureSet; using document::Field; @@ -75,6 +73,8 @@ using document::LongFieldValue; using document::Predicate; using document::PredicateFieldValue; using document::RawFieldValue; +using document::ReferenceDataType; +using document::ReferenceFieldValue; using document::ShortFieldValue; using document::Span; using document::SpanList; @@ -82,24 +82,25 @@ using document::SpanTree; using document::StringFieldValue; using document::StructDataType; using document::StructFieldValue; +using document::TensorFieldValue; using document::UrlDataType; using document::WeightedSetDataType; using document::WeightedSetFieldValue; -using document::TensorFieldValue; -using document::ReferenceDataType; -using document::ReferenceFieldValue; using search::index::Schema; -using vespalib::Slime; -using vespalib::slime::Cursor; -using vespalib::string; using search::linguistics::SPANTREE_NAME; using search::linguistics::TERM; -using namespace search::docsummary; +using vespa::config::search::SummarymapConfig; +using vespa::config::search::SummarymapConfigBuilder; +using vespalib::Slime; using vespalib::geo::ZCurve; +using vespalib::slime::Cursor; +using vespalib::string; using vespalib::tensor::Tensor; using vespalib::tensor::TensorCells; using vespalib::tensor::TensorDimensions; +using namespace search::docsummary; + typedef SummaryFieldConverter SFC; namespace { @@ -195,7 +196,7 @@ class Test : public vespalib::TestApp { void setSpanTree(StringFieldValue & value, SpanTree::UP tree); public: Test(); - int Main(); + int Main() override; }; DocumenttypesConfig getDocumenttypesConfig() { @@ -481,11 +482,11 @@ void Test::checkArray(const char *(&str)[N], const FieldValue *value) { } void Test::setSummaryField(const string &field) { - _schema->addSummaryField(Schema::Field(field, search::index::schema::STRING)); + _schema->addSummaryField(Schema::Field(field, search::index::schema::DataType::STRING)); } void Test::setAttributeField(const string &field) { - _schema->addAttributeField(Schema::Field(field, search::index::schema::STRING)); + _schema->addAttributeField(Schema::Field(field, search::index::schema::DataType::STRING)); } void Test::requireThatSummaryIsAnUnmodifiedString() { diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp index 95c444860b9..66035647d86 100644 --- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp +++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp @@ -15,37 +15,37 @@ #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/testkit/test_kit.h> -using document::DocumentType; -using document::Field; -using namespace proton; - +using document::BucketId; using document::DataType; using document::Document; using document::DocumentId; -using document::BucketId; -using document::IntFieldValue; +using document::DocumentType; using document::DoubleFieldValue; +using document::Field; +using document::IntFieldValue; using document::StringFieldValue; -using search::DocumentIdT; -using search::DocumentMetaData; using search::AttributeContext; using search::AttributeEnumGuard; using search::AttributeGuard; using search::AttributeVector; +using search::DocumentIdT; +using search::DocumentMetaData; using search::attribute::BasicType; using search::attribute::CollectionType; using search::attribute::Config; using search::attribute::IAttributeContext; using search::attribute::test::MockAttributeManager; -using namespace search::index; -using storage::spi::Timestamp; using storage::spi::Bucket; -using storage::spi::PartitionId; -using storage::spi::IterateResult; using storage::spi::DocEntry; -using storage::spi::Selection; using storage::spi::DocumentSelection; using storage::spi::IncludedVersions; +using storage::spi::IterateResult; +using storage::spi::PartitionId; +using storage::spi::Selection; +using storage::spi::Timestamp; + +using namespace proton; +using namespace search::index; const uint64_t largeNum = 10000000; @@ -194,9 +194,9 @@ struct AttrUnitDR : public UnitDR : UnitDR(d->getType(), document::Document::UP(d->clone()), t, b, r), _amgr(), _schema(), _aa(), _dd(), _ss() { - createAttribute(_aa, BasicType::INT32, schema::INT32, "aa"); - createAttribute(_dd, BasicType::DOUBLE, schema::DOUBLE, "dd"); - createAttribute(_ss, BasicType::STRING, schema::STRING, "ss"); + createAttribute(_aa, BasicType::INT32, schema::DataType::INT32, "aa"); + createAttribute(_dd, BasicType::DOUBLE, schema::DataType::DOUBLE, "dd"); + createAttribute(_ss, BasicType::STRING, schema::DataType::STRING, "ss"); } AttrUnitDR(document::Document::UP d, Timestamp t, Bucket b, bool r, @@ -204,11 +204,11 @@ struct AttrUnitDR : public UnitDR : UnitDR(d->getType(), document::Document::UP(d->clone()), t, b, r), _amgr(), _schema(), _aa(), _dd(), _ss() { - createAttribute(_aa, BasicType::INT32, schema::INT32, "aa"); + createAttribute(_aa, BasicType::INT32, schema::DataType::INT32, "aa"); addAttribute<IntFieldValue, int32_t>(*_aa, aa); - createAttribute(_dd, BasicType::DOUBLE, schema::DOUBLE, "dd"); + createAttribute(_dd, BasicType::DOUBLE, schema::DataType::DOUBLE, "dd"); addAttribute<DoubleFieldValue, double>(*_dd, dd); - createAttribute(_ss, BasicType::STRING, schema::STRING, "ss"); + createAttribute(_ss, BasicType::STRING, schema::DataType::STRING, "ss"); addAttribute<StringFieldValue, vespalib::string>(*_ss, ss); } diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp index 71ee6961fff..1910161cd32 100644 --- a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp @@ -65,7 +65,7 @@ struct MyChangedHandler : public IBucketStateChangedHandler MyChangedHandler() : _bucket(), _state(BucketInfo::NOT_ACTIVE) {} virtual void notifyBucketStateChanged(const document::BucketId &bucketId, - storage::spi::BucketInfo::ActiveState newState) { + storage::spi::BucketInfo::ActiveState newState) override { _bucket = bucketId; _state = newState; } @@ -75,7 +75,7 @@ struct MyChangedHandler : public IBucketStateChangedHandler struct MyModifiedHandler : public IBucketModifiedHandler { virtual void - notifyBucketModified(const BucketId &bucket) + notifyBucketModified(const BucketId &bucket) override { (void) bucket; } diff --git a/searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp b/searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp index 3c0fe62e228..c66e9f49274 100644 --- a/searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/clusterstatehandler/clusterstatehandler_test.cpp @@ -18,7 +18,7 @@ struct MyClusterStateChangedHandler : public IClusterStateChangedHandler { IBucketStateCalculator::SP _calc; virtual void - notifyClusterStateChanged(const IBucketStateCalculator::SP &newCalc) { + notifyClusterStateChanged(const IBucketStateCalculator::SP &newCalc) override { _calc = newCalc; } }; diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp index 72276e9dfcb..61796df8468 100644 --- a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp @@ -17,8 +17,8 @@ typedef std::vector<IFeedView::SP> FeedViewVector; struct MyStreamHandler : public NewConfigOperation::IStreamHandler { - virtual void serializeConfig(SerialNum, vespalib::nbostream &) {} - virtual void deserializeConfig(SerialNum, vespalib::nbostream &) {} + virtual void serializeConfig(SerialNum, vespalib::nbostream &) override {} + virtual void deserializeConfig(SerialNum, vespalib::nbostream &) override {} }; @@ -69,21 +69,21 @@ struct MyFeedView : public test::DummyFeedView } // Implements IFeedView - virtual const DocumentMetaStore *getDocumentMetaStorePtr() const { return &_metaStore; } - virtual void preparePut(PutOperation &) { ++_preparePut; } - virtual void handlePut(FeedToken *, const PutOperation &) { ++_handlePut; } - virtual void prepareUpdate(UpdateOperation &) { ++_prepareUpdate; } - virtual void handleUpdate(FeedToken *, const UpdateOperation &) { ++_handleUpdate; } - virtual void prepareRemove(RemoveOperation &) { ++_prepareRemove; } - virtual void handleRemove(FeedToken *, const RemoveOperation &) { ++_handleRemove; } - virtual void prepareDeleteBucket(DeleteBucketOperation &) { ++_prepareDeleteBucket; } - virtual void handleDeleteBucket(const DeleteBucketOperation &) + virtual const DocumentMetaStore *getDocumentMetaStorePtr() const override { return &_metaStore; } + virtual void preparePut(PutOperation &) override { ++_preparePut; } + virtual void handlePut(FeedToken *, const PutOperation &) override { ++_handlePut; } + virtual void prepareUpdate(UpdateOperation &) override { ++_prepareUpdate; } + virtual void handleUpdate(FeedToken *, const UpdateOperation &) override { ++_handleUpdate; } + virtual void prepareRemove(RemoveOperation &) override { ++_prepareRemove; } + virtual void handleRemove(FeedToken *, const RemoveOperation &) override { ++_handleRemove; } + virtual void prepareDeleteBucket(DeleteBucketOperation &) override { ++_prepareDeleteBucket; } + virtual void handleDeleteBucket(const DeleteBucketOperation &) override { ++_handleDeleteBucket; } - virtual void prepareMove(MoveOperation &) { ++_prepareMove; } - virtual void handleMove(const MoveOperation &) { ++_handleMove; } - virtual void heartBeat(SerialNum) { ++_heartBeat; } - virtual void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &) { ++_handlePrune; } - virtual void handleCompactLidSpace(const CompactLidSpaceOperation &op) { + virtual void prepareMove(MoveOperation &) override { ++_prepareMove; } + virtual void handleMove(const MoveOperation &) override { ++_handleMove; } + virtual void heartBeat(SerialNum) override { ++_heartBeat; } + virtual void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &) override { ++_handlePrune; } + virtual void handleCompactLidSpace(const CompactLidSpaceOperation &op) override { _wantedLidLimit = op.getLidLimit(); } }; diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index 60f04bb0fa7..0cd11a9f9c4 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -59,7 +59,7 @@ const vespalib::string DOC_TYPE("invalid"); class IndexManagerDummyReconfigurer : public searchcorespi::IIndexManager::Reconfigurer { - virtual bool reconfigure(vespalib::Closure0<bool>::UP closure) { + virtual bool reconfigure(vespalib::Closure0<bool>::UP closure) override { bool ret = true; if (closure.get() != NULL) ret = closure->call(); // Perform index manager reconfiguration now diff --git a/searchcore/src/tests/proton/documentdb/configvalidator/configvalidator_test.cpp b/searchcore/src/tests/proton/documentdb/configvalidator/configvalidator_test.cpp index 6ca02a7a4c5..7fcdf4981bd 100644 --- a/searchcore/src/tests/proton/documentdb/configvalidator/configvalidator_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configvalidator/configvalidator_test.cpp @@ -5,6 +5,11 @@ using namespace proton; using namespace search::index; + +using proton::configvalidator::Result; +using proton::configvalidator::ResultType; +using search::index::schema::CollectionType; +using search::index::schema::DataType; using vespa::config::search::AttributesConfig; using vespa::config::search::AttributesConfigBuilder; @@ -12,9 +17,6 @@ typedef Schema::AttributeField AField; typedef Schema::IndexField IField; typedef Schema::SummaryField SField; -using proton::configvalidator::ResultType; -using proton::configvalidator::Result; - const ResultType OK = ResultType::OK; const ResultType DTC = ResultType::DATA_TYPE_CHANGED; const ResultType CTC = ResultType::COLLECTION_TYPE_CHANGED; @@ -47,7 +49,7 @@ struct SchemaBuilder Schema _schema; SchemaBuilder() : _schema() {} SchemaBuilder &add(const vespalib::string &name, FType ftype, - schema::DataType dtype, schema::CollectionType ctype = schema::SINGLE) { + schema::DataType dtype, schema::CollectionType ctype = schema::CollectionType::SINGLE) { switch (ftype) { case INDEX: _schema.addIndexField(IField(name, dtype, ctype)); @@ -74,13 +76,13 @@ create(FType ftype, Schema::DataType dtype, Schema::CollectionType ctype) Schema created(FType ftype, schema::DataType dtype) { - return create(ftype, dtype, schema::SINGLE); + return create(ftype, dtype, CollectionType::SINGLE); } Schema createc(FType ftype, schema::CollectionType ctype) { - return create(ftype, schema::STRING, ctype); + return create(ftype, DataType::STRING, ctype); } ResultType @@ -104,13 +106,13 @@ void requireThatChangedDataTypeIsDiscovered(FType ftype) { EXPECT_EQUAL(DTC, - checkSchema(created(ftype, schema::INT32), - created(ftype, schema::STRING), + checkSchema(created(ftype, DataType::INT32), + created(ftype, DataType::STRING), Schema())); EXPECT_EQUAL(DTC, - checkSchema(created(ftype, schema::INT32), + checkSchema(created(ftype, DataType::INT32), Schema(), - created(ftype, schema::STRING))); + created(ftype, DataType::STRING))); } TEST("require that changed data type is discovered") @@ -124,13 +126,13 @@ void requireThatChangedCollectionTypeIsDiscovered(FType ftype) { EXPECT_EQUAL(CTC, - checkSchema(createc(ftype, schema::ARRAY), - createc(ftype, schema::SINGLE), + checkSchema(createc(ftype, CollectionType::ARRAY), + createc(ftype, CollectionType::SINGLE), Schema())); EXPECT_EQUAL(CTC, - checkSchema(createc(ftype, schema::ARRAY), + checkSchema(createc(ftype, CollectionType::ARRAY), Schema(), - createc(ftype, schema::SINGLE))); + createc(ftype, CollectionType::SINGLE))); } TEST("require that changed collection type is discovered") @@ -142,15 +144,15 @@ TEST("require that changed collection type is discovered") TEST("require that changed index aspect is discovered") { - Schema s1 = created(SUMMARY, schema::STRING); - s1.addIndexField(IField("f1", schema::STRING)); - Schema s2 = created(SUMMARY, schema::STRING); - Schema s2h = created(INDEX, schema::STRING); - - Schema s3 = created(ATTRIBUTE, schema::STRING); - s3.addIndexField(IField("f1", schema::STRING)); - Schema s4 = created(ATTRIBUTE, schema::STRING); - Schema s4h = created(INDEX, schema::STRING); + Schema s1 = created(SUMMARY, DataType::STRING); + s1.addIndexField(IField("f1", DataType::STRING)); + Schema s2 = created(SUMMARY, DataType::STRING); + Schema s2h = created(INDEX, DataType::STRING); + + Schema s3 = created(ATTRIBUTE, DataType::STRING); + s3.addIndexField(IField("f1", DataType::STRING)); + Schema s4 = created(ATTRIBUTE, DataType::STRING); + Schema s4h = created(INDEX, DataType::STRING); { // remove as index field EXPECT_EQUAL(IAR, checkSchema(s2, s1, Schema())); EXPECT_EQUAL(IAR, checkSchema(s2, Schema(), s1)); @@ -174,21 +176,21 @@ TEST("require that changed index aspect is discovered") TEST("require that changed attribute aspect is discovered") { - Schema s1 = created(SUMMARY, schema::STRING); - s1.addAttributeField(AField("f1", schema::STRING)); - Schema s2 = created(SUMMARY, schema::STRING); - Schema s2h = created(ATTRIBUTE, schema::STRING); - - Schema s3 = created(INDEX, schema::STRING); - s3.addAttributeField(AField("f1", schema::STRING)); - Schema s4 = created(INDEX, schema::STRING); - Schema s4h = created(ATTRIBUTE, schema::STRING); - - Schema s5 = created(INDEX, schema::STRING); - s5.addSummaryField(SField("f1", schema::STRING)); - s5.addAttributeField(AField("f1", schema::STRING)); - Schema s6 = created(INDEX, schema::STRING); - s6.addSummaryField(SField("f1", schema::STRING)); + Schema s1 = created(SUMMARY, DataType::STRING); + s1.addAttributeField(AField("f1", DataType::STRING)); + Schema s2 = created(SUMMARY, DataType::STRING); + Schema s2h = created(ATTRIBUTE, DataType::STRING); + + Schema s3 = created(INDEX, DataType::STRING); + s3.addAttributeField(AField("f1", DataType::STRING)); + Schema s4 = created(INDEX, DataType::STRING); + Schema s4h = created(ATTRIBUTE, DataType::STRING); + + Schema s5 = created(INDEX, DataType::STRING); + s5.addSummaryField(SField("f1", DataType::STRING)); + s5.addAttributeField(AField("f1", DataType::STRING)); + Schema s6 = created(INDEX, DataType::STRING); + s6.addSummaryField(SField("f1", DataType::STRING)); { // remove as attribute field EXPECT_EQUAL(AAR, checkSchema(s2, s1, Schema())); EXPECT_EQUAL(AAR, checkSchema(s2, Schema(), s1)); @@ -214,15 +216,15 @@ TEST("require that changed attribute aspect is discovered") TEST("require that changed summary aspect is allowed") { - Schema s1 = created(INDEX, schema::STRING); - s1.addSummaryField(SField("f1", schema::STRING)); - Schema s2 = created(INDEX, schema::STRING); - Schema s2h = created(SUMMARY, schema::STRING); - - Schema s3 = created(ATTRIBUTE, schema::STRING); - s3.addSummaryField(SField("f1", schema::STRING)); - Schema s4 = created(ATTRIBUTE, schema::STRING); - Schema s4h = created(SUMMARY, schema::STRING); + Schema s1 = created(INDEX, DataType::STRING); + s1.addSummaryField(SField("f1", DataType::STRING)); + Schema s2 = created(INDEX, DataType::STRING); + Schema s2h = created(SUMMARY, DataType::STRING); + + Schema s3 = created(ATTRIBUTE, DataType::STRING); + s3.addSummaryField(SField("f1", DataType::STRING)); + Schema s4 = created(ATTRIBUTE, DataType::STRING); + Schema s4h = created(SUMMARY, DataType::STRING); { // remove as summary field EXPECT_EQUAL(OK, checkSchema(s2, s1, Schema())); EXPECT_EQUAL(IAA, checkSchema(s2, Schema(), s1)); @@ -242,16 +244,16 @@ TEST("require that changed summary aspect is allowed") TEST("require that fields can be added and removed") { Schema e; - Schema s1 = created(INDEX, schema::STRING); - Schema s2 = created(ATTRIBUTE, schema::STRING); - Schema s3 = created(SUMMARY, schema::STRING); - Schema s4 = created(SUMMARY, schema::STRING); - s4.addIndexField(IField("f1", schema::STRING)); - Schema s5 = created(SUMMARY, schema::STRING); - s5.addAttributeField(AField("f1", schema::STRING)); - Schema s6 = created(SUMMARY, schema::STRING); - s6.addIndexField(IField("f1", schema::STRING)); - s6.addAttributeField(AField("f1", schema::STRING)); + Schema s1 = created(INDEX, DataType::STRING); + Schema s2 = created(ATTRIBUTE, DataType::STRING); + Schema s3 = created(SUMMARY, DataType::STRING); + Schema s4 = created(SUMMARY, DataType::STRING); + s4.addIndexField(IField("f1", DataType::STRING)); + Schema s5 = created(SUMMARY, DataType::STRING); + s5.addAttributeField(AField("f1", DataType::STRING)); + Schema s6 = created(SUMMARY, DataType::STRING); + s6.addIndexField(IField("f1", DataType::STRING)); + s6.addAttributeField(AField("f1", DataType::STRING)); { // addition of field EXPECT_EQUAL(OK, checkSchema(s1, e, e)); EXPECT_EQUAL(OK, checkSchema(s2, e, e)); @@ -278,53 +280,53 @@ TEST("require that fields can be added and removed") TEST("require that data type changed precedes collection type changed") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). - add("f2", FType::INDEX, schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::INT32). - add("f2", FType::INDEX, schema::STRING, schema::ARRAY).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING). + add("f2", FType::INDEX, DataType::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, DataType::INT32). + add("f2", FType::INDEX, DataType::STRING, CollectionType::ARRAY).schema(); EXPECT_EQUAL(DTC, checkSchema(news, olds, Schema())); } TEST("require that collection type change precedes index aspect added") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). - add("f2", FType::SUMMARY, schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING, schema::ARRAY). - add("f2", FType::SUMMARY, schema::STRING). - add("f2", FType::INDEX, schema::STRING).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING). + add("f2", FType::SUMMARY, DataType::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING, CollectionType::ARRAY). + add("f2", FType::SUMMARY, DataType::STRING). + add("f2", FType::INDEX, DataType::STRING).schema(); EXPECT_EQUAL(CTC, checkSchema(news, olds, Schema())); } TEST("require that index aspect added precedes index aspect removed") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). - add("f2", FType::SUMMARY, schema::STRING). - add("f2", FType::INDEX, schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). - add("f1", FType::INDEX, schema::STRING). - add("f2", FType::SUMMARY, schema::STRING).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING). + add("f2", FType::SUMMARY, DataType::STRING). + add("f2", FType::INDEX, DataType::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING). + add("f1", FType::INDEX, DataType::STRING). + add("f2", FType::SUMMARY, DataType::STRING).schema(); EXPECT_EQUAL(IAA, checkSchema(news, olds, Schema())); } TEST("require that index aspect removed precedes attribute aspect removed") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). - add("f1", FType::INDEX, schema::STRING). - add("f2", FType::SUMMARY, schema::STRING). - add("f2", FType::ATTRIBUTE, schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). - add("f2", FType::SUMMARY, schema::STRING).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING). + add("f1", FType::INDEX, DataType::STRING). + add("f2", FType::SUMMARY, DataType::STRING). + add("f2", FType::ATTRIBUTE, DataType::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING). + add("f2", FType::SUMMARY, DataType::STRING).schema(); EXPECT_EQUAL(IAR, checkSchema(news, olds, Schema())); } TEST("require that attribute aspect removed precedes attribute aspect added") { - Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). - add("f1", FType::ATTRIBUTE, schema::STRING). - add("f2", FType::SUMMARY, schema::STRING).schema(); - Schema news = SchemaBuilder().add("f1", FType::SUMMARY, schema::STRING). - add("f2", FType::SUMMARY, schema::STRING). - add("f2", FType::ATTRIBUTE, schema::STRING).schema(); + Schema olds = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING). + add("f1", FType::ATTRIBUTE, DataType::STRING). + add("f2", FType::SUMMARY, DataType::STRING).schema(); + Schema news = SchemaBuilder().add("f1", FType::SUMMARY, DataType::STRING). + add("f2", FType::SUMMARY, DataType::STRING). + add("f2", FType::ATTRIBUTE, DataType::STRING).schema(); EXPECT_EQUAL(AAR, checkSchema(news, olds, Schema())); } diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp index 5110d92ce6a..ea201dfd251 100644 --- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp +++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp @@ -18,6 +18,7 @@ #include <vespa/searchcore/proton/server/fast_access_document_retriever.h> #include <vespa/searchcore/proton/server/minimal_document_retriever.h> #include <vespa/searchcore/proton/server/searchabledocsubdb.h> +#include <vespa/searchcore/proton/server/i_document_subdb_owner.h> #include <vespa/searchcore/proton/test/test.h> #include <vespa/searchcore/proton/test/thread_utils.h> #include <vespa/searchcorespi/plugin/iindexmanagerfactory.h> @@ -68,7 +69,7 @@ struct ConfigDir3 { static vespalib::string dir() { return TEST_PATH("cfg3"); } struct ConfigDir4 { static vespalib::string dir() { return TEST_PATH("cfg4") ; } }; -struct MySubDBOwner : public IDocumentSubDB::IOwner +struct MySubDBOwner : public IDocumentSubDBOwner { uint32_t _syncCnt; MySubDBOwner() : _syncCnt(0) {} @@ -84,18 +85,18 @@ struct MySubDBOwner : public IDocumentSubDB::IOwner struct MySyncProxy : public SyncProxy { - virtual void sync(SerialNum) {} + virtual void sync(SerialNum) override {} }; struct MyGetSerialNum : public IGetSerialNum { - virtual SerialNum getSerialNum() const { return 0u; } + virtual SerialNum getSerialNum() const override { return 0u; } }; struct MyFileHeaderContext : public FileHeaderContext { - virtual void addTags(vespalib::GenericHeader &, const vespalib::string &) const {} + virtual void addTags(vespalib::GenericHeader &, const vespalib::string &) const override {} }; struct MyMetricsWireService : public DummyWireService diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp index ab0acb1d77c..c70c2c28001 100644 --- a/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/documentbucketmover_test.cpp @@ -53,7 +53,7 @@ struct MyMoveHandler : public IDocumentMoveHandler _moves(), _numCachedBuckets() {} - virtual void handleMove(MoveOperation &op) { + virtual void handleMove(MoveOperation &op) override { _moves.push_back(op); if (_bucketDb.takeGuard()->isCachedBucket(op.getBucketId())) { ++_numCachedBuckets; @@ -73,16 +73,16 @@ struct MyDocumentRetriever : public DocumentRetrieverBaseForTest MyDocumentRetriever(DocumentTypeRepo::SP repo) : _repo(repo), _docs() { _docs.push_back(Document::SP()); // lid 0 invalid } - virtual const document::DocumentTypeRepo &getDocumentTypeRepo() const { return *_repo; } + virtual const document::DocumentTypeRepo &getDocumentTypeRepo() const override { return *_repo; } virtual void getBucketMetaData(const storage::spi::Bucket &, - DocumentMetaData::Vector &) const {} - virtual DocumentMetaData getDocumentMetaData(const DocumentId &) const { return DocumentMetaData(); } - virtual Document::UP getDocument(DocumentIdT lid) const { + DocumentMetaData::Vector &) const override {} + virtual DocumentMetaData getDocumentMetaData(const DocumentId &) const override { return DocumentMetaData(); } + virtual Document::UP getDocument(DocumentIdT lid) const override { return Document::UP(_docs[lid]->clone()); } virtual CachedSelect::SP - parseSelect(const vespalib::string &) const + parseSelect(const vespalib::string &) const override { return CachedSelect::SP(); } @@ -92,7 +92,7 @@ struct MyDocumentRetriever : public DocumentRetrieverBaseForTest struct MyBucketModifiedHandler : public IBucketModifiedHandler { BucketIdVector _modified; - virtual void notifyBucketModified(const BucketId &bucket) { + virtual void notifyBucketModified(const BucketId &bucket) override { BucketIdVector::const_iterator itr = std::find(_modified.begin(), _modified.end(), bucket); ASSERT_TRUE(itr == _modified.end()); _modified.push_back(bucket); diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp index f18029a6449..c191b7dc4b5 100644 --- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp @@ -5,12 +5,16 @@ #include <vespa/messagebus/testlib/receptor.h> #include <vespa/searchcommon/common/schema.h> #include <vespa/searchcore/proton/attribute/flushableattribute.h> +#include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/docsummary/summaryflushtarget.h> #include <vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h> #include <vespa/searchcore/proton/flushengine/threadedflushtarget.h> +#include <vespa/searchcore/proton/common/statusreport.h> +#include <vespa/searchcore/proton/matching/querylimiter.h> +#include <vespa/searchcore/proton/server/bootstrapconfig.h> #include <vespa/searchcore/proton/server/document_db_explorer.h> #include <vespa/searchcore/proton/server/documentdb.h> -#include <vespa/searchcore/proton/server/bootstrapconfig.h> +#include <vespa/searchcore/proton/server/documentdbconfigmanager.h> #include <vespa/searchcore/proton/server/memoryconfigstore.h> #include <vespa/searchcore/proton/metrics/job_tracked_flush_target.h> #include <vespa/searchcore/proton/metrics/metricswireservice.h> @@ -37,6 +41,7 @@ using search::index::DummyFileHeaderContext; using searchcorespi::index::IndexFlushTarget; using vespa::config::search::core::ProtonConfig; using vespalib::Slime; +using searchcorespi::IFlushTarget; namespace { diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index a33a5f147f2..6e2df00b162 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -6,12 +6,20 @@ #include <vespa/documentapi/messagebus/messages/updatedocumentreply.h> #include <vespa/persistence/spi/result.h> #include <vespa/searchcore/proton/common/bucketfactory.h> +#include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/metrics/feed_metrics.h> #include <vespa/searchcore/proton/feedoperation/moveoperation.h> +#include <vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h> +#include <vespa/searchcore/proton/feedoperation/putoperation.h> +#include <vespa/searchcore/proton/feedoperation/removeoperation.h> +#include <vespa/searchcore/proton/feedoperation/updateoperation.h> #include <vespa/searchcore/proton/feedoperation/wipehistoryoperation.h> +#include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> #include <vespa/searchcore/proton/server/configstore.h> #include <vespa/searchcore/proton/server/executorthreadingservice.h> #include <vespa/searchcore/proton/server/feedhandler.h> +#include <vespa/searchcore/proton/server/i_feed_handler_owner.h> +#include <vespa/searchcore/proton/server/ireplayconfig.h> #include <vespa/searchcore/proton/server/ddbstate.h> #include <vespa/searchcore/proton/test/dummy_feed_view.h> #include <vespa/searchlib/index/docbuilder.h> @@ -36,8 +44,10 @@ using documentapi::DocumentReply; using documentapi::RemoveDocumentReply; using documentapi::UpdateDocumentReply; using mbus::Reply; -using namespace search::index; using search::SerialNum; +using search::index::schema::CollectionType; +using search::index::schema::DataType; +using search::makeLambdaTask; using search::transactionlog::TransLogServer; using storage::spi::PartitionId; using storage::spi::RemoveResult; @@ -49,8 +59,9 @@ using vespalib::ThreadStackExecutor; using vespalib::ThreadStackExecutorBase; using vespalib::makeClosure; using vespalib::makeTask; -using search::makeLambdaTask; + using namespace proton; +using namespace search::index; typedef std::unique_ptr<vespalib::CountDownLatch> CountDownLatchUP; @@ -84,7 +95,7 @@ struct Rendezvous { }; -struct MyOwner : public FeedHandler::IOwner +struct MyOwner : public IFeedHandlerOwner { bool rejected_config; bool _allowPrune; @@ -97,16 +108,16 @@ struct MyOwner : public FeedHandler::IOwner wipe_history_count(0) { } - virtual void performWipeHistory() { ++wipe_history_count; } - virtual void onTransactionLogReplayDone() { + virtual void performWipeHistory() override { ++wipe_history_count; } + virtual void onTransactionLogReplayDone() override { LOG(info, "MyOwner::onTransactionLogReplayDone()"); } - virtual void enterRedoReprocessState() {} - virtual void onPerformPrune(SerialNum) {} - virtual bool isFeedBlockedByRejectedConfig() { return rejected_config; } + virtual void enterRedoReprocessState() override {} + virtual void onPerformPrune(SerialNum) override {} + virtual bool isFeedBlockedByRejectedConfig() override { return rejected_config; } virtual bool - getAllowPrune(void) const + getAllowPrune(void) const override { return _allowPrune; } @@ -130,8 +141,8 @@ struct MyResourceWriteFilter : public IResourceWriteFilter struct MyReplayConfig : public IReplayConfig { - virtual void replayConfig(SerialNum) {} - virtual void replayWipeHistory(SerialNum, fastos::TimeStamp) {} + virtual void replayConfig(SerialNum) override {} + virtual void replayWipeHistory(SerialNum, fastos::TimeStamp) override {} }; void ackToken(FeedToken *token) { @@ -191,7 +202,7 @@ struct MyFeedView : public test::DummyFeedView { MyFeedView(const DocumentTypeRepo::SP &dtr); ~MyFeedView(); void resetPutLatch(uint32_t count) { putLatch.reset(new vespalib::CountDownLatch(count)); } - virtual void preparePut(PutOperation &op) { + virtual void preparePut(PutOperation &op) override { prepareDocumentOperation(op, op.getDocument()->getId().getGlobalId()); } void prepareDocumentOperation(DocumentOperation &op, const GlobalId &gid) { @@ -202,7 +213,7 @@ struct MyFeedView : public test::DummyFeedView { op.setPrevTimestamp(entry->_prevTimestamp); } } - virtual void handlePut(FeedToken *token, const PutOperation &putOp) { + virtual void handlePut(FeedToken *token, const PutOperation &putOp) override { LOG(info, "MyFeedView::handlePut(): docId(%s), putCount(%u), putLatchCount(%u)", putOp.getDocument()->getId().toString().c_str(), put_count, (putLatch.get() != NULL ? putLatch->getCount() : 0u)); @@ -217,21 +228,21 @@ struct MyFeedView : public test::DummyFeedView { } ackToken(token); } - virtual void prepareUpdate(UpdateOperation &op) { + virtual void prepareUpdate(UpdateOperation &op) override { prepareDocumentOperation(op, op.getUpdate()->getId().getGlobalId()); } - virtual void handleUpdate(FeedToken *token, const UpdateOperation &op) { + virtual void handleUpdate(FeedToken *token, const UpdateOperation &op) override { ++update_count; update_serial = op.getSerialNum(); ackToken(token); } - virtual void handleRemove(FeedToken *token, const RemoveOperation &) + virtual void handleRemove(FeedToken *token, const RemoveOperation &) override { ++remove_count; ackToken(token); } - virtual void handleMove(const MoveOperation &) { ++move_count; } - virtual void heartBeat(SerialNum) { ++heartbeat_count; } + virtual void handleMove(const MoveOperation &) override { ++move_count; } + virtual void heartBeat(SerialNum) override { ++heartbeat_count; } virtual void handlePruneRemovedDocuments( - const PruneRemovedDocumentsOperation &) { ++prune_removed_count; } - virtual const ISimpleDocumentMetaStore *getDocumentMetaStorePtr() const { + const PruneRemovedDocumentsOperation &) override { ++prune_removed_count; } + virtual const ISimpleDocumentMetaStore *getDocumentMetaStorePtr() const override { return NULL; } }; @@ -261,7 +272,7 @@ struct SchemaContext { schema(new Schema()), builder() { - schema->addIndexField(Schema::IndexField("i1", schema::STRING, schema::SINGLE)); + schema->addIndexField(Schema::IndexField("i1", DataType::STRING, CollectionType::SINGLE)); builder.reset(new DocBuilder(*schema)); } DocTypeName getDocType() const { @@ -299,7 +310,7 @@ struct MyTransport : public FeedToken::ITransport { bool documentWasFound; MyTransport(); ~MyTransport(); - virtual void send(Reply::UP, ResultUP res, bool documentWasFound_, double) { + virtual void send(Reply::UP, ResultUP res, bool documentWasFound_, double) override { result = std::move(res); documentWasFound = documentWasFound_; gate.countDown(); @@ -404,11 +415,11 @@ struct MyTlsWriter : TlsWriter { bool erase_return; MyTlsWriter() : store_count(0), erase_count(0), erase_return(true) {} - virtual void storeOperation(const FeedOperation &) { ++store_count; } - virtual bool erase(SerialNum) { ++erase_count; return erase_return; } + virtual void storeOperation(const FeedOperation &) override { ++store_count; } + virtual bool erase(SerialNum) override { ++erase_count; return erase_return; } virtual SerialNum - sync(SerialNum syncTo) + sync(SerialNum syncTo) override { return syncTo; } @@ -470,21 +481,21 @@ struct FeedHandlerFixture struct MyConfigStore : ConfigStore { - virtual SerialNum getBestSerialNum() const { return 1; } - virtual SerialNum getOldestSerialNum() const { return 1; } + virtual SerialNum getBestSerialNum() const override { return 1; } + virtual SerialNum getOldestSerialNum() const override { return 1; } virtual void saveConfig(const DocumentDBConfig &, - const search::index::Schema &, SerialNum) {} + const search::index::Schema &, SerialNum) override {} virtual void loadConfig(const DocumentDBConfig &, SerialNum, DocumentDBConfig::SP &, - search::index::Schema::SP &) {} - virtual void removeInvalid() {} - void prune(SerialNum) {} - virtual bool hasValidSerial(SerialNum) const { return true; } - virtual SerialNum getPrevValidSerial(SerialNum) const { return 1; } + search::index::Schema::SP &) override {} + virtual void removeInvalid() override {} + void prune(SerialNum) override {} + virtual bool hasValidSerial(SerialNum) const override { return true; } + virtual SerialNum getPrevValidSerial(SerialNum) const override { return 1; } virtual void saveWipeHistoryConfig(SerialNum, - fastos::TimeStamp) {} - virtual void serializeConfig(SerialNum, vespalib::nbostream &) {} - virtual void deserializeConfig(SerialNum, vespalib::nbostream &) {} + fastos::TimeStamp) override {} + virtual void serializeConfig(SerialNum, vespalib::nbostream &) override {} + virtual void deserializeConfig(SerialNum, vespalib::nbostream &) override {} virtual void setProtonConfig(const ProtonConfigSP &) override { } }; diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index 42ddfa23eb6..bdc0fc5f15c 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -7,6 +7,7 @@ #include <vespa/searchcore/proton/attribute/i_attribute_writer.h> #include <vespa/searchcore/proton/common/bucketfactory.h> #include <vespa/searchcore/proton/common/commit_time_tracker.h> +#include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/index/i_index_writer.h> #include <vespa/searchcore/proton/metrics/feed_metrics.h> #include <vespa/searchcore/proton/server/ifrozenbuckethandler.h> @@ -35,20 +36,20 @@ LOG_SETUP("feedview_test"); using document::BucketId; -using document::DataType; using document::Document; using document::DocumentId; using document::DocumentUpdate; using documentapi::DocumentProtocol; using documentapi::RemoveDocumentReply; using fastos::TimeStamp; -using namespace proton; using proton::matching::SessionManager; +using proton::test::MockGidToLidChangeHandler; using search::AttributeVector; using search::CacheStats; using search::DocumentMetaData; using search::SearchableStats; -using namespace search::index; +using search::index::schema::CollectionType; +using search::index::schema::DataType; using searchcorespi::IndexSearchable; using storage::spi::BucketChecksum; using storage::spi::BucketInfo; @@ -56,7 +57,9 @@ using storage::spi::PartitionId; using storage::spi::Timestamp; using storage::spi::UpdateResult; using vespalib::eval::ValueType; -using proton::test::MockGidToLidChangeHandler; + +using namespace proton; +using namespace search::index; typedef SearchableFeedView::SerialNum SerialNum; typedef search::DocumentIdT DocumentIdT; @@ -225,7 +228,7 @@ struct MyDocumentStore : public test::DummyDocumentStore _lastSyncToken(0), _compactLidSpaceLidLimit(0) {} - virtual Document::UP read(DocumentIdT lid, const document::DocumentTypeRepo &) const { + virtual Document::UP read(DocumentIdT lid, const document::DocumentTypeRepo &) const override { DocMap::const_iterator itr = _docs.find(lid); if (itr != _docs.end()) { Document::UP retval(itr->second->clone()); @@ -233,18 +236,18 @@ struct MyDocumentStore : public test::DummyDocumentStore } return Document::UP(); } - virtual void write(uint64_t syncToken, const document::Document& doc, DocumentIdT lid) { + virtual void write(uint64_t syncToken, const document::Document& doc, DocumentIdT lid) override { _lastSyncToken = syncToken; _docs[lid] = Document::SP(doc.clone()); } - virtual void remove(uint64_t syncToken, DocumentIdT lid) { + virtual void remove(uint64_t syncToken, DocumentIdT lid) override { _lastSyncToken = syncToken; _docs.erase(lid); } - virtual uint64_t initFlush(uint64_t syncToken) { + virtual uint64_t initFlush(uint64_t syncToken) override { return syncToken; } - virtual uint64_t lastSyncToken() const { return _lastSyncToken; } + virtual uint64_t lastSyncToken() const override { return _lastSyncToken; } virtual void compactLidSpace(uint32_t wantedDocLidLimit) override { _compactLidSpaceLidLimit = wantedDocLidLimit; } @@ -254,7 +257,7 @@ struct MySummaryManager : public test::DummySummaryManager { MyDocumentStore _store; MySummaryManager() : _store() {} - virtual search::IDocumentStore &getBackingStore() { return _store; } + virtual search::IDocumentStore &getBackingStore() override { return _store; } }; struct MySummaryAdapter : public test::MockSummaryAdapter @@ -402,7 +405,7 @@ struct MyTransport : public FeedToken::ITransport virtual void send(mbus::Reply::UP reply, ResultUP result, bool documentWasFound, - double latency_ms) { + double latency_ms) override { (void) reply; (void) documentWasFound, (void) latency_ms; lastResult = std::move(result); _tracer.traceAck(lastResult); @@ -418,7 +421,7 @@ struct MyResultHandler : public IGenericResultHandler { vespalib::Gate _gate; MyResultHandler() : _gate() {} - virtual void handle(const storage::spi::Result &) { + virtual void handle(const storage::spi::Result &) override { _gate.countDown(); } void await() { _gate.await(); } @@ -437,11 +440,11 @@ SchemaContext::SchemaContext() : _schema(new Schema()), _builder() { - _schema->addIndexField(Schema::IndexField("i1", schema::STRING, schema::SINGLE)); - _schema->addAttributeField(Schema::AttributeField("a1", schema::STRING, schema::SINGLE)); - _schema->addAttributeField(Schema::AttributeField("a2", schema::BOOLEANTREE, schema::SINGLE)); - _schema->addAttributeField(Schema::AttributeField("a3", schema::TENSOR, schema::SINGLE)); - _schema->addSummaryField(Schema::SummaryField("s1", schema::STRING, schema::SINGLE)); + _schema->addIndexField(Schema::IndexField("i1", DataType::STRING, CollectionType::SINGLE)); + _schema->addAttributeField(Schema::AttributeField("a1", DataType::STRING, CollectionType::SINGLE)); + _schema->addAttributeField(Schema::AttributeField("a2", DataType::BOOLEANTREE, CollectionType::SINGLE)); + _schema->addAttributeField(Schema::AttributeField("a3", DataType::TENSOR, CollectionType::SINGLE)); + _schema->addSummaryField(Schema::SummaryField("s1", DataType::STRING, CollectionType::SINGLE)); _builder.reset(new DocBuilder(*_schema)); } SchemaContext::~SchemaContext() {} @@ -735,7 +738,7 @@ struct SearchableFeedViewFixture : public FixtureBase { runInMaster([&]() { _lidReuseDelayer.setHasIndexedOrAttributeFields(true); }); } - virtual IFeedView &getFeedView() { return fv; } + virtual IFeedView &getFeedView() override { return fv; } }; struct FastAccessFeedViewFixture : public FixtureBase @@ -754,7 +757,7 @@ struct FastAccessFeedViewFixture : public FixtureBase FastAccessFeedView::Context(aw, _docIdLimit)) { } - virtual IFeedView &getFeedView() { return fv; } + virtual IFeedView &getFeedView() override { return fv; } }; void diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index a4f4d729beb..579e33250b3 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -16,6 +16,7 @@ #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/testkit/test_kit.h> +using namespace cloud::config::filedistribution; using namespace config; using namespace document; using namespace proton; @@ -23,7 +24,6 @@ using namespace search::index; using namespace search; using namespace vespa::config::search::core; using namespace vespa::config::search; -using namespace cloud::config::filedistribution; using proton::matching::RankingConstants; typedef DocumentDBConfigHelper DBCM; @@ -45,12 +45,12 @@ Schema::SP getSchema(int step) { Schema::SP schema(new Schema); - schema->addIndexField(Schema::IndexField("foo1", schema::STRING)); + schema->addIndexField(Schema::IndexField("foo1", schema::DataType::STRING)); if (step < 2) { - schema->addIndexField(Schema::IndexField("foo2", schema::STRING)); + schema->addIndexField(Schema::IndexField("foo2", schema::DataType::STRING)); } if (step < 1) { - schema->addIndexField(Schema::IndexField("foo3", schema::STRING)); + schema->addIndexField(Schema::IndexField("foo3", schema::DataType::STRING)); } return schema; } @@ -83,7 +83,7 @@ Schema makeHistorySchema() { Schema hs; - hs.addIndexField(Schema::IndexField("history", schema::STRING)); + hs.addIndexField(Schema::IndexField("history", schema::DataType::STRING)); return hs; } diff --git a/searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp b/searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp index e483bc35b96..19f938188d3 100644 --- a/searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp +++ b/searchcore/src/tests/proton/documentdb/job_tracked_maintenance_job/job_tracked_maintenance_job_test.cpp @@ -38,7 +38,7 @@ struct MyMaintenanceJob : public IMaintenanceJob void block() { setBlocked(true); } - virtual bool run() { + virtual bool run() override { _runGates[_runIdx++]->await(5000); return _runIdx == _runGates.size(); } diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp index f056dee6927..542b66b3978 100644 --- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp +++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp @@ -42,12 +42,12 @@ struct MyScanIterator : public IDocumentScanIterator LidVector::const_iterator _itr; bool _validItr; MyScanIterator(const LidVector &lids) : _lids(lids), _itr(_lids.begin()), _validItr(true) {} - virtual bool valid() const { + virtual bool valid() const override { return _validItr; } virtual search::DocumentMetaData next(uint32_t compactLidLimit, uint32_t maxDocsToScan, - bool retry) { + bool retry) override { if (!retry && _itr != _lids.begin()) { ++_itr; } @@ -78,29 +78,29 @@ struct MyHandler : public ILidSpaceCompactionHandler MyHandler(); ~MyHandler(); - virtual vespalib::string getName() const { + virtual vespalib::string getName() const override { return "myhandler"; } - virtual uint32_t getSubDbId() const { return 2; } - virtual LidUsageStats getLidStatus() const { + virtual uint32_t getSubDbId() const override { return 2; } + virtual LidUsageStats getLidStatus() const override { ASSERT_TRUE(_handleMoveCnt < _stats.size()); return _stats[_handleMoveCnt]; } - virtual IDocumentScanIterator::UP getIterator() const { + virtual IDocumentScanIterator::UP getIterator() const override { ASSERT_TRUE(_iteratorCnt < _lids.size()); return IDocumentScanIterator::UP(new MyScanIterator(_lids[_iteratorCnt++])); } virtual MoveOperation::UP createMoveOperation(const search::DocumentMetaData &document, - uint32_t moveToLid) const { + uint32_t moveToLid) const override { ASSERT_TRUE(document.lid > moveToLid); _moveFromLid = document.lid; _moveToLid = moveToLid; return MoveOperation::UP(new MoveOperation()); } - virtual void handleMove(const MoveOperation &) { + virtual void handleMove(const MoveOperation &) override { ++_handleMoveCnt; } - virtual void handleCompactLidSpace(const CompactLidSpaceOperation &op) { + virtual void handleCompactLidSpace(const CompactLidSpaceOperation &op) override { _wantedSubDbId = op.getSubDbId(); _wantedLidLimit = op.getLidLimit(); } @@ -125,7 +125,7 @@ struct MyStorer : public IOperationStorer : _moveCnt(0), _compactCnt(0) {} - virtual void storeOperation(FeedOperation &op) { + virtual void storeOperation(FeedOperation &op) override { if (op.getType() == FeedOperation::MOVE) { ++ _moveCnt; } else if (op.getType() == FeedOperation::COMPACT_LID_SPACE) { @@ -191,7 +191,7 @@ struct MyDocumentStore : public test::DummyDocumentStore mutable uint32_t _readLid; MyDocumentStore() : _readDoc(), _readLid(0) {} virtual document::Document::UP - read(search::DocumentIdT lid, const document::DocumentTypeRepo &) const { + read(search::DocumentIdT lid, const document::DocumentTypeRepo &) const override { _readLid = lid; return Document::UP(_readDoc->clone()); } @@ -201,7 +201,7 @@ struct MySummaryManager : public test::DummySummaryManager { MyDocumentStore _store; MySummaryManager() : _store() {} - virtual search::IDocumentStore &getBackingStore() { return _store; } + virtual search::IDocumentStore &getBackingStore() override { return _store; } }; struct MySubDb : public test::DummyDocumentSubDb @@ -209,7 +209,7 @@ struct MySubDb : public test::DummyDocumentSubDb DocumentTypeRepo::SP _repo; MySubDb(const DocumentTypeRepo::SP &repo, std::shared_ptr<BucketDBOwner> bucketDB); ~MySubDb(); - virtual IFeedView::SP getFeedView() const { + virtual IFeedView::SP getFeedView() const override { return IFeedView::SP(new MyFeedView(_repo)); } }; diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp index 3671fd29b3f..63b23cebb6e 100644 --- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp +++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp @@ -5,6 +5,9 @@ #include <vespa/searchcore/proton/common/doctypename.h> #include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/feedoperation/moveoperation.h> +#include <vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h> +#include <vespa/searchcore/proton/feedoperation/putoperation.h> +#include <vespa/searchcore/proton/feedoperation/removeoperation.h> #include <vespa/searchcore/proton/server/executor_thread_service.h> #include <vespa/searchcore/proton/server/i_operation_storer.h> #include <vespa/searchcore/proton/server/ibucketmodifiedhandler.h> @@ -136,31 +139,31 @@ struct MyDocumentRetriever : public DocumentRetrieverBaseForTest } virtual const document::DocumentTypeRepo & - getDocumentTypeRepo(void) const + getDocumentTypeRepo(void) const override { abort(); } virtual void getBucketMetaData(const storage::spi::Bucket &, - DocumentMetaData::Vector &) const + DocumentMetaData::Vector &) const override { abort(); } virtual DocumentMetaData - getDocumentMetaData(const DocumentId &) const + getDocumentMetaData(const DocumentId &) const override { return DocumentMetaData(); } virtual Document::UP - getDocument(DocumentIdT lid) const + getDocument(DocumentIdT lid) const override { return _subDB.getDocument(lid); } virtual CachedSelect::SP - parseSelect(const vespalib::string &) const + parseSelect(const vespalib::string &) const override { return CachedSelect::SP(); } @@ -170,7 +173,7 @@ struct MyDocumentRetriever : public DocumentRetrieverBaseForTest struct MyBucketModifiedHandler : public IBucketModifiedHandler { BucketIdVector _modified; - virtual void notifyBucketModified(const BucketId &bucket) { + virtual void notifyBucketModified(const BucketId &bucket) override { BucketIdVector::const_iterator itr = std::find(_modified.begin(), _modified.end(), bucket); _modified.push_back(bucket); } @@ -182,7 +185,7 @@ struct MySessionCachePruner : public ISessionCachePruner { bool isInvoked; MySessionCachePruner() : isInvoked(false) { } - void pruneTimedOutSessions(fastos::TimeStamp current) { + void pruneTimedOutSessions(fastos::TimeStamp current) override { (void) current; isInvoked = true; } @@ -210,16 +213,16 @@ public: isExecutorThread(void); virtual void - handleMove(MoveOperation &op); + handleMove(MoveOperation &op) override; virtual void - performPruneRemovedDocuments(PruneRemovedDocumentsOperation &op); + performPruneRemovedDocuments(PruneRemovedDocumentsOperation &op) override; virtual void - heartBeat(void); + heartBeat(void) override; virtual void - wipeOldRemovedFields(TimeStamp wipeTimeLimit); + wipeOldRemovedFields(TimeStamp wipeTimeLimit) override; void setSubDBs(const std::vector<MyDocumentSubDB *> &subDBs); @@ -232,7 +235,7 @@ public: // Implements IOperationStorer virtual void - storeOperation(FeedOperation &op); + storeOperation(FeedOperation &op) override; uint32_t getHeartBeats(void) @@ -301,7 +304,7 @@ struct MySimpleJob : public IMaintenanceJob { } void block() { setBlocked(true); } - virtual bool run() { + virtual bool run() override { LOG(info, "MySimpleJob::run()"); _latch.countDown(); ++_runCnt; @@ -317,7 +320,7 @@ struct MySplitJob : public MySimpleJob : MySimpleJob(delay, interval, finishCount) { } - virtual bool run() { + virtual bool run() override { LOG(info, "MySplitJob::run()"); _latch.countDown(); ++_runCnt; @@ -336,7 +339,7 @@ struct MyLongRunningJob : public IMaintenanceJob { } void block() { setBlocked(true); } - virtual bool run() { + virtual bool run() override { _firstRun.countDown(); usleep(10000); return false; diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 868189272f3..d247c313ad4 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -44,6 +44,7 @@ using storage::spi::BucketInfo; using storage::spi::Timestamp; using vespalib::GenerationHandler; using vespalib::GenerationHolder; +using searchcorespi::IFlushTarget; namespace proton { @@ -75,7 +76,7 @@ public: } virtual bool - operator()(const GlobalId &lhs, const GlobalId &rhs) const + operator()(const GlobalId &lhs, const GlobalId &rhs) const override { return _comp(rhs, lhs); } diff --git a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp b/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp index 3b863561188..86bbf2ba94a 100644 --- a/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp +++ b/searchcore/src/tests/proton/feed_and_search/feed_and_search.cpp @@ -66,7 +66,7 @@ class Test : public vespalib::TestApp { const string &term, uint32_t doc_id); public: - int Main(); + int Main() override; }; #define TEST_CALL(func) \ @@ -96,7 +96,7 @@ const uint32_t field_id = 1; Schema getSchema() { Schema schema; - schema.addIndexField(Schema::IndexField(field_name, search::index::schema::STRING)); + schema.addIndexField(Schema::IndexField(field_name, search::index::schema::DataType::STRING)); return schema; } diff --git a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp b/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp index 88cace47390..f7832d7e4dc 100644 --- a/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp +++ b/searchcore/src/tests/proton/feedoperation/feedoperation_test.cpp @@ -55,8 +55,8 @@ namespace { struct MyStreamHandler : NewConfigOperation::IStreamHandler { typedef NewConfigOperation::SerialNum SerialNum; - virtual void serializeConfig(SerialNum, vespalib::nbostream &) {} - virtual void deserializeConfig(SerialNum, vespalib::nbostream &) {} + virtual void serializeConfig(SerialNum, vespalib::nbostream &) override {} + virtual void deserializeConfig(SerialNum, vespalib::nbostream &) override {} }; diff --git a/searchcore/src/tests/proton/feedtoken/feedtoken.cpp b/searchcore/src/tests/proton/feedtoken/feedtoken.cpp index 074c9284c06..07ff79c1c09 100644 --- a/searchcore/src/tests/proton/feedtoken/feedtoken.cpp +++ b/searchcore/src/tests/proton/feedtoken/feedtoken.cpp @@ -21,7 +21,7 @@ public: // empty } - void send(mbus::Reply::UP reply, ResultUP, bool, double latency_ms) { + void send(mbus::Reply::UP reply, ResultUP, bool, double latency_ms) override { _receptor.handleReply(std::move(reply)); _latency_ms = latency_ms; } @@ -45,7 +45,7 @@ private: void testTrace(); public: - int Main() { + int Main() override { TEST_INIT("feedtoken_test"); testAck(); TEST_FLUSH(); diff --git a/searchcore/src/tests/proton/flushengine/flushengine.cpp b/searchcore/src/tests/proton/flushengine/flushengine.cpp index a453958ab10..681501c9796 100644 --- a/searchcore/src/tests/proton/flushengine/flushengine.cpp +++ b/searchcore/src/tests/proton/flushengine/flushengine.cpp @@ -26,6 +26,7 @@ LOG_SETUP("flushengine_test"); using namespace proton; using namespace vespalib::slime; +using searchcorespi::IFlushTarget; using searchcorespi::FlushTask; using vespalib::Slime; @@ -45,7 +46,7 @@ public: } Task::UP - execute(Task::UP task) + execute(Task::UP task) override { task->run(); _done.countDown(); @@ -221,7 +222,7 @@ public: // empty } - void run() { + void run() override { _start.countDown(); if (_proceed != NULL) { _proceed->await(); @@ -231,7 +232,7 @@ public: } virtual search::SerialNum - getFlushSerial(void) const + getFlushSerial(void) const override { return 0u; } @@ -317,7 +318,7 @@ public: } virtual MemoryGain - getApproxMemoryGain() const + getApproxMemoryGain() const override { LOG_ASSERT(_mgain == false); _mgain = true; @@ -325,7 +326,7 @@ public: } virtual search::SerialNum - getFlushedSerialNum() const + getFlushedSerialNum() const override { LOG_ASSERT(_serial == false); _serial = true; @@ -414,12 +415,12 @@ public: _done(done), _name(name) { } - void run() { + void run() override { _list.push_back(_name); _done.countDown(); } virtual search::SerialNum - getFlushSerial(void) const + getFlushSerial(void) const override { return 0u; } diff --git a/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp b/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp index b3fd9a050a8..c91d1897984 100644 --- a/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp +++ b/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp @@ -10,6 +10,7 @@ using namespace proton; using search::SerialNum; +using searchcorespi::IFlushTarget; using SimpleFlushHandler = test::DummyFlushHandler; using FlushCandidatesList = std::vector<FlushTargetCandidates>; diff --git a/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp b/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp index e462ba17dba..594b718296c 100644 --- a/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp +++ b/searchcore/src/tests/proton/index/diskindexcleaner_test.cpp @@ -25,7 +25,7 @@ class Test : public vespalib::TestApp { void requireThatRemoveDontTouchNewIndexes(); public: - int Main(); + int Main() override; }; const string index_dir = "test_data"; diff --git a/searchcore/src/tests/proton/index/fusionrunner_test.cpp b/searchcore/src/tests/proton/index/fusionrunner_test.cpp index 5b0420bc922..53db6f44c91 100644 --- a/searchcore/src/tests/proton/index/fusionrunner_test.cpp +++ b/searchcore/src/tests/proton/index/fusionrunner_test.cpp @@ -27,7 +27,12 @@ LOG_SETUP("fusionrunner_test"); using document::Document; using document::FieldValue; +using proton::ExecutorThreadingService; using search::FixedSourceSelector; +using search::TuneFileAttributes; +using search::TuneFileIndexManager; +using search::TuneFileIndexing; +using search::TuneFileSearch; using search::diskindex::DiskIndex; using search::diskindex::IndexBuilder; using search::fef::MatchData; @@ -35,26 +40,23 @@ using search::fef::MatchDataLayout; using search::fef::TermFieldHandle; using search::fef::TermFieldMatchData; using search::index::DocBuilder; -using search::index::Schema; using search::index::DummyFileHeaderContext; +using search::index::Schema; +using search::index::schema::DataType; using search::memoryindex::MemoryIndex; using search::query::SimpleStringTerm; using search::queryeval::Blueprint; +using search::queryeval::FakeRequestContext; using search::queryeval::FieldSpec; using search::queryeval::FieldSpecList; using search::queryeval::ISourceSelector; using search::queryeval::SearchIterator; -using search::queryeval::FakeRequestContext; +using searchcorespi::index::FusionRunner; +using searchcorespi::index::FusionSpec; using std::set; using std::string; + using namespace proton; -using search::TuneFileAttributes; -using search::TuneFileIndexing; -using search::TuneFileIndexManager; -using search::TuneFileSearch; -using searchcorespi::index::FusionRunner; -using searchcorespi::index::FusionSpec; -using proton::ExecutorThreadingService; namespace { @@ -96,7 +98,7 @@ public: _threadingService) { } - int Main(); + int Main() override; }; int @@ -125,7 +127,7 @@ const uint32_t disk_id[] = { 1, 2, 21, 42 }; Schema getSchema() { Schema schema; schema.addIndexField( - Schema::IndexField(field_name, search::index::schema::STRING)); + Schema::IndexField(field_name, DataType::STRING)); return schema; } diff --git a/searchcore/src/tests/proton/index/indexcollection_test.cpp b/searchcore/src/tests/proton/index/indexcollection_test.cpp index 1b1bfb72cdb..b6c98e1631e 100644 --- a/searchcore/src/tests/proton/index/indexcollection_test.cpp +++ b/searchcore/src/tests/proton/index/indexcollection_test.cpp @@ -34,7 +34,7 @@ class Test : public vespalib::TestApp, void requireThatSearchablesCanBeReplaced(IndexCollection::UP fsc); void requireThatReplaceAndRenumberUpdatesCollectionAfterFusion(); IndexCollection::UP createWarmup(const IndexCollection::SP & prev, const IndexCollection::SP & next); - virtual void warmupDone(ISearchableIndexCollection::SP current) { + virtual void warmupDone(ISearchableIndexCollection::SP current) override { (void) current; } @@ -47,7 +47,7 @@ public: _warmup(new FakeIndexSearchable) {} - int Main(); + int Main() override; }; diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index 9d8f4d8b7f6..618467fd966 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -33,36 +33,38 @@ LOG_SETUP("indexmanager_test"); using document::Document; using document::FieldValue; +using search::SequencedTaskExecutor; +using search::SerialNum; +using search::TuneFileAttributes; +using search::TuneFileIndexManager; +using search::TuneFileIndexing; using search::datastore::EntryRef; using search::index::DocBuilder; -using search::index::Schema; using search::index::DummyFileHeaderContext; -using search::memoryindex::Dictionary; +using search::index::Schema; +using search::index::schema::DataType; +using search::makeLambdaTask; using search::memoryindex::CompactDocumentWordsStore; +using search::memoryindex::Dictionary; using search::queryeval::Source; -using search::SequencedTaskExecutor; -using search::SerialNum; using std::set; using std::string; +using vespalib::BlockingThreadStackExecutor; using vespalib::Gate; using vespalib::Monitor; using vespalib::MonitorGuard; +using vespalib::ThreadStackExecutor; + using namespace proton; using namespace searchcorespi; using namespace searchcorespi::index; -using search::TuneFileIndexing; -using search::TuneFileIndexManager; -using search::TuneFileAttributes; -using vespalib::BlockingThreadStackExecutor; -using vespalib::ThreadStackExecutor; -using search::makeLambdaTask; namespace { class IndexManagerDummyReconfigurer : public searchcorespi::IIndexManager::Reconfigurer { virtual bool - reconfigure(vespalib::Closure0<bool>::UP closure) + reconfigure(vespalib::Closure0<bool>::UP closure) override { bool ret = true; if (closure.get() != NULL) @@ -78,7 +80,7 @@ const uint32_t docid = 1; Schema getSchema() { Schema schema; - schema.addIndexField(Schema::IndexField(field_name, search::index::schema::STRING)); + schema.addIndexField(Schema::IndexField(field_name, DataType::STRING)); return schema; } diff --git a/searchcore/src/tests/proton/initializer/task_runner_test.cpp b/searchcore/src/tests/proton/initializer/task_runner_test.cpp index ef18130c1a8..8167d9f5242 100644 --- a/searchcore/src/tests/proton/initializer/task_runner_test.cpp +++ b/searchcore/src/tests/proton/initializer/task_runner_test.cpp @@ -44,7 +44,7 @@ public: { } - virtual void run() { _log.append(_name); } + virtual void run() override { _log.append(_name); } }; diff --git a/searchcore/src/tests/proton/matchengine/matchengine.cpp b/searchcore/src/tests/proton/matchengine/matchengine.cpp index b739e9954aa..e03f283d758 100644 --- a/searchcore/src/tests/proton/matchengine/matchengine.cpp +++ b/searchcore/src/tests/proton/matchengine/matchengine.cpp @@ -19,14 +19,14 @@ public: const std::string & name = "my", const std::string & reply = "myreply") : _numHits(numHits), _name(name), _reply(reply) {} - virtual DocsumReply::UP getDocsums(const DocsumRequest &) { + virtual DocsumReply::UP getDocsums(const DocsumRequest &) override { return DocsumReply::UP(new DocsumReply); } virtual search::engine::SearchReply::UP match( const ISearchHandler::SP &, const search::engine::SearchRequest &, - vespalib::ThreadBundle &) const { + vespalib::ThreadBundle &) const override { SearchReply::UP retval(new SearchReply); for (size_t i = 0; i < _numHits; ++i) { retval->hits.push_back(SearchReply::Hit()); @@ -43,7 +43,7 @@ private: public: LocalSearchClient(); ~LocalSearchClient(); - void searchDone(SearchReply::UP reply) { + void searchDone(SearchReply::UP reply) override { vespalib::MonitorGuard guard(_monitor); _reply = std::move(reply); guard.broadcast(); @@ -122,7 +122,7 @@ struct ObserveBundleMatchHandler : MySearchHandler { virtual search::engine::SearchReply::UP match( const ISearchHandler::SP &, const search::engine::SearchRequest &, - vespalib::ThreadBundle &threadBundle) const + vespalib::ThreadBundle &threadBundle) const override { bundleSize = threadBundle.size(); return SearchReply::UP(new SearchReply); diff --git a/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp b/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp index f7bf6b44b00..7ddee5d4490 100644 --- a/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp +++ b/searchcore/src/tests/proton/matching/docid_range_scheduler/docid_range_scheduler_bench.cpp @@ -204,7 +204,7 @@ struct RangeChecker : vespalib::Rendezvous<WorkTracker,bool> { size_t docid_limit; RangeChecker(size_t num_threads, size_t docid_limit_in) : vespalib::Rendezvous<WorkTracker,bool>(num_threads), docid_limit(docid_limit_in) {} - virtual void mingle() { + virtual void mingle() override { std::vector<DocidRange> ranges; for (size_t i = 0; i < size(); ++i) { ranges.insert(ranges.end(), in(i).ranges.begin(), in(i).ranges.end()); diff --git a/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp b/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp index e549ffd479e..ff86e0a5ff1 100644 --- a/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp +++ b/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp @@ -49,7 +49,7 @@ struct Fixture { const FieldInfo *assertField(size_t idx, const vespalib::string &name, DataType dataType, - search::fef::CollectionType collectionType) { + CollectionType collectionType) { const FieldInfo *field = env.getField(idx); ASSERT_TRUE(field != nullptr); EXPECT_EQUAL(field, env.getFieldByName(name)); @@ -62,7 +62,7 @@ struct Fixture { void assertHiddenAttributeField(size_t idx, const vespalib::string &name, DataType dataType, - search::fef::CollectionType collectionType) { + CollectionType collectionType) { const FieldInfo *field = assertField(idx, name, dataType, collectionType); EXPECT_FALSE(field->hasAttribute()); EXPECT_TRUE(field->type() == FieldType::HIDDEN_ATTRIBUTE); @@ -71,7 +71,7 @@ struct Fixture { void assertAttributeField(size_t idx, const vespalib::string &name, DataType dataType, - search::fef::CollectionType collectionType) { + CollectionType collectionType) { const FieldInfo *field = assertField(idx, name, dataType, collectionType); EXPECT_TRUE(field->hasAttribute()); EXPECT_TRUE(field->type() == FieldType::ATTRIBUTE); @@ -82,14 +82,14 @@ struct Fixture { TEST_F("require that document meta store is always extracted in index environment", Fixture(buildEmptySchema())) { ASSERT_EQUAL(1u, f.env.getNumFields()); - TEST_DO(f.assertHiddenAttributeField(0, "[documentmetastore]", DataType::RAW, search::fef::CollectionType::SINGLE)); + TEST_DO(f.assertHiddenAttributeField(0, "[documentmetastore]", DataType::RAW, CollectionType::SINGLE)); } TEST_F("require that imported attribute fields are extracted in index environment", Fixture(buildSchema())) { ASSERT_EQUAL(3u, f.env.getNumFields()); - TEST_DO(f.assertAttributeField(0, "imported_a", DataType::INT32, search::fef::CollectionType::SINGLE)); - TEST_DO(f.assertAttributeField(1, "imported_b", DataType::STRING, search::fef::CollectionType::ARRAY)); + TEST_DO(f.assertAttributeField(0, "imported_a", DataType::INT32, CollectionType::SINGLE)); + TEST_DO(f.assertAttributeField(1, "imported_b", DataType::STRING, CollectionType::ARRAY)); EXPECT_EQUAL("[documentmetastore]", f.env.getField(2)->name()); } diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp index a1c6538baa7..fc3184623da 100644 --- a/searchcore/src/tests/proton/matching/matching_test.cpp +++ b/searchcore/src/tests/proton/matching/matching_test.cpp @@ -47,6 +47,8 @@ using namespace search::index; using namespace search::query; using namespace search::queryeval; using namespace search; + +using search::index::schema::DataType; using storage::spi::Timestamp; void inject_match_phase_limiting(Properties &setup, const vespalib::string &attribute, size_t max_hits, bool descending) @@ -78,15 +80,15 @@ public: return _vectors.find(name)->second; } virtual const IAttributeVector * - getAttribute(const string &name) const { + getAttribute(const string &name) const override { return get(name); } virtual const IAttributeVector * - getAttributeStableEnum(const string &name) const { + getAttributeStableEnum(const string &name) const override { return get(name); } virtual void - getAttributeList(std::vector<const IAttributeVector *> & list) const { + getAttributeList(std::vector<const IAttributeVector *> & list) const override { Map::const_iterator pos = _vectors.begin(); Map::const_iterator end = _vectors.end(); for (; pos != end; ++pos) { @@ -133,12 +135,12 @@ struct MyWorld { void basicSetup(size_t heapSize=10, size_t arraySize=100) { // schema - schema.addIndexField(Schema::IndexField("f1", schema::STRING)); - schema.addIndexField(Schema::IndexField("f2", schema::STRING)); - schema.addIndexField(Schema::IndexField("tensor_field", schema::TENSOR)); - schema.addAttributeField(Schema::AttributeField("a1", schema::INT32)); - schema.addAttributeField(Schema::AttributeField("a2", schema::INT32)); - schema.addAttributeField(Schema::AttributeField("predicate_field", schema::BOOLEANTREE)); + schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f2", DataType::STRING)); + schema.addIndexField(Schema::IndexField("tensor_field", DataType::TENSOR)); + schema.addAttributeField(Schema::AttributeField("a1", DataType::INT32)); + schema.addAttributeField(Schema::AttributeField("a2", DataType::INT32)); + schema.addAttributeField(Schema::AttributeField("predicate_field", DataType::BOOLEANTREE)); // config config.add(indexproperties::rank::FirstPhase::NAME, "attribute(a1)"); @@ -275,11 +277,11 @@ struct MyWorld { MySearchHandler(Matcher::SP matcher) : _matcher(matcher) {} - virtual DocsumReply::UP getDocsums(const DocsumRequest &) + virtual DocsumReply::UP getDocsums(const DocsumRequest &) override { return DocsumReply::UP(); } virtual SearchReply::UP match(const ISearchHandler::SP &, const SearchRequest &, - vespalib::ThreadBundle &) const + vespalib::ThreadBundle &) const override { return SearchReply::UP(); } }; diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp index caf52a5fca4..12e6ceaddab 100644 --- a/searchcore/src/tests/proton/matching/query_test.cpp +++ b/searchcore/src/tests/proton/matching/query_test.cpp @@ -34,7 +34,6 @@ LOG_SETUP("query_test"); #include <vector> using document::PositionDataType; -using search::fef::CollectionType; using search::fef::FieldInfo; using search::fef::FieldType; using search::fef::ITermData; @@ -65,6 +64,7 @@ using search::queryeval::ParallelWeakAndBlueprint; using std::string; using std::vector; namespace fef_test = search::fef::test; +using CollectionType = FieldInfo::CollectionType; namespace proton { namespace matching { @@ -107,7 +107,7 @@ class Test : public vespalib::TestApp { void requireThatBlackListBlueprintCanBeUsed(); public: - int Main(); + int Main() override; }; #define TEST_CALL(func) \ @@ -225,19 +225,19 @@ public: EXPECT_EQUAL((double)estimatedHitCount / doc_count, n.field(0).getDocFreq()); } - virtual void visit(ProtonNumberTerm &n) { checkNode(n, 1, false); } - virtual void visit(ProtonLocationTerm &n) { checkNode(n, 0, true); } - virtual void visit(ProtonPrefixTerm &n) { checkNode(n, 1, false); } - virtual void visit(ProtonRangeTerm &n) { checkNode(n, 2, false); } - virtual void visit(ProtonStringTerm &n) { checkNode(n, 2, false); } - virtual void visit(ProtonSubstringTerm &n) { checkNode(n, 0, true); } - virtual void visit(ProtonSuffixTerm &n) { checkNode(n, 2, false); } - virtual void visit(ProtonPhrase &n) { checkNode(n, 0, true); } - virtual void visit(ProtonWeightedSetTerm &) {} - virtual void visit(ProtonDotProduct &) {} - virtual void visit(ProtonWandTerm &) {} - virtual void visit(ProtonPredicateQuery &) {} - virtual void visit(ProtonRegExpTerm &) {} + virtual void visit(ProtonNumberTerm &n) override { checkNode(n, 1, false); } + virtual void visit(ProtonLocationTerm &n) override { checkNode(n, 0, true); } + virtual void visit(ProtonPrefixTerm &n) override { checkNode(n, 1, false); } + virtual void visit(ProtonRangeTerm &n) override { checkNode(n, 2, false); } + virtual void visit(ProtonStringTerm &n) override { checkNode(n, 2, false); } + virtual void visit(ProtonSubstringTerm &n) override { checkNode(n, 0, true); } + virtual void visit(ProtonSuffixTerm &n) override { checkNode(n, 2, false); } + virtual void visit(ProtonPhrase &n) override { checkNode(n, 0, true); } + virtual void visit(ProtonWeightedSetTerm &) override {} + virtual void visit(ProtonDotProduct &) override {} + virtual void visit(ProtonWandTerm &) override {} + virtual void visit(ProtonPredicateQuery &) override {} + virtual void visit(ProtonRegExpTerm &) override {} }; void Test::requireThatTermsAreLookedUp() { @@ -357,12 +357,12 @@ class SetUpTermDataTestCheckerVisitor int Main() { return 0; } public: - virtual void visit(ProtonNumberTerm &) {} - virtual void visit(ProtonLocationTerm &) {} - virtual void visit(ProtonPrefixTerm &) {} - virtual void visit(ProtonRangeTerm &) {} + virtual void visit(ProtonNumberTerm &) override {} + virtual void visit(ProtonLocationTerm &) override {} + virtual void visit(ProtonPrefixTerm &) override {} + virtual void visit(ProtonRangeTerm &) override {} - virtual void visit(ProtonStringTerm &n) { + virtual void visit(ProtonStringTerm &n) override { const ITermData &term_data = n; EXPECT_EQUAL(string_weight.percent(), term_data.getWeight().percent()); @@ -378,17 +378,17 @@ public: } } - virtual void visit(ProtonSubstringTerm &) {} - virtual void visit(ProtonSuffixTerm &) {} - virtual void visit(ProtonPhrase &n) { + virtual void visit(ProtonSubstringTerm &) override {} + virtual void visit(ProtonSuffixTerm &) override {} + virtual void visit(ProtonPhrase &n) override { const ITermData &term_data = n; EXPECT_EQUAL(2u, term_data.getPhraseLength()); } - virtual void visit(ProtonWeightedSetTerm &) {} - virtual void visit(ProtonDotProduct &) {} - virtual void visit(ProtonWandTerm &) {} - virtual void visit(ProtonPredicateQuery &) {} - virtual void visit(ProtonRegExpTerm &) {} + virtual void visit(ProtonWeightedSetTerm &) override {} + virtual void visit(ProtonDotProduct &) override {} + virtual void visit(ProtonWandTerm &) override {} + virtual void visit(ProtonPredicateQuery &) override {} + virtual void visit(ProtonRegExpTerm &) override {} }; void Test::requireThatTermDataIsFilledIn() { diff --git a/searchcore/src/tests/proton/matching/querynodes_test.cpp b/searchcore/src/tests/proton/matching/querynodes_test.cpp index ef576c4ac37..d9c0fe09c24 100644 --- a/searchcore/src/tests/proton/matching/querynodes_test.cpp +++ b/searchcore/src/tests/proton/matching/querynodes_test.cpp @@ -39,7 +39,6 @@ LOG_SETUP("querynodes_test"); #include <vector> #include <vespa/searchlib/attribute/singlenumericattribute.hpp> -using search::fef::CollectionType; using search::fef::FieldInfo; using search::fef::FieldType; using search::fef::MatchData; @@ -70,6 +69,7 @@ using std::string; using std::vector; using namespace proton::matching; namespace fef_test = search::fef::test; +using CollectionType = FieldInfo::CollectionType; namespace { diff --git a/searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp b/searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp index 212762389f0..2734e860c72 100644 --- a/searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp +++ b/searchcore/src/tests/proton/matching/resolveviewvisitor_test.cpp @@ -15,7 +15,6 @@ LOG_SETUP("resolveviewvisitor_test"); #include <string> namespace fef_test = search::fef::test; -using search::fef::CollectionType; using search::fef::FieldInfo; using search::fef::FieldType; using search::fef::test::IndexEnvironment; @@ -23,6 +22,7 @@ using search::query::Node; using search::query::QueryBuilder; using std::string; using namespace proton::matching; +using CollectionType = FieldInfo::CollectionType; namespace { diff --git a/searchcore/src/tests/proton/matching/termdataextractor_test.cpp b/searchcore/src/tests/proton/matching/termdataextractor_test.cpp index d61267b7d31..43f0823d89f 100644 --- a/searchcore/src/tests/proton/matching/termdataextractor_test.cpp +++ b/searchcore/src/tests/proton/matching/termdataextractor_test.cpp @@ -21,7 +21,6 @@ LOG_SETUP("termdataextractor_test"); #include <vector> namespace fef_test = search::fef::test; -using search::fef::CollectionType; using search::fef::FieldInfo; using search::fef::FieldType; using search::fef::ITermData; @@ -35,6 +34,7 @@ using search::query::Weight; using std::string; using std::vector; using namespace proton::matching; +using CollectionType = FieldInfo::CollectionType; namespace search { class AttributeManager; } @@ -47,7 +47,7 @@ class Test : public vespalib::TestApp { void requireThatNegativeTermsAreSkipped(); public: - int Main(); + int Main() override; }; int diff --git a/searchcore/src/tests/proton/metrics/job_tracked_flush/job_tracked_flush_test.cpp b/searchcore/src/tests/proton/metrics/job_tracked_flush/job_tracked_flush_test.cpp index cf35ba0b505..edff0c4e2e4 100644 --- a/searchcore/src/tests/proton/metrics/job_tracked_flush/job_tracked_flush_test.cpp +++ b/searchcore/src/tests/proton/metrics/job_tracked_flush/job_tracked_flush_test.cpp @@ -28,10 +28,10 @@ struct MyFlushTask : public searchcorespi::FlushTask MyFlushTask(Gate &execGate) : _execGate(execGate) {} // Implements searchcorespi::FlushTask - virtual void run() { + virtual void run() override { _execGate.await(5000); } - virtual search::SerialNum getFlushSerial() const { return 5; } + virtual search::SerialNum getFlushSerial() const override { return 5; } }; struct MyFlushTarget : public test::DummyFlushTarget @@ -48,7 +48,7 @@ struct MyFlushTarget : public test::DummyFlushTarget {} // Implements searchcorespi::IFlushTarget - virtual FlushTask::UP initFlush(SerialNum currentSerial) { + virtual FlushTask::UP initFlush(SerialNum currentSerial) override { if (currentSerial > 0) { _initFlushSerial = currentSerial; _initGate.await(5000); diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp index 2710c1bc0fd..07a86c0ccd2 100644 --- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp @@ -17,11 +17,24 @@ using document::Document; using document::DocumentId; using document::DocumentType; using search::DocumentMetaData; +using storage::spi::Bucket; using storage::spi::BucketChecksum; +using storage::spi::BucketIdListResult; using storage::spi::BucketInfo; +using storage::spi::BucketInfoResult; +using storage::spi::Context; using storage::spi::ClusterState; +using storage::spi::CreateIteratorResult; using storage::spi::DocumentSelection; using storage::spi::GetResult; +using storage::spi::IteratorId; +using storage::spi::IterateResult; +using storage::spi::PartitionId; +using storage::spi::RemoveResult; +using storage::spi::Result; +using storage::spi::Selection; +using storage::spi::Timestamp; +using storage::spi::UpdateResult; using namespace proton; using namespace vespalib; @@ -106,16 +119,16 @@ struct MyDocumentRetriever : DocumentRetrieverBaseForTest { MyDocumentRetriever(const Document *d, Timestamp ts, DocumentId &last_id) : repo(), document(d), timestamp(ts), last_doc_id(last_id) {} - virtual const document::DocumentTypeRepo &getDocumentTypeRepo() const { + virtual const document::DocumentTypeRepo &getDocumentTypeRepo() const override { return repo; } virtual void getBucketMetaData(const storage::spi::Bucket &, - search::DocumentMetaData::Vector &v) const { + search::DocumentMetaData::Vector &v) const override { if (document != 0) { v.push_back(getDocumentMetaData(document->getId())); } } - virtual DocumentMetaData getDocumentMetaData(const DocumentId &id) const { + virtual DocumentMetaData getDocumentMetaData(const DocumentId &id) const override { last_doc_id = id; if (document != 0) { return DocumentMetaData(1, timestamp, document::BucketId(1), @@ -123,7 +136,7 @@ struct MyDocumentRetriever : DocumentRetrieverBaseForTest { } return DocumentMetaData(); } - virtual document::Document::UP getDocument(search::DocumentIdT) const { + virtual document::Document::UP getDocument(search::DocumentIdT) const override { if (document != 0) { return Document::UP(document->clone()); } @@ -131,7 +144,7 @@ struct MyDocumentRetriever : DocumentRetrieverBaseForTest { } virtual CachedSelect::SP - parseSelect(const vespalib::string &) const + parseSelect(const vespalib::string &) const override { return CachedSelect::SP(); } @@ -193,66 +206,66 @@ struct MyHandler : public IPersistenceHandler, IBucketFreezer { token.ack(); } - virtual void initialize() { initialized = true; } + virtual void initialize() override { initialized = true; } virtual void handlePut(FeedToken token, const Bucket& bucket, - Timestamp timestamp, const document::Document::SP& doc) { + Timestamp timestamp, const document::Document::SP& doc) override { token.setResult(ResultUP(new storage::spi::Result()), false); handle(token, bucket, timestamp, doc->getId()); } virtual void handleUpdate(FeedToken token, const Bucket& bucket, - Timestamp timestamp, const document::DocumentUpdate::SP& upd) { + Timestamp timestamp, const document::DocumentUpdate::SP& upd) override { token.setResult(ResultUP(new storage::spi::UpdateResult(existingTimestamp)), existingTimestamp > 0); handle(token, bucket, timestamp, upd->getId()); } virtual void handleRemove(FeedToken token, const Bucket& bucket, - Timestamp timestamp, const DocumentId& id) { + Timestamp timestamp, const DocumentId& id) override { bool wasFound = existingTimestamp > 0; token.setResult(ResultUP(new storage::spi::RemoveResult(wasFound)), wasFound); handle(token, bucket, timestamp, id); } - virtual void handleListBuckets(IBucketIdListResultHandler &resultHandler) { + virtual void handleListBuckets(IBucketIdListResultHandler &resultHandler) override { resultHandler.handle(BucketIdListResult(bucketList)); } virtual void handleSetClusterState(const ClusterState &calc, - IGenericResultHandler &resultHandler) { + IGenericResultHandler &resultHandler) override { lastCalc = &calc; resultHandler.handle(Result()); } virtual void handleSetActiveState(const Bucket &bucket, storage::spi::BucketInfo::ActiveState newState, - IGenericResultHandler &resultHandler) { + IGenericResultHandler &resultHandler) override { lastBucket = bucket; lastBucketState = newState; resultHandler.handle(bucketStateResult); } virtual void handleGetBucketInfo(const Bucket &, - IBucketInfoResultHandler &resultHandler) { + IBucketInfoResultHandler &resultHandler) override { resultHandler.handle(BucketInfoResult(bucketInfo)); } virtual void handleCreateBucket(FeedToken token, - const storage::spi::Bucket &) + const storage::spi::Bucket &) override { token.setResult(ResultUP(new Result(_createBucketResult)), true); token.ack(); } virtual void handleDeleteBucket(FeedToken token, - const storage::spi::Bucket &) { + const storage::spi::Bucket &) override { token.setResult(ResultUP(new Result(deleteBucketResult)), true); token.ack(); } - virtual void handleGetModifiedBuckets(IBucketIdListResultHandler &resultHandler) { + virtual void handleGetModifiedBuckets(IBucketIdListResultHandler &resultHandler) override { resultHandler.handle(BucketIdListResult(modBucketList)); } @@ -260,7 +273,7 @@ struct MyHandler : public IPersistenceHandler, IBucketFreezer { handleSplit(FeedToken token, const storage::spi::Bucket &source, const storage::spi::Bucket &target1, - const storage::spi::Bucket &target2) + const storage::spi::Bucket &target2) override { (void) source; (void) target1; @@ -384,7 +397,7 @@ Selection selection(doc_sel); class SimplePersistenceEngineOwner : public IPersistenceEngineOwner { virtual void - setClusterState(const storage::spi::ClusterState &calc) + setClusterState(const storage::spi::ClusterState &calc) override { (void) calc; } diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp index 651cd30ce68..7cae854674d 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp @@ -61,7 +61,7 @@ struct MyGidToLidMapperFactory : public search::IGidToLidMapperFactory _map.insert({toGid(doc2), 17}); } - virtual std::unique_ptr<search::IGidToLidMapper> getMapper() const { + virtual std::unique_ptr<search::IGidToLidMapper> getMapper() const override { return std::make_unique<MyGidToLidMapper>(_map); } }; diff --git a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp index 97310597e14..aeb6d9a3587 100644 --- a/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/attribute_reprocessing_initializer/attribute_reprocessing_initializer_test.cpp @@ -24,6 +24,7 @@ using namespace search; using namespace search::index; using search::attribute::Config; using search::attribute::BasicType; +using search::index::schema::DataType; const vespalib::string TEST_DIR = "test_output"; const SerialNum INIT_SERIAL_NUM = 10; @@ -36,10 +37,10 @@ struct MyReprocessingHandler : public IReprocessingHandler IReprocessingReader::SP _reader; std::vector<IReprocessingRewriter::SP> _rewriters; MyReprocessingHandler() : _reader(), _rewriters() {} - virtual void addReader(const IReprocessingReader::SP &reader) { + virtual void addReader(const IReprocessingReader::SP &reader) override { _reader = reader; } - virtual void addRewriter(const IReprocessingRewriter::SP &rewriter) { + virtual void addRewriter(const IReprocessingRewriter::SP &rewriter) override { _rewriters.push_back(rewriter); } }; @@ -62,19 +63,19 @@ struct MyConfig void addAttrs(const StringVector &attrs) { for (auto attr : attrs) { if (attr == "tensor") { - _mgr->addAttribute(attr, test::AttributeUtils::getTensorConfig(), 1); - _schema.addAttributeField(Schema::AttributeField(attr, schema::TENSOR)); + _mgr->addAttribute({attr, test::AttributeUtils::getTensorConfig()}, 1); + _schema.addAttributeField(Schema::AttributeField(attr, DataType::TENSOR)); } else if (attr == "predicate") { - _mgr->addAttribute(attr, test::AttributeUtils::getPredicateConfig(), 1); - _schema.addAttributeField(Schema::AttributeField(attr, schema::BOOLEANTREE)); + _mgr->addAttribute({attr, test::AttributeUtils::getPredicateConfig()}, 1); + _schema.addAttributeField(Schema::AttributeField(attr, DataType::BOOLEANTREE)); } else { - _mgr->addAttribute(attr, test::AttributeUtils::getStringConfig(), 1); - _schema.addAttributeField(Schema::AttributeField(attr, schema::STRING)); + _mgr->addAttribute({attr, test::AttributeUtils::getStringConfig()}, 1); + _schema.addAttributeField(Schema::AttributeField(attr, DataType::STRING)); } } } void addIndexField(const vespalib::string &name) { - _schema.addIndexField(Schema::IndexField(name, schema::STRING)); + _schema.addIndexField(Schema::IndexField(name, DataType::STRING)); } }; @@ -98,7 +99,7 @@ struct MyDocTypeInspector : public IDocumentTypeInspector _newCfg(newCfg) { } - virtual bool hasUnchangedField(const vespalib::string &name) const { + virtual bool hasUnchangedField(const vespalib::string &name) const override { return _oldCfg._fields.count(name) > 0 && _newCfg._fields.count(name) > 0; } diff --git a/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp b/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp index 1848ad8fc74..fb1434d4a0c 100644 --- a/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/document_reprocessing_handler/document_reprocessing_handler_test.cpp @@ -19,11 +19,10 @@ struct MyProcessor : public ReprocessingType DocumentId _docId; MyProcessor() : _lid(0), _docId() {} - virtual void handleExisting(uint32_t lid, DocumentType doc) { + virtual void handleExisting(uint32_t lid, DocumentType doc) override { _lid = lid; _docId = doc.getId(); } - virtual void done() { } }; typedef MyProcessor<IReprocessingReader, const Document &> MyReader; diff --git a/searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp b/searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp index c4c462ecfa1..4d9cbd307ba 100644 --- a/searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp +++ b/searchcore/src/tests/proton/reprocessing/reprocessing_runner/reprocessing_runner_test.cpp @@ -44,7 +44,7 @@ struct MyTask : public IReprocessingTask } virtual void - run() + run() override { ASSERT_EQUAL(_initProgress, _runner.getProgress()); _myProgress = 0.5; @@ -54,7 +54,7 @@ struct MyTask : public IReprocessingTask } virtual Progress - getProgress(void) const + getProgress(void) const override { return Progress(_myProgress, _weight); } diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index 8f94f382870..d3a1f4d47cf 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -38,7 +38,6 @@ using document::ArrayFieldValue; using document::FieldValue; using document::BucketId; -using document::DataType; using document::Document; using document::DocumentId; using document::DocumentType; @@ -68,6 +67,7 @@ using search::attribute::CollectionType; using search::attribute::Config; using search::attribute::IAttributeVector; using search::index::Schema; +using search::index::schema::DataType; using storage::spi::Bucket; using storage::spi::GetResult; using storage::spi::PartitionId; @@ -150,25 +150,25 @@ document::DocumenttypesConfig getRepoConfig() { builder.document(doc_type_id, doc_type_name, Struct(doc_type_name + ".header"), Struct(doc_type_name + ".body") - .addField(static_field, DataType::T_INT) - .addField(dyn_field_i, DataType::T_INT) - .addField(dyn_field_d, DataType::T_DOUBLE) - .addField(dyn_field_s, DataType::T_STRING) - .addField(dyn_field_n, DataType::T_FLOAT) - .addField(dyn_field_nai, DataType::T_INT) - .addField(dyn_field_nas, DataType::T_STRING) - .addField(dyn_field_p, DataType::T_PREDICATE) - .addField(dyn_arr_field_i, Array(DataType::T_INT)) - .addField(dyn_arr_field_d, Array(DataType::T_DOUBLE)) - .addField(dyn_arr_field_s, Array(DataType::T_STRING)) - .addField(dyn_arr_field_n, Array(DataType::T_FLOAT)) - .addField(dyn_wset_field_i, Wset(DataType::T_INT)) - .addField(dyn_wset_field_d, Wset(DataType::T_DOUBLE)) - .addField(dyn_wset_field_s, Wset(DataType::T_STRING)) - .addField(dyn_wset_field_n, Wset(DataType::T_FLOAT)) + .addField(static_field, document::DataType::T_INT) + .addField(dyn_field_i, document::DataType::T_INT) + .addField(dyn_field_d, document::DataType::T_DOUBLE) + .addField(dyn_field_s, document::DataType::T_STRING) + .addField(dyn_field_n, document::DataType::T_FLOAT) + .addField(dyn_field_nai, document::DataType::T_INT) + .addField(dyn_field_nas, document::DataType::T_STRING) + .addField(dyn_field_p, document::DataType::T_PREDICATE) + .addField(dyn_arr_field_i, Array(document::DataType::T_INT)) + .addField(dyn_arr_field_d, Array(document::DataType::T_DOUBLE)) + .addField(dyn_arr_field_s, Array(document::DataType::T_STRING)) + .addField(dyn_arr_field_n, Array(document::DataType::T_FLOAT)) + .addField(dyn_wset_field_i, Wset(document::DataType::T_INT)) + .addField(dyn_wset_field_d, Wset(document::DataType::T_DOUBLE)) + .addField(dyn_wset_field_s, Wset(document::DataType::T_STRING)) + .addField(dyn_wset_field_n, Wset(document::DataType::T_FLOAT)) .addField(position_field, PositionDataType::getInstance().getId()) - .addField(zcurve_field, DataType::T_LONG)); + .addField(zcurve_field, document::DataType::T_LONG)); return builder.config(); } @@ -176,17 +176,17 @@ BasicType convertDataType(Schema::DataType t) { switch (t) { - case schema::INT32: + case DataType::INT32: return BasicType::INT32; - case schema::INT64: + case DataType::INT64: return BasicType::INT64; - case schema::FLOAT: + case DataType::FLOAT: return BasicType::FLOAT; - case schema::DOUBLE: + case DataType::DOUBLE: return BasicType::DOUBLE; - case schema::STRING: + case DataType::STRING: return BasicType::STRING; - case schema::BOOLEANTREE: + case DataType::BOOLEANTREE: return BasicType::PREDICATE; default: throw std::runtime_error(make_string("Data type %u not handled", (uint32_t)t)); @@ -197,11 +197,11 @@ CollectionType convertCollectionType(Schema::CollectionType ct) { switch (ct) { - case schema::SINGLE: + case schema::CollectionType::SINGLE: return CollectionType::SINGLE; - case schema::ARRAY: + case schema::CollectionType::ARRAY: return CollectionType::ARRAY; - case schema::WEIGHTEDSET: + case schema::CollectionType::WEIGHTEDSET: return CollectionType::WSET; default: throw std::runtime_error(make_string("Collection type %u not handled", (uint32_t)ct)); @@ -247,7 +247,7 @@ struct Fixture { void addAttribute(const char *name, U val, Schema::DataType t, Schema::CollectionType ct) { T *attr = addAttribute<T>(name, t, ct); - if (ct == schema::SINGLE) { + if (ct == schema::CollectionType::SINGLE) { attr->update(lid, val); } else { attr->append(lid, val + 1, dyn_weight); @@ -277,43 +277,43 @@ struct Fixture { Result putRes(meta_store.get().put(gid, bucket_id, timestamp, docSize, inspect.getLid())); lid = putRes.getLid(); ASSERT_TRUE(putRes.ok()); - schema::CollectionType ct = schema::SINGLE; + schema::CollectionType ct = schema::CollectionType::SINGLE; addAttribute<IntegerAttribute>( - dyn_field_i, dyn_value_i, schema::INT32, ct); + dyn_field_i, dyn_value_i, DataType::INT32, ct); addAttribute<FloatingPointAttribute>( - dyn_field_d, dyn_value_d, schema::DOUBLE, ct); + dyn_field_d, dyn_value_d, DataType::DOUBLE, ct); addAttribute<StringAttribute>( - dyn_field_s, dyn_value_s, schema::STRING, ct); + dyn_field_s, dyn_value_s, DataType::STRING, ct); addAttribute<FloatingPointAttribute>( - dyn_field_n, schema::FLOAT, ct); + dyn_field_n, DataType::FLOAT, ct); addAttribute<IntegerAttribute>( - dyn_field_nai, schema::INT32, ct); + dyn_field_nai, DataType::INT32, ct); addAttribute<StringAttribute>( - dyn_field_nas, schema::STRING, ct); + dyn_field_nas, DataType::STRING, ct); addAttribute<IntegerAttribute>( - zcurve_field, dynamic_zcurve_value, schema::INT64, ct); + zcurve_field, dynamic_zcurve_value, DataType::INT64, ct); PredicateAttribute *attr = addAttribute<PredicateAttribute>( - dyn_field_p, schema::BOOLEANTREE, ct); + dyn_field_p, DataType::BOOLEANTREE, ct); attr->getIndex().indexEmptyDocument(lid); attr->commit(); - ct = schema::ARRAY; + ct = schema::CollectionType::ARRAY; addAttribute<IntegerAttribute>( - dyn_arr_field_i, dyn_value_i, schema::INT32, ct); + dyn_arr_field_i, dyn_value_i, DataType::INT32, ct); addAttribute<FloatingPointAttribute>( - dyn_arr_field_d, dyn_value_d, schema::DOUBLE, ct); + dyn_arr_field_d, dyn_value_d, DataType::DOUBLE, ct); addAttribute<StringAttribute>( - dyn_arr_field_s, dyn_value_s, schema::STRING, ct); + dyn_arr_field_s, dyn_value_s, DataType::STRING, ct); addAttribute<FloatingPointAttribute>( - dyn_arr_field_n, schema::FLOAT, ct); - ct = schema::WEIGHTEDSET; + dyn_arr_field_n, DataType::FLOAT, ct); + ct = schema::CollectionType::WEIGHTEDSET; addAttribute<IntegerAttribute>( - dyn_wset_field_i, dyn_value_i, schema::INT32, ct); + dyn_wset_field_i, dyn_value_i, DataType::INT32, ct); addAttribute<FloatingPointAttribute>( - dyn_wset_field_d, dyn_value_d, schema::DOUBLE, ct); + dyn_wset_field_d, dyn_value_d, DataType::DOUBLE, ct); addAttribute<StringAttribute>( - dyn_wset_field_s, dyn_value_s, schema::STRING, ct); + dyn_wset_field_s, dyn_value_s, DataType::STRING, ct); addAttribute<FloatingPointAttribute>( - dyn_wset_field_n, schema::FLOAT, ct); + dyn_wset_field_n, DataType::FLOAT, ct); } }; @@ -407,7 +407,7 @@ TEST_F("require that attributes are patched into stored document", Fixture) { } TEST_F("require that attributes are patched into stored document unless also index field", Fixture) { - f.schema.addIndexField(Schema::IndexField(dyn_field_s, schema::STRING)); + f.schema.addIndexField(Schema::IndexField(dyn_field_s, DataType::STRING)); DocumentMetaData meta_data = f.retriever.getDocumentMetaData(doc_id); Document::UP doc = f.retriever.getDocument(meta_data.lid); ASSERT_TRUE(doc.get()); diff --git a/searchcore/src/tests/proton/server/feedstates_test.cpp b/searchcore/src/tests/proton/server/feedstates_test.cpp index 0d9b6d66564..9f8f7fd9e4a 100644 --- a/searchcore/src/tests/proton/server/feedstates_test.cpp +++ b/searchcore/src/tests/proton/server/feedstates_test.cpp @@ -11,6 +11,7 @@ LOG_SETUP("feedstates_test"); #include <vespa/document/repo/documenttyperepo.h> #include <vespa/searchcore/proton/common/bucketfactory.h> #include <vespa/searchcore/proton/server/feedstates.h> +#include <vespa/searchcore/proton/server/ireplayconfig.h> #include <vespa/searchcore/proton/server/memoryconfigstore.h> #include <vespa/searchcore/proton/test/dummy_feed_view.h> #include <vespa/searchlib/common/serialnum.h> @@ -40,9 +41,9 @@ struct MyFeedView : public test::DummyFeedView { MyFeedView(); ~MyFeedView(); - virtual const DocumentTypeRepo::SP &getDocumentTypeRepo() const + virtual const DocumentTypeRepo::SP &getDocumentTypeRepo() const override { return repo_sp; } - virtual void handleRemove(FeedToken *, const RemoveOperation &) + virtual void handleRemove(FeedToken *, const RemoveOperation &) override { ++remove_handled; } }; @@ -50,12 +51,12 @@ MyFeedView::MyFeedView() : repo_sp(repo.getTypeRepoSp()), remove_handled(0) {} MyFeedView::~MyFeedView() {} struct MyReplayConfig : IReplayConfig { - virtual void replayConfig(SerialNum) {} - virtual void replayWipeHistory(SerialNum, fastos::TimeStamp) {} + virtual void replayConfig(SerialNum) override {} + virtual void replayWipeHistory(SerialNum, fastos::TimeStamp) override {} }; struct InstantExecutor : vespalib::Executor { - virtual Task::UP execute(Task::UP task) { + virtual Task::UP execute(Task::UP task) override { task->run(); return Task::UP(); } diff --git a/searchcore/src/tests/proton/server/health_adapter/health_adapter_test.cpp b/searchcore/src/tests/proton/server/health_adapter/health_adapter_test.cpp index 1957d8fbf33..866ba2c77c0 100644 --- a/searchcore/src/tests/proton/server/health_adapter/health_adapter_test.cpp +++ b/searchcore/src/tests/proton/server/health_adapter/health_adapter_test.cpp @@ -14,7 +14,7 @@ struct MyStatusProducer : public StatusProducer { list.push_back(StatusReport::SP(new StatusReport(StatusReport::Params(comp). state(state).message(msg)))); } - virtual StatusReport::List getStatusReports() const { + virtual StatusReport::List getStatusReports() const override { return list; } }; diff --git a/searchcore/src/tests/proton/server/legacy_attribute_metrics_test.cpp b/searchcore/src/tests/proton/server/legacy_attribute_metrics_test.cpp index 513ad5a03dd..a696855dd72 100644 --- a/searchcore/src/tests/proton/server/legacy_attribute_metrics_test.cpp +++ b/searchcore/src/tests/proton/server/legacy_attribute_metrics_test.cpp @@ -11,7 +11,7 @@ using namespace proton; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; }; int diff --git a/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp b/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp index 387fff27ca9..8b21ed40fc8 100644 --- a/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp +++ b/searchcore/src/tests/proton/server/memoryconfigstore_test.cpp @@ -11,8 +11,10 @@ LOG_SETUP("memoryconfigstore_test"); #include <vespa/vespalib/testkit/testapp.h> #include <vespa/searchcore/proton/common/schemautil.h> -using search::index::Schema; using search::SerialNum; +using search::index::Schema; +using search::index::schema::DataType; + using namespace proton; namespace { @@ -35,12 +37,12 @@ Schema::SP getSchema(int step) { Schema::SP schema(new Schema); - schema->addIndexField(Schema::IndexField("foo1", search::index::schema::STRING)); + schema->addIndexField(Schema::IndexField("foo1", DataType::STRING)); if (step < 2) { - schema->addIndexField(Schema::IndexField("foo2", search::index::schema::STRING)); + schema->addIndexField(Schema::IndexField("foo2", DataType::STRING)); } if (step < 1) { - schema->addIndexField(Schema::IndexField("foo3", search::index::schema::STRING)); + schema->addIndexField(Schema::IndexField("foo3", DataType::STRING)); } return schema; } @@ -113,7 +115,7 @@ TEST("require that wipe history clears previous history schema " "and adds new, identical entry for current serial num") { MemoryConfigStore config_store; Schema::SP history(new Schema); - history->addIndexField(Schema::IndexField("foo", search::index::schema::STRING)); + history->addIndexField(Schema::IndexField("foo", DataType::STRING)); config_store.saveConfig(*getConfig(10), *history, 5); DocumentDBConfig::SP config; config_store.loadConfig(*getConfig(14), 5, config, history); @@ -171,7 +173,7 @@ TEST("require that wipe history clears only portions of history") TEST("require that wipe history does nothing if serial num exists") { MemoryConfigStore config_store; Schema::SP history(new Schema); - history->addIndexField(Schema::IndexField("foo", search::index::schema::STRING)); + history->addIndexField(Schema::IndexField("foo", DataType::STRING)); config_store.saveConfig(*getConfig(10), *history, 5); DocumentDBConfig::SP config; config_store.saveWipeHistoryConfig(5, 0); diff --git a/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp b/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp index a3e5e478c4c..74e43fd4c9c 100644 --- a/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp +++ b/searchcore/src/tests/proton/server/memoryflush/memoryflush_test.cpp @@ -25,14 +25,14 @@ class MyFlushHandler : public IFlushHandler { public: MyFlushHandler(const vespalib::string &name) : IFlushHandler(name) {} // Implements IFlushHandler - virtual std::vector<IFlushTarget::SP> getFlushTargets() { + virtual std::vector<IFlushTarget::SP> getFlushTargets() override { return std::vector<IFlushTarget::SP>(); } - virtual SerialNum getCurrentSerialNumber() const { return 0; } - virtual void flushDone(SerialNum oldestSerial) { (void) oldestSerial; } + virtual SerialNum getCurrentSerialNumber() const override { return 0; } + virtual void flushDone(SerialNum oldestSerial) override { (void) oldestSerial; } virtual void - syncTls(search::SerialNum syncTo) + syncTls(search::SerialNum syncTo) override { (void) syncTo; } diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp index d618bb65f84..dae8cce36e4 100644 --- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp @@ -38,7 +38,7 @@ public: MySearchHandler(const std::string & name = "my", const stringref & reply = MYREPLY) : _name(name), _reply(reply) {} - virtual DocsumReply::UP getDocsums(const DocsumRequest & request) { + virtual DocsumReply::UP getDocsums(const DocsumRequest & request) override { return (request.useRootSlime()) ? std::make_unique<DocsumReply>(createSlimeReply(request.hits.size())) : createOldDocSum(request); @@ -71,7 +71,7 @@ public: virtual search::engine::SearchReply::UP match( const ISearchHandler::SP &, const search::engine::SearchRequest &, - vespalib::ThreadBundle &) const { + vespalib::ThreadBundle &) const override { return SearchReply::UP(new SearchReply); } }; @@ -84,7 +84,7 @@ private: public: MyDocsumClient(); ~MyDocsumClient(); - void getDocsumsDone(DocsumReply::UP reply) { + void getDocsumsDone(DocsumReply::UP reply) override { vespalib::MonitorGuard guard(_monitor); _reply = std::move(reply); guard.broadcast(); @@ -116,7 +116,7 @@ private: void requireThatSlimeInterfaceWorksFine(); void requireThatRPCInterfaceWorks(); public: - int Main(); + int Main() override; }; DocsumRequest::UP diff --git a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp index fcbf4e3c241..2c5e119ecbe 100644 --- a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp +++ b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp @@ -18,6 +18,9 @@ const char *invalid_feature = "invalid_feature_name and format"; using namespace search::fef::indexproperties; using namespace search::index; +using search::index::schema::CollectionType; +using search::index::schema::DataType; + struct Writer { FILE *file; Writer(const std::string &file_name) { @@ -185,10 +188,10 @@ struct EmptyModel : Model {}; struct SimpleModel : Model { SimpleModel() : Model() { - index("title", schema::STRING, schema::SINGLE); - index("list", schema::STRING, schema::ARRAY); - index("keywords", schema::STRING, schema::WEIGHTEDSET); - attribute("date", schema::INT32, schema::SINGLE); + index("title", DataType::STRING, CollectionType::SINGLE); + index("list", DataType::STRING, CollectionType::ARRAY); + index("keywords", DataType::STRING, CollectionType::WEIGHTEDSET); + attribute("date", DataType::INT32, CollectionType::SINGLE); imported_attribute("imported_attr"); constants["my_tensor"] = "tensor(x{},y{})"; } @@ -196,8 +199,8 @@ struct SimpleModel : Model { struct ShadowModel : Model { ShadowModel() : Model() { - index("both", schema::STRING, schema::SINGLE); - attribute("both", schema::STRING, schema::SINGLE); + index("both", DataType::STRING, CollectionType::SINGLE); + attribute("both", DataType::STRING, CollectionType::SINGLE); } }; diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/search.h b/searchcore/src/vespa/searchcore/fdispatch/common/search.h index b823dfdf31a..52c30b7a9d7 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/common/search.h +++ b/searchcore/src/vespa/searchcore/fdispatch/common/search.h @@ -274,30 +274,30 @@ public: } - virtual uint32_t GetDataSetID() + virtual uint32_t GetDataSetID() override { return _dataSetID; } - virtual FastS_SearchInfo *GetSearchInfo() + virtual FastS_SearchInfo *GetSearchInfo() override { return &_searchInfo; } - virtual RetCode setSearchRequest(const search::engine::SearchRequest * request) + virtual RetCode setSearchRequest(const search::engine::SearchRequest * request) override { _queryArgs = request; return RET_OK; } - virtual RetCode SetGetDocsumArgs(search::docsummary::GetDocsumArgs *docsumArgs) + virtual RetCode SetGetDocsumArgs(search::docsummary::GetDocsumArgs *docsumArgs) override { _docsumArgs = docsumArgs; return RET_OK; } virtual RetCode Search(uint32_t searchOffset, - uint32_t maxhits, uint32_t minhits = 0) + uint32_t maxhits, uint32_t minhits = 0) override { (void) minhits; _searchInfo._searchOffset = searchOffset; @@ -305,50 +305,50 @@ public: return RET_OK; } - virtual RetCode ProcessQueryDone() + virtual RetCode ProcessQueryDone() override { return RET_OK; } - virtual FastS_QueryResult *GetQueryResult() + virtual FastS_QueryResult *GetQueryResult() override { return &_queryResult; } - virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) + virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override { (void) hits; (void) hitcnt; return RET_OK; } - virtual RetCode ProcessDocsumsDone() + virtual RetCode ProcessDocsumsDone() override { return RET_OK; } - virtual FastS_DocsumsResult *GetDocsumsResult() + virtual FastS_DocsumsResult *GetDocsumsResult() override { return &_docsumsResult; } - virtual search::engine::ErrorCode GetErrorCode() + virtual search::engine::ErrorCode GetErrorCode() override { return _errorCode; } - virtual const char *GetErrorMessage() + virtual const char *GetErrorMessage() override { if (_errorMessage != NULL) return _errorMessage; return search::engine::getStringFromErrorCode(_errorCode); } - virtual void Interrupt() + virtual void Interrupt() override { } - virtual void Free() + virtual void Free() override { delete this; } @@ -373,10 +373,10 @@ public: } virtual ~FastS_FailedSearch() {} - virtual bool IsAsync() { return _async; } + virtual bool IsAsync() override { return _async; } virtual RetCode SetAsyncArgs(FastS_ISearchOwner *owner, - FastS_SearchContext context) + FastS_SearchContext context) override { (void) owner; (void) context; @@ -392,10 +392,10 @@ public: FastS_SyncSearch(uint32_t dataSetID) : FastS_SearchBase(dataSetID) {} - bool IsAsync() { return false; } + bool IsAsync() override { return false; } virtual RetCode SetAsyncArgs(FastS_ISearchOwner *, - FastS_SearchContext) + FastS_SearchContext) override { return RET_ERROR; } @@ -419,10 +419,10 @@ public: _searchOwner(NULL), _searchContext(FastS_SearchContext()) {} - bool IsAsync() { return true; } + bool IsAsync() override { return true; } virtual RetCode SetAsyncArgs(FastS_ISearchOwner *owner, - FastS_SearchContext context) + FastS_SearchContext context) override { _searchOwner = owner; _searchContext = context; @@ -445,24 +445,24 @@ public: explicit FastS_SearchAdapter(FastS_ISearch *search); virtual ~FastS_SearchAdapter(); - virtual bool IsAsync(); - virtual uint32_t GetDataSetID(); - virtual FastS_SearchInfo *GetSearchInfo(); + virtual bool IsAsync() override; + virtual uint32_t GetDataSetID() override; + virtual FastS_SearchInfo *GetSearchInfo() override; virtual RetCode SetAsyncArgs(FastS_ISearchOwner *owner, - FastS_SearchContext context); - virtual RetCode setSearchRequest(const search::engine::SearchRequest * request); - virtual RetCode SetGetDocsumArgs(search::docsummary::GetDocsumArgs *docsumArgs); + FastS_SearchContext context) override; + virtual RetCode setSearchRequest(const search::engine::SearchRequest * request) override; + virtual RetCode SetGetDocsumArgs(search::docsummary::GetDocsumArgs *docsumArgs) override; virtual RetCode Search(uint32_t searchOffset, - uint32_t maxhits, uint32_t minhits = 0); - virtual RetCode ProcessQueryDone(); - virtual FastS_QueryResult *GetQueryResult(); - virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt); - virtual RetCode ProcessDocsumsDone(); - virtual FastS_DocsumsResult *GetDocsumsResult(); - virtual search::engine::ErrorCode GetErrorCode(); - virtual const char *GetErrorMessage(); - virtual void Interrupt(); - virtual void Free(); + uint32_t maxhits, uint32_t minhits = 0) override; + virtual RetCode ProcessQueryDone() override; + virtual FastS_QueryResult *GetQueryResult() override; + virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override; + virtual RetCode ProcessDocsumsDone() override; + virtual FastS_DocsumsResult *GetDocsumsResult() override; + virtual search::engine::ErrorCode GetErrorCode() override; + virtual const char *GetErrorMessage() override; + virtual void Interrupt() override; + virtual void Free() override; }; //---------------------------------------------------------------- @@ -490,18 +490,18 @@ public: void Wait() { _cond.Wait(); } void Signal() { _cond.Signal(); } - virtual void DoneQuery(FastS_ISearch *, FastS_SearchContext); - virtual void DoneDocsums(FastS_ISearch *, FastS_SearchContext); + virtual void DoneQuery(FastS_ISearch *, FastS_SearchContext) override; + virtual void DoneDocsums(FastS_ISearch *, FastS_SearchContext) override; void WaitQueryDone(); void WaitDocsumsDone(); - virtual bool IsAsync(); + virtual bool IsAsync() override; virtual RetCode SetAsyncArgs(FastS_ISearchOwner *owner, - FastS_SearchContext context); + FastS_SearchContext context) override; virtual RetCode Search(uint32_t searchOffset, - uint32_t maxhits, uint32_t minhits = 0); - virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt); + uint32_t maxhits, uint32_t minhits = 0) override; + virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override; }; //---------------------------------------------------------------- diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/docsumadapter.h b/searchcore/src/vespa/searchcore/fdispatch/program/docsumadapter.h index a168ca1e5a1..f36480587f5 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/docsumadapter.h +++ b/searchcore/src/vespa/searchcore/fdispatch/program/docsumadapter.h @@ -39,7 +39,7 @@ private: void writeLog(); void cleanup(); - virtual void Run(FastOS_ThreadInterface *, void *); + virtual void Run(FastOS_ThreadInterface *, void *) override; public: DocsumAdapter(FastS_AppContext *appCtx, diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/engineadapter.h b/searchcore/src/vespa/searchcore/fdispatch/program/engineadapter.h index 2667664a7db..d081e2f662b 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/engineadapter.h +++ b/searchcore/src/vespa/searchcore/fdispatch/program/engineadapter.h @@ -38,9 +38,9 @@ public: EngineAdapter(FastS_AppContext *appCtx, FastOS_ThreadPool *threadPool); - virtual SearchReply::UP search(SearchRequest::Source request, SearchClient &client); - virtual DocsumReply::UP getDocsums(DocsumRequest::Source request, DocsumClient &client); - virtual MonitorReply::UP ping(MonitorRequest::UP request, MonitorClient &client); + virtual SearchReply::UP search(SearchRequest::Source request, SearchClient &client) override; + virtual DocsumReply::UP getDocsums(DocsumRequest::Source request, DocsumClient &client) override; + virtual MonitorReply::UP ping(MonitorRequest::UP request, MonitorClient &client) override; }; } // namespace fdispatch diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h b/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h index fd13188b540..00c10d5cfa9 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h +++ b/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h @@ -35,7 +35,7 @@ private: FastS_FNETAdapter &self; MyTask(FNET_Scheduler *scheduler, FastS_FNETAdapter &self_in) : FNET_Task(scheduler), self(self_in) {} - virtual void PerformTask() { + virtual void PerformTask() override { self.perform(); ScheduleNow(); } @@ -88,16 +88,16 @@ private: unsigned int _checkLimit; int _healthPort; std::atomic<bool> _needRestart; - void configure(std::unique_ptr<FdispatchrcConfig> cfg); + void configure(std::unique_ptr<FdispatchrcConfig> cfg) override; public: // Implements FastS_AppContext - virtual FNET_Transport *GetFNETTransport(); - virtual FNET_Scheduler *GetFNETScheduler(); - virtual FastS_NodeManager *GetNodeManager(); - virtual FastS_DataSetCollection *GetDataSetCollection(); - virtual FastOS_ThreadPool *GetThreadPool(); - virtual void logPerformance(); - virtual uint32_t getDispatchLevel(); + virtual FNET_Transport *GetFNETTransport() override; + virtual FNET_Scheduler *GetFNETScheduler() override; + virtual FastS_NodeManager *GetNodeManager() override; + virtual FastS_DataSetCollection *GetDataSetCollection() override; + virtual FastOS_ThreadPool *GetThreadPool() override; + virtual void logPerformance() override; + virtual uint32_t getDispatchLevel() override; bool CheckTempFail(void); bool Failed(void); bool Init(void); diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/rpc.h b/searchcore/src/vespa/searchcore/fdispatch/program/rpc.h index 341e9765d10..dad78a00b13 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/rpc.h +++ b/searchcore/src/vespa/searchcore/fdispatch/program/rpc.h @@ -17,11 +17,11 @@ public: // Register RPC Methods - virtual void RegisterMethods(FRT_ReflectionBuilder *rb); + virtual void RegisterMethods(FRT_ReflectionBuilder *rb) override; // methods registered by superclass - virtual void RPC_GetNodeType(FRT_RPCRequest *req); + virtual void RPC_GetNodeType(FRT_RPCRequest *req) override; // methods registered by us diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/searchadapter.h b/searchcore/src/vespa/searchcore/fdispatch/program/searchadapter.h index 62667f1cb14..bcbe0c5e75c 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/searchadapter.h +++ b/searchcore/src/vespa/searchcore/fdispatch/program/searchadapter.h @@ -35,7 +35,7 @@ private: void writeLog(); void cleanup(); - virtual void Run(FastOS_ThreadInterface *, void *); + virtual void Run(FastOS_ThreadInterface *, void *) override; public: SearchAdapter(FastS_AppContext *appCtx, diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_dataset.h b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_dataset.h index 9f55f336f43..7f5fbd50298 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_dataset.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_dataset.h @@ -36,7 +36,7 @@ public: _dataset(dataset), _delay(delay) {} - void PerformTask(); + void PerformTask() override; }; @@ -55,16 +55,16 @@ public: FNET_Transport *GetTransport() { return _transport; } // typesafe down-cast - virtual FastS_FNET_DataSet *GetFNETDataSet() { return this; } + virtual FastS_FNET_DataSet *GetFNETDataSet() override { return this; } // common dataset API - virtual bool AddEngine(FastS_EngineDesc *desc); - virtual void ConfigDone(FastS_DataSetCollection *); - virtual void ScheduleCheckBad(); + virtual bool AddEngine(FastS_EngineDesc *desc) override; + virtual void ConfigDone(FastS_DataSetCollection *) override; + virtual void ScheduleCheckBad() override; virtual FastS_ISearch *CreateSearch(FastS_DataSetCollection *dsc, FastS_TimeKeeper *timeKeeper, - bool async); - virtual void Free(); + bool async) override; + virtual void Free() override; bool isGoodRow(uint32_t rowId); }; diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.h b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.h index 39fed5db513..068c072e844 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_engine.h @@ -16,7 +16,7 @@ class FastS_StaticMonitorQuery : public FS4Packet_MONITORQUERYX FastOS_Mutex _lock; int _refcnt; public: - virtual void Free(); + virtual void Free() override; bool getBusy(void) const { @@ -56,7 +56,7 @@ public: WarnTask(FNET_Scheduler *scheduler, FastS_FNET_Engine *engine) : FNET_Task(scheduler), _engine(engine) {} - virtual void PerformTask(); + virtual void PerformTask() override; }; friend class FastS_FNET_Engine::WarnTask; @@ -72,7 +72,7 @@ public: ConnectTask(FNET_Scheduler *scheduler, FastS_FNET_Engine *engine) : FNET_Task(scheduler), _engine(engine) {} - virtual void PerformTask(); + virtual void PerformTask() override; }; friend class FastS_FNET_Engine::ConnectTask; @@ -104,19 +104,19 @@ public: // handle FNET admin packets //-------------------------- - virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context); + virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context) override; // common engine API //------------------ - virtual void LockEngine() { _lock.Lock(); } - virtual void UnlockEngine() { _lock.Unlock(); } - virtual void Ping(); - virtual void HandleClearedBad(); - virtual void HandleUp(); + virtual void LockEngine() override { _lock.Lock(); } + virtual void UnlockEngine() override { _lock.Unlock(); } + virtual void Ping() override; + virtual void HandleClearedBad() override; + virtual void HandleUp() override; // typesafe "down"-cast //--------------------- - virtual FastS_FNET_Engine *GetFNETEngine() { return this; } + virtual FastS_FNET_Engine *GetFNETEngine() override { return this; } const char *getHostName() const { return _hostName.c_str(); } int getPortNumber() const { return _portNumber; } diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h index eaa166daba8..af747d887e0 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/fnet_search.h @@ -154,7 +154,7 @@ public: return (_channel == NULL) ? packet->Free(), false : _channel->Send(packet); } - virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context); + virtual HP_RetCode HandlePacket(FNET_Packet *packet, FNET_Context context) override; }; @@ -206,7 +206,7 @@ public: Timeout(FNET_Scheduler *scheduler, FastS_FNET_Search *search) : FNET_Task(scheduler), _search(search) {} - void PerformTask(); + void PerformTask() override; }; enum FNETMode { @@ -311,12 +311,12 @@ public: // *** API methods -- BEGIN *** - virtual FastS_SearchInfo *GetSearchInfo() { return _util.GetSearchInfo(); } + virtual FastS_SearchInfo *GetSearchInfo() override { return _util.GetSearchInfo(); } - virtual RetCode Search(uint32_t searchOffset, uint32_t maxhits, uint32_t minhits = 0); - virtual RetCode ProcessQueryDone(); - virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt); - virtual RetCode ProcessDocsumsDone(); + virtual RetCode Search(uint32_t searchOffset, uint32_t maxhits, uint32_t minhits = 0) override; + virtual RetCode ProcessQueryDone() override; + virtual RetCode GetDocsums(const FastS_hitresult *hits, uint32_t hitcnt) override; + virtual RetCode ProcessDocsumsDone() override; // *** API methods -- END *** @@ -387,7 +387,7 @@ public: _search.SetAsyncArgs(this, FastS_SearchContext()); } virtual ~FastS_Sync_FNET_Search(); - virtual void Free() { delete this; } + virtual void Free() override { delete this; } }; //----------------------------------------------------------------- diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h index c51ec6b1e09..8543456b4f6 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h @@ -51,7 +51,7 @@ private: protected: void SetFailed() { _failed = true; } - void configure(std::unique_ptr<PartitionsConfig> cfg); + void configure(std::unique_ptr<PartitionsConfig> cfg) override; public: FastS_NodeManager(vespalib::SimpleComponentConfigProducer &componentConfig, diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/plain_dataset.h b/searchcore/src/vespa/searchcore/fdispatch/search/plain_dataset.h index 9f7b4cf034f..62aa7b33166 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/plain_dataset.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/plain_dataset.h @@ -189,7 +189,7 @@ public: void LinkInPart_HasLock(FastS_EngineBase *engine); void LinkOutPart_HasLock(FastS_EngineBase *engine); - virtual ChildInfo getChildInfo() const; + virtual ChildInfo getChildInfo() const override; uint32_t getMPP(void) const { return _partMap._mpp; } double getMonitorInterval(void) const { return _monitorInterval; } @@ -204,13 +204,13 @@ public: // API //---- - virtual uint32_t CalculateQueueLens_HasLock(uint32_t &dispatchnodes); - virtual bool AreEnginesReady(); + virtual uint32_t CalculateQueueLens_HasLock(uint32_t &dispatchnodes) override; + virtual bool AreEnginesReady() override; virtual void Ping(); // Downcast //--------- - virtual FastS_PlainDataSet * GetPlainDataSet(void) { return this; } + virtual FastS_PlainDataSet * GetPlainDataSet(void) override { return this; } template <class FUN> FUN ForEachEngine(FUN fun) { diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/query.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/query.cpp index bce23483a56..a7db4c21bd8 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/query.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/search/query.cpp @@ -102,7 +102,7 @@ public: virtual void visitProperty(const search::fef::Property::Value &key, - const search::fef::Property &values) + const search::fef::Property &values) override { // Account for std::map element size _size += _mapFuzz; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt index 723189a3544..c4e9e4f2969 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt @@ -7,6 +7,7 @@ vespa_add_library(searchcore_attribute STATIC attribute_directory.cpp attribute_factory.cpp attribute_initializer.cpp + attribute_initializer_result.cpp attribute_manager_explorer.cpp attribute_manager_initializer.cpp attribute_populator.cpp diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.h index b00a4a1cc5a..91d45ba009f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_directory.h @@ -8,6 +8,7 @@ #include <memory> #include <mutex> #include <condition_variable> +#include <vespa/fastos/time.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.h index 62eeef3bfeb..92ad73cefdd 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_factory.h @@ -17,11 +17,11 @@ public: AttributeFactory(); // Implements IAttributeFactory - virtual search::AttributeVector::SP create(const vespalib::string &name, - const search::attribute::Config &cfg) const; + virtual AttributeVectorSP create(const vespalib::string &name, + const search::attribute::Config &cfg) const override; - virtual void setupEmpty(const search::AttributeVector::SP &vec, - search::SerialNum serialNum) const; + virtual void setupEmpty(const AttributeVectorSP &vec, + search::SerialNum serialNum) const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp index 1ce71968da0..7b009ef4b77 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp @@ -3,11 +3,14 @@ #include "attribute_initializer.h" #include "attributedisklayout.h" #include "attribute_directory.h" +#include "i_attribute_factory.h" #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/vespalib/data/fileheader.h> +#include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/searchlib/util/fileutil.h> #include <vespa/searchlib/attribute/attribute_header.h> +#include <vespa/searchlib/attribute/attributevector.h> #include <vespa/fastos/file.h> #include <vespa/log/log.h> @@ -165,7 +168,7 @@ AttributeInitializer::tryLoadAttribute() const { search::SerialNum serialNum = _attrDir->getFlushedSerialNum(); vespalib::string attrFileName = _attrDir->getAttributeFileName(serialNum); - AttributeVector::SP attr = _factory.create(attrFileName, _cfg); + AttributeVector::SP attr = _factory.create(attrFileName, _spec.getConfig()); if (serialNum != 0) { AttributeHeader header = extractHeader(attrFileName); if (header.getCreateSerialNum() > _currentSerialNum || !headerTypeOK(header, attr->getConfig()) || (serialNum < _currentSerialNum)) { @@ -182,7 +185,7 @@ AttributeInitializer::tryLoadAttribute() const } bool -AttributeInitializer::loadAttribute(const AttributeVector::SP &attr, +AttributeInitializer::loadAttribute(const AttributeVectorSP &attr, search::SerialNum serialNum) const { assert(attr->hasLoadData()); @@ -203,7 +206,7 @@ AttributeInitializer::loadAttribute(const AttributeVector::SP &attr, } void -AttributeInitializer::setupEmptyAttribute(AttributeVector::SP &attr, +AttributeInitializer::setupEmptyAttribute(AttributeVectorSP &attr, search::SerialNum serialNum, const AttributeHeader &header) const { @@ -226,19 +229,19 @@ AttributeVector::SP AttributeInitializer::createAndSetupEmptyAttribute() const { vespalib::string attrFileName = _attrDir->getAttributeFileName(0); - AttributeVector::SP attr = _factory.create(attrFileName, _cfg); + AttributeVector::SP attr = _factory.create(attrFileName, _spec.getConfig()); _factory.setupEmpty(attr, _currentSerialNum); return attr; } AttributeInitializer::AttributeInitializer(const std::shared_ptr<AttributeDirectory> &attrDir, const vespalib::string &documentSubDbName, - const search::attribute::Config &cfg, + const AttributeSpec &spec, uint64_t currentSerialNum, const IAttributeFactory &factory) : _attrDir(attrDir), _documentSubDbName(documentSubDbName), - _cfg(cfg), + _spec(spec), _currentSerialNum(currentSerialNum), _factory(factory) { @@ -246,13 +249,13 @@ AttributeInitializer::AttributeInitializer(const std::shared_ptr<AttributeDirect AttributeInitializer::~AttributeInitializer() {} -search::AttributeVector::SP +AttributeInitializerResult AttributeInitializer::init() const { if (!_attrDir->empty()) { - return tryLoadAttribute(); + return AttributeInitializerResult(tryLoadAttribute(), _spec.getHideFromReading(), _spec.getHideFromWriting()); } else { - return createAndSetupEmptyAttribute(); + return AttributeInitializerResult(createAndSetupEmptyAttribute(), _spec.getHideFromReading(), _spec.getHideFromWriting()); } } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h index 8643fd4c7df..7b2e194a990 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h @@ -2,17 +2,20 @@ #pragma once -#include "i_attribute_factory.h" -#include <vespa/searchlib/attribute/attributevector.h> +#include "attribute_spec.h" +#include "attribute_initializer_result.h" #include <vespa/vespalib/stllike/string.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/searchcommon/attribute/persistent_predicate_params.h> -namespace search { namespace attribute { class AttributeHeader; } } +namespace search { +namespace attribute { class AttributeHeader; } +} namespace proton { class AttributeDirectory; +class IAttributeFactory; /** * Class used by an attribute manager to initialize and load attribute vectors from disk. @@ -23,32 +26,33 @@ public: typedef std::unique_ptr<AttributeInitializer> UP; private: + using AttributeVectorSP = std::shared_ptr<search::AttributeVector>; std::shared_ptr<AttributeDirectory> _attrDir; const vespalib::string _documentSubDbName; - const search::attribute::Config _cfg; + const AttributeSpec _spec; const uint64_t _currentSerialNum; const IAttributeFactory &_factory; - search::AttributeVector::SP tryLoadAttribute() const; + AttributeVectorSP tryLoadAttribute() const; - bool loadAttribute(const search::AttributeVector::SP &attr, + bool loadAttribute(const AttributeVectorSP &attr, search::SerialNum serialNum) const; - void setupEmptyAttribute(search::AttributeVector::SP &attr, + void setupEmptyAttribute(AttributeVectorSP &attr, search::SerialNum serialNum, const search::attribute::AttributeHeader &header) const; - search::AttributeVector::SP createAndSetupEmptyAttribute() const; + AttributeVectorSP createAndSetupEmptyAttribute() const; public: AttributeInitializer(const std::shared_ptr<AttributeDirectory> &attrDir, const vespalib::string &documentSubDbName, - const search::attribute::Config &cfg, + const AttributeSpec &spec, uint64_t currentSerialNum, const IAttributeFactory &factory); ~AttributeInitializer(); - search::AttributeVector::SP init() const; + AttributeInitializerResult init() const; uint64_t getCurrentSerialNum() const { return _currentSerialNum; } }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer_result.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer_result.cpp new file mode 100644 index 00000000000..21b88f33f21 --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer_result.cpp @@ -0,0 +1,21 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "attribute_initializer_result.h" + + +namespace proton { + +AttributeInitializerResult::AttributeInitializerResult(const AttributeVectorSP &attr, + bool hideFromReading, + bool hideFromWriting) + : _attr(attr), + _hideFromReading(hideFromReading), + _hideFromWriting(hideFromWriting) +{ +} + +AttributeInitializerResult::~AttributeInitializerResult() +{ +} + +} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer_result.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer_result.h new file mode 100644 index 00000000000..0a6b6e607d7 --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer_result.h @@ -0,0 +1,33 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include <memory> + +namespace search { +class AttributeVector; +} + +namespace proton { + +/** + * Class representing an initialized attribute. + */ +class AttributeInitializerResult +{ + using AttributeVectorSP = std::shared_ptr<search::AttributeVector>; + AttributeVectorSP _attr; + bool _hideFromReading; // Delayed removal of attribute aspect + bool _hideFromWriting; // Delayed addition of attribute aspect +public: + AttributeInitializerResult(const AttributeVectorSP &attr, + bool hideFromReading, + bool hideFromWriting); + ~AttributeInitializerResult(); + bool getHideFromReading() const { return _hideFromReading; } + bool getHideFromWriting() const { return _hideFromWriting; } + const AttributeVectorSP &getAttribute() const { return _attr; } + operator bool() const { return static_cast<bool>(_attr); } +}; + +} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.cpp index d6792e3ab95..304df4aab40 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_explorer.cpp @@ -8,6 +8,7 @@ LOG_SETUP(".proton.attribute.attribute_manager_explorer"); #include "attribute_vector_explorer.h" #include "exclusive_attribute_read_accessor.h" #include <vespa/searchlib/attribute/attributeguard.h> +#include <vespa/searchlib/attribute/attributevector.h> using vespalib::slime::Inserter; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.cpp index 939db1ceac8..640171a39b0 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.cpp @@ -33,12 +33,12 @@ public: {} virtual void run() override { - AttributeVector::SP attribute = _initializer->init(); - if (attribute) { - AttributesInitializerBase::considerPadAttribute(*attribute, + AttributeInitializerResult result = _initializer->init(); + if (result) { + AttributesInitializerBase::considerPadAttribute(*result.getAttribute(), _initializer->getCurrentSerialNum(), _documentMetaStore->getCommittedDocIdLimit()); - _result.add(attribute); + _result.add(result); } } }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp index dadf5d41912..8d2665c0c3f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp @@ -7,6 +7,7 @@ LOG_SETUP(".proton.attribute.attribute_populator"); #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchlib/common/idestructorcallback.h> +#include <vespa/searchlib/attribute/attributevector.h> using search::IDestructorCallback; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp index 5ca3ee75270..d0e59cdbda5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp @@ -7,6 +7,7 @@ LOG_SETUP(".proton.attribute.attribute_vector_explorer"); #include "attribute_vector_explorer.h" #include <vespa/searchlib/attribute/enumstorebase.h> #include <vespa/searchlib/attribute/multi_value_mapping.h> +#include <vespa/searchlib/attribute/attributevector.h> #include <vespa/vespalib/data/slime/cursor.h> using search::attribute::Status; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp index fc0649eedbd..bb9a5ad0a08 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp @@ -7,9 +7,11 @@ #include "imported_attributes_context.h" #include "imported_attributes_repo.h" #include "sequential_attributes_initializer.h" +#include "flushableattribute.h" #include <vespa/searchlib/attribute/attributecontext.h> #include <vespa/searchlib/attribute/interlock.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> +#include <vespa/searchlib/attribute/attributevector.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/vespalib/util/exceptions.h> @@ -21,13 +23,13 @@ using search::AttributeContext; using search::AttributeEnumGuard; using search::AttributeGuard; using search::AttributeVector; -using search::IndexMetaInfo; using search::TuneFileAttributes; using search::attribute::IAttributeContext; using search::attribute::IAttributeVector; using search::common::FileHeaderContext; using search::index::Schema; using search::attribute::BasicType; +using searchcorespi::IFlushTarget; namespace proton { @@ -61,19 +63,56 @@ bool matchingTypes(const AttributeVector::SP &av, const search::attribute::Confi } +AttributeManager::AttributeWrap::AttributeWrap(const AttributeVectorSP & a, + bool isExtra_, + bool hideFromReading, + bool hideFromWriting) + : _attr(a), + _isExtra(isExtra_), + _hideFromReading(hideFromReading), + _hideFromWriting(hideFromWriting) +{ +} + +AttributeManager::AttributeWrap::AttributeWrap() + : _attr(), + _isExtra(false), + _hideFromReading(false), + _hideFromWriting(false) +{ +} + +AttributeManager::AttributeWrap::~AttributeWrap() +{ +} + +AttributeManager::AttributeWrap +AttributeManager::AttributeWrap::extraAttribute(const AttributeVectorSP &a) +{ + return AttributeWrap(a, true, false, false); +} + +AttributeManager::AttributeWrap +AttributeManager::AttributeWrap::normalAttribute(const AttributeVectorSP &a, bool hideFromReading, bool hideFromWriting) +{ + return AttributeWrap(a, false, hideFromReading, hideFromWriting); +} + + AttributeVector::SP -AttributeManager::internalAddAttribute(const vespalib::string &name, - const Config &cfg, +AttributeManager::internalAddAttribute(const AttributeSpec &spec, uint64_t serialNum, const IAttributeFactory &factory) { - AttributeInitializer initializer(_diskLayout->createAttributeDir(name), _documentSubDbName, cfg, serialNum, factory); - AttributeVector::SP attr = initializer.init(); - if (attr.get() != NULL) { - attr->setInterlock(_interlock); - addAttribute(attr); + AttributeInitializer initializer(_diskLayout->createAttributeDir(spec.getName()), _documentSubDbName, spec, serialNum, factory); + AttributeInitializerResult result = initializer.init(); + if (result) { + result.getAttribute()->setInterlock(_interlock); + assert(result.getHideFromReading() == spec.getHideFromReading()); + assert(result.getHideFromWriting() == spec.getHideFromWriting()); + addAttribute(AttributeWrap::normalAttribute(result.getAttribute(), result.getHideFromReading(), result.getHideFromWriting())); } - return attr; + return result.getAttribute(); } void @@ -120,7 +159,7 @@ AttributeManager::transferExistingAttributes(const AttributeManager &currMgr, if (matchingTypes(av, aspec.getConfig())) { // transfer attribute LOG(debug, "Transferring attribute vector '%s' with %u docs and serial number %lu from current manager", av->getName().c_str(), av->getNumDocs(), av->getStatus().getLastSyncToken()); - addAttribute(av); + addAttribute(AttributeWrap::normalAttribute(av, aspec.getHideFromReading(), aspec.getHideFromWriting())); } else { toBeAdded.push_back(aspec); } @@ -138,7 +177,7 @@ AttributeManager::addNewAttributes(const Spec &newSpec, AttributeInitializer::UP initializer = std::make_unique<AttributeInitializer>(_diskLayout->createAttributeDir(aspec.getName()), _documentSubDbName, - aspec.getConfig(), newSpec.getCurrentSerialNum(), *_factory); + aspec, newSpec.getCurrentSerialNum(), *_factory); initializerRegistry.add(std::move(initializer)); // TODO: Might want to use hardlinks to make attribute vector @@ -239,19 +278,18 @@ AttributeManager::AttributeManager(const AttributeManager &currMgr, AttributeManager::~AttributeManager() { } AttributeVector::SP -AttributeManager::addAttribute(const vespalib::string &name, - const Config &cfg, - uint64_t serialNum) +AttributeManager::addAttribute(const AttributeSpec &spec, uint64_t serialNum) { - return internalAddAttribute(name, cfg, serialNum, *_factory); + return internalAddAttribute(spec, serialNum, *_factory); } void -AttributeManager::addInitializedAttributes(const std::vector<search::AttributeVector::SP> &attributes) +AttributeManager::addInitializedAttributes(const std::vector<AttributeInitializerResult> &attributes) { - for (const auto &attribute : attributes) { - attribute->setInterlock(_interlock); - addAttribute(attribute); + for (const auto &result : attributes) { + assert(result); + result.getAttribute()->setInterlock(_interlock); + addAttribute(AttributeWrap::normalAttribute(result.getAttribute(), result.getHideFromReading(), result.getHideFromWriting())); } } @@ -259,7 +297,7 @@ void AttributeManager::addExtraAttribute(const AttributeVector::SP &attribute) { attribute->setInterlock(_interlock); - addAttribute(AttributeWrap(attribute, true)); + addAttribute(AttributeWrap::extraAttribute(attribute)); } void diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h index 6cd55517256..d662dd5c0a5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h @@ -8,14 +8,14 @@ #include "i_attribute_initializer_registry.h" #include <set> #include <vespa/searchlib/common/tunefileinfo.h> -#include <vespa/searchcore/proton/attribute/flushableattribute.h> -#include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchcommon/common/schema.h> #include <vespa/searchcore/proton/common/hw_info.h> namespace search { +namespace attribute { class Interlock; } + namespace common { @@ -25,10 +25,16 @@ class FileHeaderContext; } +namespace searchcorespi +{ +class IFlushTarget; +} + namespace proton { class AttributeDiskLayout; +class FlushableAttribute; /** * Specialized attribute manager for proton. @@ -39,24 +45,31 @@ private: typedef search::attribute::Config Config; typedef search::SerialNum SerialNum; typedef AttributeCollectionSpec Spec; + using FlushableAttributeSP = std::shared_ptr<FlushableAttribute>; + using IFlushTargetSP = std::shared_ptr<searchcorespi::IFlushTarget>; + using AttributeVectorSP = std::shared_ptr<search::AttributeVector>; class AttributeWrap { private: - search::AttributeVector::SP _attr; + AttributeVectorSP _attr; bool _isExtra; + bool _hideFromReading; + bool _hideFromWriting; + AttributeWrap(const AttributeVectorSP & a, bool isExtra_, bool hideFromReading, bool hideFromWriting); public: - AttributeWrap() : _attr(), _isExtra(false) { } - AttributeWrap(const search::AttributeVector::SP & a, bool isExtra_ = false) : - _attr(a), - _isExtra(isExtra_) - { } + AttributeWrap(); + ~AttributeWrap(); + static AttributeWrap extraAttribute(const AttributeVectorSP &a); + static AttributeWrap normalAttribute(const AttributeVectorSP &a, bool hideFromReading, bool hideFromWriting); bool isExtra() const { return _isExtra; } - const search::AttributeVector::SP getAttribute() const { return _attr; } + const AttributeVectorSP getAttribute() const { return _attr; } + bool getHideFromReading() const { return _hideFromReading; } + bool getHideFromWriting() const { return _hideFromWriting; } }; typedef vespalib::hash_map<vespalib::string, AttributeWrap> AttributeMap; - typedef vespalib::hash_map<vespalib::string, FlushableAttribute::SP> FlushableMap; + typedef vespalib::hash_map<vespalib::string, FlushableAttributeSP> FlushableMap; AttributeMap _attributes; FlushableMap _flushables; @@ -71,16 +84,15 @@ private: HwInfo _hwInfo; std::unique_ptr<ImportedAttributesRepo> _importedAttributes; - search::AttributeVector::SP internalAddAttribute(const vespalib::string &name, - const Config &cfg, + AttributeVectorSP internalAddAttribute(const AttributeSpec &spec, uint64_t serialNum, const IAttributeFactory &factory); void addAttribute(const AttributeWrap &attribute); - search::AttributeVector::SP findAttribute(const vespalib::string &name) const; + AttributeVectorSP findAttribute(const vespalib::string &name) const; - FlushableAttribute::SP findFlushable(const vespalib::string &name) const; + FlushableAttributeSP findFlushable(const vespalib::string &name) const; void transferExistingAttributes(const AttributeManager &currMgr, const Spec &newSpec, @@ -117,17 +129,15 @@ public: IAttributeInitializerRegistry &initializerRegistry); ~AttributeManager(); - search::AttributeVector::SP addAttribute(const vespalib::string &name, - const Config &cfg, - uint64_t serialNum); + AttributeVectorSP addAttribute(const AttributeSpec &spec, uint64_t serialNum); - void addInitializedAttributes(const std::vector<search::AttributeVector::SP> &attributes); + void addInitializedAttributes(const std::vector<AttributeInitializerResult> &attributes); - void addExtraAttribute(const search::AttributeVector::SP &attribute); + void addExtraAttribute(const AttributeVectorSP &attribute); void flushAll(SerialNum currentSerial); - FlushableAttribute::SP getFlushable(const vespalib::string &name); + FlushableAttributeSP getFlushable(const vespalib::string &name); size_t getNumDocs() const; @@ -153,7 +163,7 @@ public: virtual proton::IAttributeManager::SP create(const Spec &spec) const override; - virtual std::vector<IFlushTarget::SP> getFlushTargets() const override; + virtual std::vector<IFlushTargetSP> getFlushTargets() const override; virtual search::SerialNum getFlushedSerialNum(const vespalib::string &name) const override; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp index 234c46147dd..cb96052c733 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp @@ -2,6 +2,7 @@ #include "attributes_initializer_base.h" #include "attributemanager.h" +#include <vespa/searchlib/attribute/attributevector.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h index 0f2d879718a..4d7c666b7b1 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h @@ -3,7 +3,7 @@ #pragma once #include "i_attribute_initializer_registry.h" -#include <vespa/searchlib/attribute/attributevector.h> +#include "attribute_initializer_result.h" namespace proton { @@ -13,7 +13,7 @@ namespace proton { class AttributesInitializerBase : public IAttributeInitializerRegistry { public: - typedef std::vector<search::AttributeVector::SP> AttributesVector; + typedef std::vector<AttributeInitializerResult> AttributesVector; protected: AttributesVector _initializedAttributes; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.h b/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.h index dcb543f84eb..36de783cd0f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_populator.h @@ -32,7 +32,7 @@ public: } // Implements IReprocessingRewriter - virtual void handleExisting(uint32_t lid, document::Document &doc); + virtual void handleExisting(uint32_t lid, document::Document &doc) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp index d63bb60dbae..dbe23f16e57 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/document_field_retriever.cpp @@ -12,19 +12,21 @@ #include <vespa/log/log.h> LOG_SETUP(".proton.attribute.document_field_retriever"); -using search::DocumentIdT; using document::ArrayFieldValue; using document::Document; using document::Field; using document::FieldValue; using document::TensorFieldValue; using document::WeightedSetFieldValue; -using namespace search::index; +using search::DocumentIdT; using search::attribute::AttributeContent; using search::attribute::IAttributeVector; using search::attribute::WeightedType; +using search::index::schema::CollectionType; +using search::index::schema::DataType; using search::tensor::TensorAttribute; using vespalib::IllegalStateException; +using namespace search::index; namespace proton { @@ -38,7 +40,7 @@ setValue(DocumentIdT lid, const IAttributeVector &attr) { switch (field.getCollectionType()) { - case schema::SINGLE: + case CollectionType::SINGLE: { if ( ! attr.isUndefined(lid) ) { AttributeContent<T> content; @@ -49,7 +51,7 @@ setValue(DocumentIdT lid, } break; } - case schema::ARRAY: + case CollectionType::ARRAY: { AttributeContent<T> content; content.fill(attr, lid); @@ -69,7 +71,7 @@ setValue(DocumentIdT lid, doc.setValue(f, *fv); break; } - case schema::WEIGHTEDSET: + case CollectionType::WEIGHTEDSET: { AttributeContent<WeightedType<T> > content; content.fill(attr, lid); @@ -107,34 +109,34 @@ DocumentFieldRetriever::populate(DocumentIdT lid, bool isIndexField) { switch (field.getDataType()) { - case schema::UINT1: - case schema::UINT2: - case schema::UINT4: - case schema::INT8: - case schema::INT16: - case schema::INT32: - case schema::INT64: + case DataType::UINT1: + case DataType::UINT2: + case DataType::UINT4: + case DataType::INT8: + case DataType::INT16: + case DataType::INT32: + case DataType::INT64: setValue<IAttributeVector::largeint_t>( lid, doc, field, attr); break; - case schema::FLOAT: - case schema::DOUBLE: + case DataType::FLOAT: + case DataType::DOUBLE: setValue<double>(lid, doc, field, attr); break; - case schema::STRING: + case DataType::STRING: // If it is a stringfield we also need to check if // it is an index field. In that case we shall // keep the original in order to preserve annotations. if (isIndexField) { break; } - case schema::RAW: + case DataType::RAW: setValue<const char *>(lid, doc, field, attr); break; - case schema::BOOLEANTREE: + case DataType::BOOLEANTREE: // Predicate attribute doesn't store documents, it only indexes them. break; - case schema::TENSOR: + case DataType::TENSOR: // Tensor attribute is not authorative. Partial updates must update // document store. break; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.cpp b/searchcore/src/vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.cpp index 3420d3a8dd0..930bf709e6c 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.cpp @@ -5,6 +5,7 @@ LOG_SETUP(".proton.exclusive_attribute_read_accessor"); #include "exclusive_attribute_read_accessor.h" +#include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> #include <vespa/vespalib/util/executor.h> #include <vespa/vespalib/util/sync.h> diff --git a/searchcore/src/vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.h b/searchcore/src/vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.h index e3a8920f91d..2edecd1ca2a 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.h @@ -2,9 +2,10 @@ #pragma once -#include <vespa/searchlib/attribute/attributevector.h> - -namespace search { class ISequencedTaskExecutor; } +namespace search { +class AttributeVector; +class ISequencedTaskExecutor; +} namespace vespalib { class Gate; } namespace proton { @@ -33,13 +34,14 @@ public: }; private: - search::AttributeVector::SP _attribute; + using AttributeVectorSP = std::shared_ptr<search::AttributeVector>; + AttributeVectorSP _attribute; search::ISequencedTaskExecutor &_attributeFieldWriter; public: using UP = std::unique_ptr<ExclusiveAttributeReadAccessor>; - ExclusiveAttributeReadAccessor(const search::AttributeVector::SP &attribute, + ExclusiveAttributeReadAccessor(const AttributeVectorSP &attribute, search::ISequencedTaskExecutor &attributeFieldWriter); Guard::UP takeGuard(); }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp index 2610f243612..13a846abb79 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp @@ -4,6 +4,7 @@ #include "i_attribute_functor.h" #include <vespa/searchlib/common/isequencedtaskexecutor.h> #include <vespa/vespalib/util/exceptions.h> +#include <vespa/searchlib/attribute/attributevector.h> using search::AttributeGuard; using searchcorespi::IFlushTarget; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h index 05b842ee30a..25cccc230dc 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h @@ -32,20 +32,20 @@ public: ~FilterAttributeManager(); // Implements search::IAttributeManager - virtual search::AttributeGuard::UP getAttribute(const vespalib::string &name) const; - virtual void getAttributeList(std::vector<search::AttributeGuard> &list) const; - virtual search::SerialNum getFlushedSerialNum(const vespalib::string &name) const; - virtual search::AttributeGuard::UP getAttributeStableEnum(const vespalib::string &) const; - virtual search::attribute::IAttributeContext::UP createContext() const; + virtual search::AttributeGuard::UP getAttribute(const vespalib::string &name) const override; + virtual void getAttributeList(std::vector<search::AttributeGuard> &list) const override; + virtual search::SerialNum getFlushedSerialNum(const vespalib::string &name) const override; + virtual search::AttributeGuard::UP getAttributeStableEnum(const vespalib::string &) const override; + virtual search::attribute::IAttributeContext::UP createContext() const override; // Implements proton::IAttributeManager - virtual IAttributeManager::SP create(const AttributeCollectionSpec &) const; - virtual std::vector<searchcorespi::IFlushTarget::SP> getFlushTargets() const; - virtual search::SerialNum getOldestFlushedSerialNumber() const; - virtual search::SerialNum getNewestFlushedSerialNumber() const; - virtual void getAttributeListAll(std::vector<search::AttributeGuard> &) const; + virtual IAttributeManager::SP create(const AttributeCollectionSpec &) const override; + virtual std::vector<searchcorespi::IFlushTarget::SP> getFlushTargets() const override; + virtual search::SerialNum getOldestFlushedSerialNumber() const override; + virtual search::SerialNum getNewestFlushedSerialNumber() const override; + virtual void getAttributeListAll(std::vector<search::AttributeGuard> &) const override; virtual void wipeHistory(search::SerialNum wipeSerial) override; - virtual const IAttributeFactory::SP &getFactory() const; + virtual const IAttributeFactory::SP &getFactory() const override; virtual search::ISequencedTaskExecutor & getAttributeFieldWriter() const override; virtual search::AttributeVector * getWritableAttribute(const vespalib::string &name) const override; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp index 934357d3fa3..e3c27c752b0 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp @@ -11,6 +11,8 @@ #include <fstream> #include <vespa/searchlib/common/serialnumfileheadercontext.h> #include <vespa/searchlib/common/isequencedtaskexecutor.h> +#include <vespa/searchlib/attribute/attributememorysavetarget.h> +#include <vespa/searchlib/attribute/attributevector.h> #include <future> #include "attribute_directory.h" #include <vespa/vespalib/util/stringfmt.h> @@ -24,6 +26,7 @@ using search::common::FileHeaderContext; using search::common::SerialNumFileHeaderContext; using vespalib::makeTask; using vespalib::makeClosure; +using searchcorespi::IFlushTarget; namespace proton { @@ -47,10 +50,10 @@ public: void updateStats(); bool cleanUp(AttributeDirectory::Writer &writer); // Implements vespalib::Executor::Task - virtual void run(); + virtual void run() override; virtual SerialNum - getFlushSerial(void) const + getFlushSerial(void) const override { return _syncToken; } @@ -158,7 +161,7 @@ FlushableAttribute::Flusher::run() } } -FlushableAttribute::FlushableAttribute(const AttributeVector::SP attr, +FlushableAttribute::FlushableAttribute(const AttributeVectorSP attr, const std::shared_ptr<AttributeDirectory> &attrDir, const TuneFileAttributes & tuneFileAttributes, diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h index e72ec166453..5ade5cac31f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h @@ -3,15 +3,14 @@ #pragma once #include <vespa/searchcorespi/flush/iflushtarget.h> -#include <vespa/searchlib/attribute/attributememorysavetarget.h> -#include <vespa/searchlib/attribute/attributevector.h> -#include <vespa/searchlib/common/indexmetainfo.h> +#include <vespa/searchlib/common/tunefileinfo.h> #include <vespa/searchcore/proton/common/hw_info.h> namespace search { class ISequencedTaskExecutor; +class AttributeVector; namespace common { class FileHeaderContext; } @@ -19,23 +18,23 @@ namespace common { class FileHeaderContext; } namespace proton { -using searchcorespi::FlushStats; -using searchcorespi::IFlushTarget; class AttributeDirectory; /** * Implementation of IFlushTarget interface for attribute vectors. */ -class FlushableAttribute : public IFlushTarget +class FlushableAttribute : public searchcorespi::IFlushTarget { private: /** * Task performing the actual flushing to disk. **/ class Flusher; + using AttributeVectorSP = std::shared_ptr<search::AttributeVector>; + using FlushStats = searchcorespi::FlushStats; - search::AttributeVector::SP _attr; + AttributeVectorSP _attr; bool _cleanUpAfterFlush; FlushStats _lastStats; const search::TuneFileAttributes _tuneFileAttributes; @@ -55,7 +54,7 @@ public: * * fileHeaderContext must be kept alive by caller. **/ - FlushableAttribute(const search::AttributeVector::SP attr, + FlushableAttribute(const AttributeVectorSP attr, const std::shared_ptr<AttributeDirectory> &attrDir, const search::TuneFileAttributes &tuneFileAttributes, const search::common::FileHeaderContext & @@ -69,12 +68,12 @@ public: void setCleanUpAfterFlush(bool cleanUp) { _cleanUpAfterFlush = cleanUp; } // Implements IFlushTarget - virtual MemoryGain getApproxMemoryGain() const; - virtual DiskGain getApproxDiskGain() const; - virtual Time getLastFlushTime() const; - virtual SerialNum getFlushedSerialNum() const; - virtual Task::UP initFlush(SerialNum currentSerial); - virtual FlushStats getLastFlushStats() const { return _lastStats; } + virtual MemoryGain getApproxMemoryGain() const override; + virtual DiskGain getApproxDiskGain() const override; + virtual Time getLastFlushTime() const override; + virtual SerialNum getFlushedSerialNum() const override; + virtual Task::UP initFlush(SerialNum currentSerial) override; + virtual FlushStats getLastFlushStats() const override { return _lastStats; } virtual uint64_t getApproxBytesToWriteToDisk() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h index 35f48c021c1..76a76a3ebe1 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/i_attribute_factory.h @@ -2,11 +2,14 @@ #pragma once -#include <vespa/searchcommon/attribute/config.h> -#include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/vespalib/stllike/string.h> +namespace search { +class AttributeVector; +namespace attribute { class Config; } +} + namespace proton { /** @@ -16,10 +19,11 @@ namespace proton { struct IAttributeFactory { typedef std::shared_ptr<IAttributeFactory> SP; + using AttributeVectorSP = std::shared_ptr<search::AttributeVector>; virtual ~IAttributeFactory() {} - virtual search::AttributeVector::SP create(const vespalib::string &name, - const search::attribute::Config &cfg) const = 0; - virtual void setupEmpty(const search::AttributeVector::SP &vec, + virtual AttributeVectorSP create(const vespalib::string &name, + const search::attribute::Config &cfg) const = 0; + virtual void setupEmpty(const AttributeVectorSP &vec, search::SerialNum serialNum) const = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/initialized_attributes_result.cpp b/searchcore/src/vespa/searchcore/proton/attribute/initialized_attributes_result.cpp index 105ef1abbf4..854bbc404ad 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/initialized_attributes_result.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/initialized_attributes_result.cpp @@ -12,7 +12,7 @@ InitializedAttributesResult::InitializedAttributesResult() {} void -InitializedAttributesResult::add(AttributeVector::SP attribute) +InitializedAttributesResult::add(AttributeInitializerResult attribute) { std::lock_guard<std::mutex> lockGuard(_lock); _attributes.push_back(attribute); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/initialized_attributes_result.h b/searchcore/src/vespa/searchcore/proton/attribute/initialized_attributes_result.h index 587c5c23f3f..6157d5c4d97 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/initialized_attributes_result.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/initialized_attributes_result.h @@ -2,8 +2,9 @@ #pragma once -#include <vespa/searchlib/attribute/attributevector.h> +#include "attribute_initializer_result.h" #include <mutex> +#include <vector> namespace proton { @@ -13,13 +14,13 @@ namespace proton { class InitializedAttributesResult { private: - std::vector<search::AttributeVector::SP> _attributes; + std::vector<AttributeInitializerResult> _attributes; std::mutex _lock; public: InitializedAttributesResult(); - void add(search::AttributeVector::SP attribute); - const std::vector<search::AttributeVector::SP> &get() const { return _attributes; } + void add(AttributeInitializerResult attribute); + const std::vector<AttributeInitializerResult> &get() const { return _attributes; } }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/sequential_attributes_initializer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/sequential_attributes_initializer.cpp index 1c898bfd1b9..4170a8e8be5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/sequential_attributes_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/sequential_attributes_initializer.cpp @@ -18,10 +18,10 @@ SequentialAttributesInitializer::SequentialAttributesInitializer(uint32_t docIdL void SequentialAttributesInitializer::add(AttributeInitializer::UP initializer) { - AttributeVector::SP attribute = initializer->init(); - if (attribute) { - considerPadAttribute(*attribute, initializer->getCurrentSerialNum(), _docIdLimit); - _initializedAttributes.push_back(attribute); + AttributeInitializerResult result = initializer->init(); + if (result) { + considerPadAttribute(*result.getAttribute(), initializer->getCurrentSerialNum(), _docIdLimit); + _initializedAttributes.push_back(result); } } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/sequential_attributes_initializer.h b/searchcore/src/vespa/searchcore/proton/attribute/sequential_attributes_initializer.h index 758c4484ddd..04a13676c65 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/sequential_attributes_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/sequential_attributes_initializer.h @@ -3,7 +3,6 @@ #pragma once #include "attributes_initializer_base.h" -#include <vespa/searchlib/attribute/attributevector.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h index 0f9716727a8..a5d35eebad2 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h +++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.h @@ -18,14 +18,14 @@ public: const search::AttributeVector::SP &attribute); virtual std::unique_ptr<document::select::Value> - getValue(const document::select::Context &context) const; + getValue(const document::select::Context &context) const override; virtual std::unique_ptr<document::select::Value> traceValue(const document::select::Context &context, - std::ostream& out) const; + std::ostream& out) const override; document::select::ValueNode::UP - clone(void) const + clone(void) const override { return wrapParens(new AttributeFieldValueNode(getDocType(), getFieldName(), diff --git a/searchcore/src/vespa/searchcore/proton/common/attrupdate.h b/searchcore/src/vespa/searchcore/proton/common/attrupdate.h index 8e21257bd4d..c7ab98107cd 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attrupdate.h +++ b/searchcore/src/vespa/searchcore/proton/common/attrupdate.h @@ -9,16 +9,16 @@ namespace search { -using document::Field; -using document::FieldValue; -using document::FieldUpdate; -using document::ValueUpdate; namespace tensor { class TensorAttribute; } namespace attribute { class ReferenceAttribute; } VESPA_DEFINE_EXCEPTION(UpdateException, vespalib::Exception); class AttrUpdate { + using Field = document::Field; + using FieldValue = document::FieldValue; + using FieldUpdate = document::FieldUpdate; + using ValueUpdate = document::ValueUpdate; public: static void handleUpdate(AttributeVector & vec, uint32_t lid, const FieldUpdate & upd); diff --git a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp index 381ba4ae264..7b09a9a750b 100644 --- a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp @@ -54,7 +54,7 @@ public: * attribute field valulue nodes. */ virtual void - visitFieldValueNode(const FieldValueNode &expr); + visitFieldValueNode(const FieldValueNode &expr) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/common/selectpruner.h b/searchcore/src/vespa/searchcore/proton/common/selectpruner.h index 61c61644d6a..9a7cd35627d 100644 --- a/searchcore/src/vespa/searchcore/proton/common/selectpruner.h +++ b/searchcore/src/vespa/searchcore/proton/common/selectpruner.h @@ -90,29 +90,28 @@ public: process(const document::select::Node &node); private: virtual void - visitAndBranch(const document::select::And &expr); + visitAndBranch(const document::select::And &expr) override; virtual void - visitComparison(const document::select::Compare &expr); + visitComparison(const document::select::Compare &expr) override; virtual void - visitDocumentType(const document::select::DocType &expr); + visitDocumentType(const document::select::DocType &expr) override; virtual void - visitNotBranch(const document::select::Not &expr); + visitNotBranch(const document::select::Not &expr) override; virtual void - visitOrBranch(const document::select::Or &expr); + visitOrBranch(const document::select::Or &expr) override; virtual void - visitArithmeticValueNode(const document::select::ArithmeticValueNode & - expr); + visitArithmeticValueNode(const document::select::ArithmeticValueNode &expr) override; virtual void - visitFunctionValueNode(const document::select::FunctionValueNode &expr); + visitFunctionValueNode(const document::select::FunctionValueNode &expr) override; virtual void - visitFieldValueNode(const document::select::FieldValueNode &expr); + visitFieldValueNode(const document::select::FieldValueNode &expr) override; void invertNode(void); diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h index 80f32e3f046..b3dc30c4d27 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/docsumcontext.h @@ -45,9 +45,9 @@ public: search::engine::DocsumReply::UP getDocsums(); // Implements GetDocsumsStateCallback - virtual void FillSummaryFeatures(search::docsummary::GetDocsumsState * state, search::docsummary::IDocsumEnvironment * env); - virtual void FillRankFeatures(search::docsummary::GetDocsumsState * state, search::docsummary::IDocsumEnvironment * env); - virtual void ParseLocation(search::docsummary::GetDocsumsState * state); + virtual void FillSummaryFeatures(search::docsummary::GetDocsumsState * state, search::docsummary::IDocsumEnvironment * env) override; + virtual void FillRankFeatures(search::docsummary::GetDocsumsState * state, search::docsummary::IDocsumEnvironment * env) override; + virtual void ParseLocation(search::docsummary::GetDocsumsState * state) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h index 4ac3a6e9876..d0ae1b305bc 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h @@ -37,9 +37,9 @@ public: virtual search::docsummary::IDocsumStore::UP createDocsumStore(const vespalib::string &resultClassName) = 0; // Inherit doc from IDocsumEnvironment - virtual search::IAttributeManager *getAttributeManager() = 0; - virtual vespalib::string lookupIndex(const vespalib::string & s) const = 0; - virtual juniper::Juniper *getJuniper() = 0; + virtual search::IAttributeManager *getAttributeManager() override = 0; + virtual vespalib::string lookupIndex(const vespalib::string & s) const override = 0; + virtual juniper::Juniper *getJuniper() override = 0; }; typedef std::unique_ptr<ISummaryManager> UP; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp index fdbe60eb762..0c332edba6a 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp @@ -8,6 +8,8 @@ LOG_SETUP(".proton.docsummary.summarycompacttarget"); using search::IDocumentStore; using search::SerialNum; +using searchcorespi::FlushStats; +using searchcorespi::IFlushTarget; namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h index e6e78a5f871..fdfee6271c4 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h @@ -6,14 +6,13 @@ namespace proton { -using searchcorespi::FlushStats; -using searchcorespi::IFlushTarget; /** * This class implements the IFlushTarget interface to proxy a summary manager. */ -class SummaryCompactTarget : public IFlushTarget { +class SummaryCompactTarget : public searchcorespi::IFlushTarget { private: + using FlushStats = searchcorespi::FlushStats; search::IDocumentStore & _docStore; FlushStats _lastStats; @@ -21,14 +20,14 @@ public: SummaryCompactTarget(search::IDocumentStore & docStore); // Implements IFlushTarget - virtual MemoryGain getApproxMemoryGain() const; - virtual DiskGain getApproxDiskGain() const; - virtual SerialNum getFlushedSerialNum() const; - virtual Time getLastFlushTime() const; + virtual MemoryGain getApproxMemoryGain() const override; + virtual DiskGain getApproxDiskGain() const override; + virtual SerialNum getFlushedSerialNum() const override; + virtual Time getLastFlushTime() const override; - virtual Task::UP initFlush(SerialNum currentSerial); + virtual Task::UP initFlush(SerialNum currentSerial) override; - virtual FlushStats getLastFlushStats() const { return _lastStats; } + virtual FlushStats getLastFlushStats() const override { return _lastStats; } virtual uint64_t getApproxBytesToWriteToDisk() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp index 33bf18fea12..f2007b2f988 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp @@ -8,6 +8,8 @@ LOG_SETUP(".proton.docsummary.summaryflushtarget"); using search::IDocumentStore; using search::SerialNum; +using searchcorespi::FlushStats; +using searchcorespi::IFlushTarget; namespace proton { @@ -28,7 +30,7 @@ public: { _currSerial = _docStore.initFlush(currSerial); } - virtual void run() { + virtual void run() override { _docStore.flush(_currSerial); updateStats(); } @@ -38,7 +40,7 @@ public: } virtual SerialNum - getFlushSerial(void) const + getFlushSerial(void) const override { return _currSerial; } diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h b/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h index 617a375d51c..38fb0df3d52 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h @@ -6,14 +6,13 @@ namespace proton { -using searchcorespi::FlushStats; -using searchcorespi::IFlushTarget; /** * This class implements the IFlushTarget interface to proxy a summary manager. */ -class SummaryFlushTarget : public IFlushTarget { +class SummaryFlushTarget : public searchcorespi::IFlushTarget { private: + using FlushStats = searchcorespi::FlushStats; search::IDocumentStore & _docStore; FlushStats _lastStats; @@ -21,14 +20,14 @@ public: SummaryFlushTarget(search::IDocumentStore & docStore); // Implements IFlushTarget - virtual MemoryGain getApproxMemoryGain() const; - virtual DiskGain getApproxDiskGain() const; - virtual SerialNum getFlushedSerialNum() const; - virtual Time getLastFlushTime() const; + virtual MemoryGain getApproxMemoryGain() const override; + virtual DiskGain getApproxDiskGain() const override; + virtual SerialNum getFlushedSerialNum() const override; + virtual Time getLastFlushTime() const override; - virtual Task::UP initFlush(SerialNum currentSerial); + virtual Task::UP initFlush(SerialNum currentSerial) override; - virtual FlushStats getLastFlushStats() const { return _lastStats; } + virtual FlushStats getLastFlushStats() const override { return _lastStats; } virtual uint64_t getApproxBytesToWriteToDisk() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp index 318ffcc040e..a3282e9e3ec 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp @@ -28,6 +28,7 @@ using search::WriteableFileChunk; using search::TuneFileSummary; using search::common::FileHeaderContext; +using searchcorespi::IFlushTarget; namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h index 2c3f34cf17a..b55345ae470 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h @@ -13,6 +13,7 @@ #include <vespa/document/fieldvalue/document.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/vespalib/util/threadstackexecutor.h> +#include <vespa/fastlib/text/normwordfolder.h> namespace search { @@ -51,16 +52,16 @@ public: /** * Implements ISummarySetup. */ - search::docsummary::IDocsumWriter & getDocsumWriter() const { return *_docsumWriter; } - search::docsummary::ResultConfig & getResultConfig() { return *_docsumWriter->GetResultConfig(); } + search::docsummary::IDocsumWriter & getDocsumWriter() const override { return *_docsumWriter; } + search::docsummary::ResultConfig & getResultConfig() override { return *_docsumWriter->GetResultConfig(); } search::docsummary::IDocsumStore::UP createDocsumStore( - const vespalib::string &resultClassName); + const vespalib::string &resultClassName) override; // Inherit doc from IDocsumEnvironment - virtual search::IAttributeManager * getAttributeManager() { return _attributeMgr.get(); } - virtual vespalib::string lookupIndex(const vespalib::string & s) const { (void) s; return ""; } - virtual juniper::Juniper * getJuniper() { return _juniperConfig.get(); } + virtual search::IAttributeManager * getAttributeManager() override { return _attributeMgr.get(); } + virtual vespalib::string lookupIndex(const vespalib::string & s) const override { (void) s; return ""; } + virtual juniper::Juniper * getJuniper() override { return _juniperConfig.get(); } }; private: @@ -85,7 +86,7 @@ public: void putDocument(uint64_t syncToken, const document::Document & doc, search::DocumentIdT lid); void removeDocument(uint64_t syncToken, search::DocumentIdT lid); - IFlushTarget::List getFlushTargets(); + searchcorespi::IFlushTarget::List getFlushTargets(); /** * Implements ISummaryManager. @@ -95,9 +96,9 @@ public: const vespa::config::search::SummarymapConfig &summarymapCfg, const vespa::config::search::summary::JuniperrcConfig &juniperCfg, const document::DocumentTypeRepo::SP &repo, - const search::IAttributeManager::SP &attributeMgr); + const search::IAttributeManager::SP &attributeMgr) override; - virtual search::IDocumentStore & getBackingStore() { return *_docStore; } + virtual search::IDocumentStore & getBackingStore() override { return *_docStore; } }; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.h index 54686f79c01..012a0301ea6 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.h @@ -14,7 +14,7 @@ namespace proton { class DocumentMetaStoreAttribute : public search::NotImplementedAttribute { protected: - virtual void notImplemented() const __attribute__((noinline)); + virtual void notImplemented() const override __attribute__((noinline)); public: DocumentMetaStoreAttribute(const vespalib::string &name=getFixedName()); @@ -29,10 +29,7 @@ public: return document::GlobalId::LENGTH; } - virtual void - onCommit() - { - } + virtual void onCommit() override {} }; } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h index 01fa6c8c4aa..7116673d570 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h @@ -22,7 +22,7 @@ public: search::AttributeGuard _activeLidsGuard; public: ReadGuard(const search::AttributeVector::SP &metaStoreAttr); - virtual const search::IDocumentMetaStore &get() const { return _store; } + virtual const search::IDocumentMetaStore &get() const override { return _store; } }; private: search::AttributeVector::SP _metaStoreAttr; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp index 83b22dd6153..33c90819e33 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp @@ -19,6 +19,7 @@ LOG_SETUP(".proton.documentmetastore.documentmetastoreflushtarget"); #include <vespa/searchcore/proton/server/itlssyncer.h> #include <vespa/searchcore/proton/attribute/attributedisklayout.h> #include <vespa/searchcore/proton/attribute/attribute_directory.h> +#include "documentmetastore.h" using namespace search; using namespace vespalib; @@ -26,6 +27,8 @@ using search::common::FileHeaderContext; using search::common::SerialNumFileHeaderContext; using vespalib::makeTask; using vespalib::makeClosure; +using searchcorespi::IFlushTarget; +using searchcorespi::FlushStats; namespace proton { @@ -49,10 +52,10 @@ public: void updateStats(); bool cleanUp(AttributeDirectory::Writer &writer); // Implements vespalib::Executor::Task - virtual void run(); + virtual void run() override; virtual SerialNum - getFlushSerial(void) const + getFlushSerial(void) const override { return _syncToken; } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h index f6ea0613e7f..2fb04f40441 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h @@ -3,10 +3,7 @@ #pragma once #include <vespa/searchcorespi/flush/iflushtarget.h> -#include <vespa/searchlib/attribute/attributevector.h> -#include <vespa/searchlib/common/indexmetainfo.h> #include <vespa/searchlib/common/tunefileinfo.h> -#include "documentmetastore.h" #include <vespa/searchcore/proton/common/hw_info.h> namespace search @@ -27,22 +24,22 @@ namespace proton class ITlsSyncer; class AttributeDiskLayout; class AttributeDirectory; - -using searchcorespi::FlushStats; -using searchcorespi::IFlushTarget; +class DocumentMetaStore; /** * Implementation of IFlushTarget interface for document meta store. **/ -class DocumentMetaStoreFlushTarget : public IFlushTarget +class DocumentMetaStoreFlushTarget : public searchcorespi::IFlushTarget { private: /** * Task performing the actual flushing to disk. **/ class Flusher; + using DocumentMetaStoreSP = std::shared_ptr<DocumentMetaStore>; + using FlushStats = searchcorespi::FlushStats; - DocumentMetaStore::SP _dms; + DocumentMetaStoreSP _dms; ITlsSyncer &_tlsSyncer; vespalib::string _baseDir; bool _cleanUpAfterFlush; @@ -60,7 +57,7 @@ public: * Creates a new instance using the given attribute vector and the * given base dir where all attribute vectors are located. **/ - DocumentMetaStoreFlushTarget(const DocumentMetaStore::SP dms, + DocumentMetaStoreFlushTarget(const DocumentMetaStoreSP dms, ITlsSyncer &tlsSyncer, const vespalib::string &baseDir, const search::TuneFileAttributes & @@ -75,12 +72,12 @@ public: void setCleanUpAfterFlush(bool cleanUp) { _cleanUpAfterFlush = cleanUp; } // Implements IFlushTarget - virtual MemoryGain getApproxMemoryGain() const; - virtual DiskGain getApproxDiskGain() const; - virtual Time getLastFlushTime() const; - virtual SerialNum getFlushedSerialNum() const; - virtual Task::UP initFlush(SerialNum currentSerial); - virtual FlushStats getLastFlushStats() const { return _lastStats; } + virtual MemoryGain getApproxMemoryGain() const override; + virtual DiskGain getApproxDiskGain() const override; + virtual Time getLastFlushTime() const override; + virtual SerialNum getFlushedSerialNum() const override; + virtual Task::UP initFlush(SerialNum currentSerial) override; + virtual FlushStats getLastFlushStats() const override { return _lastStats; } static void initCleanup(const vespalib::string &baseDir); virtual uint64_t getApproxBytesToWriteToDisk() const override; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/gid_compare.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/gid_compare.h index 0d1c2e99dda..850c736ec96 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/gid_compare.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/gid_compare.h @@ -38,7 +38,7 @@ public: } virtual bool operator()(const document::GlobalId &lhs, - const document::GlobalId &rhs) const { + const document::GlobalId &rhs) const override { return _comp(lhs, rhs); } }; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp index 653e27bda1a..38e2d2345c7 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp @@ -2,6 +2,8 @@ #include "lid_allocator.h" #include <vespa/searchlib/query/queryterm.h> +#include <vespa/searchlib/attribute/attributevector.h> +#include <vespa/searchlib/attribute/singlesmallnumericattribute.h> #include <vespa/log/log.h> LOG_SETUP(".proton.documentmetastore.lid_allocator"); @@ -227,7 +229,7 @@ private: virtual SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, - bool strict) const + bool strict) const override { assert(tfmda.size() == 0); (void) tfmda; @@ -241,7 +243,7 @@ private: } virtual void - fetchPostings(bool strict) + fetchPostings(bool strict) override { _searchCtx->fetchPostings(strict); } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h index eddb010250a..74c98915da2 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h @@ -5,10 +5,14 @@ #include "lid_hold_list.h" #include "lidstatevector.h" #include <vespa/searchlib/attribute/attributeguard.h> -#include <vespa/searchlib/attribute/attributevector.h> -#include <vespa/searchlib/attribute/singlesmallnumericattribute.h> #include <vespa/searchlib/queryeval/blueprint.h> +namespace search { +class AttributeVector; +class SingleValueBitNumericAttribute; +class GrowStrategy; +} + namespace proton { namespace documentmetastore { @@ -22,13 +26,14 @@ private: typedef search::SingleValueBitNumericAttribute BitAttribute; typedef uint32_t DocId; typedef vespalib::GenerationHandler::generation_t generation_t; + using AttributeVectorSP = std::shared_ptr<search::AttributeVector>; LidHoldList _holdLids; LidStateVector _freeLids; LidStateVector _usedLids; LidStateVector _pendingHoldLids; bool _lidFreeListConstructed; - search::AttributeVector::SP _activeLidsAttr; + AttributeVectorSP _activeLidsAttr; BitAttribute &_activeLids; uint32_t _numActiveLids; diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp index d03a5a14743..c91f28a1379 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/search_context.cpp @@ -21,7 +21,7 @@ class GidAllSearchIterator : public AttributeIteratorBase { private: virtual void - doSeek(uint32_t docId) + doSeek(uint32_t docId) override { if (_store.validLidFast(docId)) { setDocId(docId); @@ -29,7 +29,7 @@ private: } virtual void - doUnpack(uint32_t docId) + doUnpack(uint32_t docId) override { _matchData->reset(docId); } @@ -51,7 +51,7 @@ private: uint32_t _numDocs; virtual void - doSeek(uint32_t docId) + doSeek(uint32_t docId) override { if (_store.validLidFast(docId)) { setDocId(docId); @@ -80,7 +80,7 @@ private: const GlobalId & _gid; virtual void - doSeek(uint32_t docId) + doSeek(uint32_t docId) override { AttributeVector::DocId lid = 0; if (_store.getLid(_gid, lid) && (lid >= docId)) { diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h index 4a51b5221b1..7c07d8d1a05 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h @@ -20,10 +20,10 @@ public: uint32_t getLidLimit() const { return _lidLimit; } // Implements FeedOperation - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.h index bf03eb53eb8..cfb402ac0f0 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/createbucketoperation.h @@ -15,10 +15,10 @@ public: CreateBucketOperation(const document::BucketId &bucketId); virtual ~CreateBucketOperation() {} const document::BucketId &getBucketId() const { return _bucketId; } - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.h index 1780634ca54..0e5f5bfd80f 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/deletebucketoperation.h @@ -15,10 +15,10 @@ public: DeleteBucketOperation(const document::BucketId &bucketId); virtual ~DeleteBucketOperation() {} const document::BucketId &getBucketId() const { return _bucketId; } - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.h index 0f58f1b9cbe..4b22c868628 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/documentoperation.h @@ -184,11 +184,11 @@ public: } virtual void - serialize(vespalib::nbostream &os) const; + serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); + const document::DocumentTypeRepo &repo) override; uint32_t getSerializedDocSize() const { return _serializedDocSize; } }; diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.h index 7de28be9ecc..11b03420294 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/joinbucketsoperation.h @@ -21,10 +21,10 @@ public: const document::BucketId &getSource1() const { return _source1; } const document::BucketId &getSource2() const { return _source2; } const document::BucketId &getTarget() const { return _target; } - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h index 90e29422718..cfbbb5e9e29 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h @@ -26,10 +26,10 @@ public: void setTargetLid(search::DocumentIdT lid) { setDbDocumentId(DbDocumentId(getSubDbId(), lid)); } - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h index cc6a2d18eb7..57563510cf9 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/newconfigoperation.h @@ -22,10 +22,10 @@ public: NewConfigOperation(SerialNum serialNum, IStreamHandler &streamHandler); virtual ~NewConfigOperation() {} - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.h index 47e36b4c39d..f8e88597d9a 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/noopoperation.h @@ -10,10 +10,10 @@ struct NoopOperation : FeedOperation { NoopOperation(SerialNum serialNum); virtual ~NoopOperation() {} - virtual void serialize(vespalib::nbostream &) const {} + virtual void serialize(vespalib::nbostream &) const override {} virtual void deserialize(vespalib::nbostream &, - const document::DocumentTypeRepo &) {} - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &) override {} + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h index 3f30c40f881..a77ff2a6165 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h @@ -38,13 +38,13 @@ public: } virtual void - serialize(vespalib::nbostream &os) const; + serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); + const document::DocumentTypeRepo &repo) override; - virtual vespalib::string toString() const; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.h index ad32d7d2f80..218c4f7bd1a 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/putoperation.h @@ -18,10 +18,10 @@ public: virtual ~PutOperation(); const DocumentSP &getDocument() const { return _doc; } void assertValid() const; - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h index 7f742515a00..0f3ddc62413 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/removeoperation.h @@ -16,10 +16,10 @@ public: const document::DocumentId &docId); virtual ~RemoveOperation() {} const document::DocumentId &getDocumentId() const { return _docId; } - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; bool hasDocType() const { return _docId.hasDocType(); } vespalib::string getDocType() const { return _docId.getDocType(); } diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.h index a9f54f262ef..5c7fab91ef8 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/splitbucketoperation.h @@ -21,10 +21,10 @@ public: const document::BucketId &getSource() const { return _source; } const document::BucketId &getTarget1() const { return _target1; } const document::BucketId &getTarget2() const { return _target2; } - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.h index b1bae7ceda4..fbc9813acd4 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/spoolerreplayoperation.h @@ -17,13 +17,13 @@ protected: public: virtual ~SpoolerReplayOperation() {} SerialNum getSpoolerSerialNum() const { return _spoolerSerialNum; } - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &) { + const document::DocumentTypeRepo &) override { deserialize(is); } void deserialize(vespalib::nbostream &is); - virtual vespalib::string toString() const; + virtual vespalib::string toString() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h index 32e4bff7d9e..2a8ceeaf53a 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h @@ -22,10 +22,10 @@ public: const document::DocumentUpdate::SP &upd); virtual ~UpdateOperation() {} const document::DocumentUpdate::SP &getUpdate() const { return _upd; } - virtual void serialize(vespalib::nbostream &os) const; + virtual void serialize(vespalib::nbostream &os) const override; virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &repo) override; + virtual vespalib::string toString() const override; static UpdateOperation makeOldUpdate(const document::BucketId &bucketId, const storage::spi::Timestamp ×tamp, const document::DocumentUpdate::SP &upd); diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.h index 070e9ce0c46..47b20de5465 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/wipehistoryoperation.h @@ -16,10 +16,10 @@ public: fastos::TimeStamp getWipeTimeLimit() const { return _wipeTimeLimit; } - virtual void serialize(vespalib::nbostream &str) const; + virtual void serialize(vespalib::nbostream &str) const override; virtual void deserialize(vespalib::nbostream &str, - const document::DocumentTypeRepo &); - virtual vespalib::string toString() const; + const document::DocumentTypeRepo &) override; + virtual vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h b/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h index d5302ea62ca..4bf760ce372 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h @@ -5,16 +5,15 @@ namespace proton { -using searchcorespi::FlushStats; -using searchcorespi::IFlushTarget; - /** * Implements a flush target that caches the flushable memory and flush cost of * a decorated target. This is used by the flush engine to avoid recalculating * these during selection of flush target. */ -class CachedFlushTarget : public IFlushTarget { +class CachedFlushTarget : public searchcorespi::IFlushTarget { private: + using FlushStats = searchcorespi::FlushStats; + using IFlushTarget = searchcorespi::IFlushTarget; IFlushTarget::SP _target; SerialNum _flushedSerialNum; Time _lastFlushTime; @@ -43,14 +42,14 @@ public: const IFlushTarget::SP & getFlushTarget() { return _target; } // Implements IFlushTarget. - virtual MemoryGain getApproxMemoryGain() const { return _memoryGain; } - virtual DiskGain getApproxDiskGain() const { return _diskGain; } - virtual SerialNum getFlushedSerialNum() const { return _flushedSerialNum; } - virtual Time getLastFlushTime() const { return _lastFlushTime; } - virtual bool needUrgentFlush() const { return _needUrgentFlush; } - - virtual Task::UP initFlush(SerialNum currentSerial) { return _target->initFlush(currentSerial); } - virtual FlushStats getLastFlushStats() const { return _target->getLastFlushStats(); } + virtual MemoryGain getApproxMemoryGain() const override { return _memoryGain; } + virtual DiskGain getApproxDiskGain() const override { return _diskGain; } + virtual SerialNum getFlushedSerialNum() const override { return _flushedSerialNum; } + virtual Time getLastFlushTime() const override { return _lastFlushTime; } + virtual bool needUrgentFlush() const override { return _needUrgentFlush; } + + virtual Task::UP initFlush(SerialNum currentSerial) override { return _target->initFlush(currentSerial); } + virtual FlushStats getLastFlushStats() const override { return _target->getLastFlushStats(); } virtual uint64_t getApproxBytesToWriteToDisk() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flush_all_strategy.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flush_all_strategy.cpp index bb237d1ff7e..ae5d11e0fa9 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flush_all_strategy.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flush_all_strategy.cpp @@ -3,6 +3,7 @@ #include "flush_all_strategy.h" using search::SerialNum; +using searchcorespi::IFlushTarget; namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flush_engine_explorer.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flush_engine_explorer.cpp index 3c649dd5614..8216c9b1391 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flush_engine_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flush_engine_explorer.cpp @@ -11,6 +11,7 @@ LOG_SETUP(".proton.flushengine.flush_engine_explorer"); using vespalib::slime::Cursor; using vespalib::slime::Inserter; using vespalib::StateExplorer; +using searchcorespi::IFlushTarget; namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.h index ab6166a7082..e03371c4b68 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushcontext.h @@ -6,14 +6,13 @@ namespace proton { -using searchcorespi::IFlushTarget; - /** * This class is used by FlushEngine to hold the necessary context for flushing * a single IFlushTarget. */ class FlushContext { private: + using IFlushTarget = searchcorespi::IFlushTarget; vespalib::string _name; IFlushHandler::SP _handler; IFlushTarget::SP _target; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp index f3d6f1c7de2..e75b44a2235 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp @@ -14,6 +14,8 @@ LOG_SETUP(".proton.flushengine.flushengine"); using vespalib::MonitorGuard; typedef vespalib::Executor::Task Task; +using searchcorespi::IFlushTarget; +using searchcorespi::FlushStats; namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h index 6eddb9c46ab..d4ebb687e87 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h @@ -31,6 +31,7 @@ public: }; typedef std::set<FlushMeta> FlushMetaSet; private: + using IFlushTarget = searchcorespi::IFlushTarget; struct FlushInfo : public FlushMeta { FlushInfo(); @@ -165,7 +166,7 @@ public: removeFlushHandler(const DocTypeName &docTypeName); // Implements FastOS_Runnable. - void Run(FastOS_ThreadInterface *thread, void *arg); + void Run(FastOS_ThreadInterface *thread, void *arg) override; FlushMetaSet getCurrentlyFlushingSet() const; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h index 04977c55b42..0849aeb518c 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h @@ -47,25 +47,25 @@ public: } // Implements IFlushTarget. virtual MemoryGain - getApproxMemoryGain() const; + getApproxMemoryGain() const override; virtual DiskGain - getApproxDiskGain() const; + getApproxDiskGain() const override; virtual SerialNum - getFlushedSerialNum() const; + getFlushedSerialNum() const override; virtual Time - getLastFlushTime() const; + getLastFlushTime() const override; virtual bool - needUrgentFlush() const; + needUrgentFlush() const override; virtual Task::UP - initFlush(SerialNum currentSerial);; + initFlush(SerialNum currentSerial) override; virtual searchcorespi::FlushStats - getLastFlushStats() const; + getLastFlushStats() const override; virtual uint64_t getApproxBytesToWriteToDisk() const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushtask.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushtask.h index 33b4c8647f7..788143283c5 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushtask.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushtask.h @@ -36,7 +36,7 @@ public: ~FlushTask(); // Implements Executor::Task. - void run(); + void run() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/iflushhandler.h b/searchcore/src/vespa/searchcore/proton/flushengine/iflushhandler.h index 41774c085c1..5a58786f8ac 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/iflushhandler.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/iflushhandler.h @@ -6,8 +6,6 @@ namespace proton { -using searchcorespi::IFlushTarget; - /** * This class represents a collection of IFlushTarget objects. It is implemented * by DocumentDB. @@ -17,6 +15,7 @@ private: vespalib::string _name; public: + using IFlushTarget = searchcorespi::IFlushTarget; typedef IFlushTarget::SerialNum SerialNum; /** * Convenience typedefs. diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp index d989cb24e88..1bf45bd332e 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/prepare_restart_flush_strategy.cpp @@ -10,6 +10,7 @@ LOG_SETUP(".proton.flushengine.prepare_restart_flush_strategy"); namespace proton { using search::SerialNum; +using searchcorespi::IFlushTarget; using Config = PrepareRestartFlushStrategy::Config; using FlushContextsMap = std::map<vespalib::string, FlushContext::List>; diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.h b/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.h index f26244e1264..1398cac29c0 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/threadedflushtarget.h @@ -7,9 +7,6 @@ namespace vespalib { class Executor; } namespace proton { -using searchcorespi::FlushStats; -using searchcorespi::IFlushTarget; - class IGetSerialNum; /** @@ -20,6 +17,7 @@ class IGetSerialNum; class ThreadedFlushTarget : public FlushTargetProxy { private: + using IFlushTarget = searchcorespi::IFlushTarget; vespalib::Executor &_executor; const IGetSerialNum &_getSerialNum; @@ -52,7 +50,7 @@ public: // Implements IFlushTarget. virtual Task::UP - initFlush(SerialNum currentSerial); + initFlush(SerialNum currentSerial) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/index/i_index_writer.h b/searchcore/src/vespa/searchcore/proton/index/i_index_writer.h index 21dc822bb2a..2d0fe0d15b4 100644 --- a/searchcore/src/vespa/searchcore/proton/index/i_index_writer.h +++ b/searchcore/src/vespa/searchcore/proton/index/i_index_writer.h @@ -9,8 +9,6 @@ namespace proton { -using searchcorespi::IIndexManager; - /** * Interface for an index writer that handles writes in form of put and remove * to an underlying memory index. @@ -19,7 +17,8 @@ class IIndexWriter { public: typedef std::unique_ptr<IIndexWriter> UP; typedef std::shared_ptr<IIndexWriter> SP; - using OnWriteDoneType = searchcorespi::IIndexManager::OnWriteDoneType; + using IIndexManager = searchcorespi::IIndexManager; + using OnWriteDoneType = IIndexManager::OnWriteDoneType; virtual ~IIndexWriter() {} diff --git a/searchcore/src/vespa/searchcore/proton/index/index_writer.h b/searchcore/src/vespa/searchcore/proton/index/index_writer.h index f4adb6aa5d0..c5dce9948ca 100644 --- a/searchcore/src/vespa/searchcore/proton/index/index_writer.h +++ b/searchcore/src/vespa/searchcore/proton/index/index_writer.h @@ -19,18 +19,18 @@ public: /** * Implements IIndexWriter. */ - virtual const IIndexManager::SP & getIndexManager() const { return _mgr; } + virtual const IIndexManager::SP & getIndexManager() const override { return _mgr; } virtual void put(search::SerialNum serialNum, const document::Document &doc, - const search::DocumentIdT lid); + const search::DocumentIdT lid) override; virtual void remove(search::SerialNum serialNum, - const search::DocumentIdT lid); + const search::DocumentIdT lid) override; virtual void commit(search::SerialNum serialNum, OnWriteDoneType onWriteDone) override; virtual void - heartBeat(search::SerialNum serialNum); + heartBeat(search::SerialNum serialNum) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/index/indexmanager.h b/searchcore/src/vespa/searchcore/proton/index/indexmanager.h index 55f16047183..7db5d954aa0 100644 --- a/searchcore/src/vespa/searchcore/proton/index/indexmanager.h +++ b/searchcore/src/vespa/searchcore/proton/index/indexmanager.h @@ -8,16 +8,13 @@ namespace proton { -using searchcorespi::IFlushTarget; -using searchcorespi::IIndexManager; - /** * The IndexManager provides a holistic view of a set of disk and * memory indexes. It allows updating the active index, enables search * across all indexes, and manages the set of indexes through flushing * of memory indexes and fusion of disk indexes. */ -class IndexManager : public IIndexManager +class IndexManager : public searchcorespi::IIndexManager { public: class MaintainerOperations : public searchcorespi::index::IIndexMaintainerOperations { @@ -39,14 +36,14 @@ public: createMemoryIndex(const search::index::Schema &schema, SerialNum serialNum) override; virtual searchcorespi::index::IDiskIndex::SP - loadDiskIndex(const vespalib::string &indexDir); + loadDiskIndex(const vespalib::string &indexDir) override; virtual searchcorespi::index::IDiskIndex::SP - reloadDiskIndex(const searchcorespi::index::IDiskIndex &oldIndex); + reloadDiskIndex(const searchcorespi::index::IDiskIndex &oldIndex) override; virtual bool runFusion(const search::index::Schema &schema, const vespalib::string &outputDir, const std::vector<vespalib::string> &sources, const search::diskindex::SelectorArray &docIdSelector, - search::SerialNum lastSerialNum); + search::SerialNum lastSerialNum) override; }; private: @@ -90,35 +87,35 @@ public: _maintainer.commit(serialNum, onWriteDone); } - virtual void heartBeat(SerialNum serialNum) { + virtual void heartBeat(SerialNum serialNum) override { _maintainer.heartBeat(serialNum); } - virtual SerialNum getCurrentSerialNum() const { + virtual SerialNum getCurrentSerialNum() const override { return _maintainer.getCurrentSerialNum(); } - virtual SerialNum getFlushedSerialNum() const { + virtual SerialNum getFlushedSerialNum() const override { return _maintainer.getFlushedSerialNum(); } - virtual searchcorespi::IndexSearchable::SP getSearchable() const { + virtual searchcorespi::IndexSearchable::SP getSearchable() const override { return _maintainer.getSearchable(); } - virtual search::SearchableStats getSearchableStats() const { + virtual search::SearchableStats getSearchableStats() const override { return _maintainer.getSearchableStats(); } - virtual IFlushTarget::List getFlushTargets() { + virtual searchcorespi::IFlushTarget::List getFlushTargets() override { return _maintainer.getFlushTargets(); } - virtual void setSchema(const Schema &schema, SerialNum serialNum) { + virtual void setSchema(const Schema &schema, SerialNum serialNum) override { _maintainer.setSchema(schema, serialNum); } - virtual void wipeHistory(SerialNum wipeSerial) { + virtual void wipeHistory(SerialNum wipeSerial) override { _maintainer.wipeHistory(wipeSerial); } }; diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp index 2c306241e7c..e9c0cba6069 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp @@ -27,7 +27,7 @@ public: // empty } - void run() { + void run() override { _engine.performSearch(std::move(_request), _client); } }; diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h index 0c026dd602d..6e812f61a7b 100644 --- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h +++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h @@ -147,7 +147,7 @@ public: // Implements SearchServer. search::engine::SearchReply::UP search( search::engine::SearchRequest::Source request, - search::engine::SearchClient &client); + search::engine::SearchClient &client) override; // Implements vespalib::StateExplorer virtual void get_state(const vespalib::slime::Inserter &inserter, bool full) const override; diff --git a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp index 213f7ec13ae..037b1fff2a2 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/blueprintbuilder.cpp @@ -124,29 +124,29 @@ private: } protected: - virtual void visit(ProtonAnd &n) { buildIntermediate(new AndBlueprint(), n); } - virtual void visit(ProtonAndNot &n) { buildIntermediate(new AndNotBlueprint(), n); } - virtual void visit(ProtonOr &n) { buildIntermediate(new OrBlueprint(), n); } - virtual void visit(ProtonWeakAnd &n) { buildWeakAnd(n); } - virtual void visit(ProtonEquiv &n) { buildEquiv(n); } - virtual void visit(ProtonRank &n) { buildIntermediate(new RankBlueprint(), n); } - virtual void visit(ProtonNear &n) { buildIntermediate(new NearBlueprint(n.getDistance()), n); } - virtual void visit(ProtonONear &n) { buildIntermediate(new ONearBlueprint(n.getDistance()), n); } - - virtual void visit(ProtonWeightedSetTerm &n) { buildTerm(n); } - virtual void visit(ProtonDotProduct &n) { buildTerm(n); } - virtual void visit(ProtonWandTerm &n) { buildTerm(n); } - - virtual void visit(ProtonPhrase &n) { buildTerm(n); } - virtual void visit(ProtonNumberTerm &n) { buildTerm(n); } - virtual void visit(ProtonLocationTerm &n) { buildTerm(n); } - virtual void visit(ProtonPrefixTerm &n) { buildTerm(n); } - virtual void visit(ProtonRangeTerm &n) { buildTerm(n); } - virtual void visit(ProtonStringTerm &n) { buildTerm(n); } - virtual void visit(ProtonSubstringTerm &n) { buildTerm(n); } - virtual void visit(ProtonSuffixTerm &n) { buildTerm(n); } - virtual void visit(ProtonPredicateQuery &n) { buildTerm(n); } - virtual void visit(ProtonRegExpTerm &n) { buildTerm(n); } + virtual void visit(ProtonAnd &n) override { buildIntermediate(new AndBlueprint(), n); } + virtual void visit(ProtonAndNot &n) override { buildIntermediate(new AndNotBlueprint(), n); } + virtual void visit(ProtonOr &n) override { buildIntermediate(new OrBlueprint(), n); } + virtual void visit(ProtonWeakAnd &n) override { buildWeakAnd(n); } + virtual void visit(ProtonEquiv &n) override { buildEquiv(n); } + virtual void visit(ProtonRank &n) override { buildIntermediate(new RankBlueprint(), n); } + virtual void visit(ProtonNear &n) override { buildIntermediate(new NearBlueprint(n.getDistance()), n); } + virtual void visit(ProtonONear &n) override { buildIntermediate(new ONearBlueprint(n.getDistance()), n); } + + virtual void visit(ProtonWeightedSetTerm &n) override { buildTerm(n); } + virtual void visit(ProtonDotProduct &n) override { buildTerm(n); } + virtual void visit(ProtonWandTerm &n) override { buildTerm(n); } + + virtual void visit(ProtonPhrase &n) override { buildTerm(n); } + virtual void visit(ProtonNumberTerm &n) override { buildTerm(n); } + virtual void visit(ProtonLocationTerm &n) override { buildTerm(n); } + virtual void visit(ProtonPrefixTerm &n) override { buildTerm(n); } + virtual void visit(ProtonRangeTerm &n) override { buildTerm(n); } + virtual void visit(ProtonStringTerm &n) override { buildTerm(n); } + virtual void visit(ProtonSubstringTerm &n) override { buildTerm(n); } + virtual void visit(ProtonSuffixTerm &n) override { buildTerm(n); } + virtual void visit(ProtonPredicateQuery &n) override { buildTerm(n); } + virtual void visit(ProtonRegExpTerm &n) override { buildTerm(n); } public: BlueprintBuilderVisitor(const IRequestContext & requestContext, ISearchContext &context) : diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp index a66ae3593d8..73a2e372db6 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp @@ -11,37 +11,23 @@ using namespace search::fef; namespace proton { namespace matching { -namespace { - -search::fef::CollectionType convertCollectionType(search::index::Schema::CollectionType type) { - switch (type) { - case search::index::schema::SINGLE: return search::fef::CollectionType::SINGLE; - case search::index::schema::ARRAY: return search::fef::CollectionType::ARRAY; - case search::index::schema::WEIGHTEDSET: return search::fef::CollectionType::WEIGHTEDSET; - default: - abort(); - } -} - -} - void IndexEnvironment::extractFields(const search::index::Schema &schema) { typedef search::index::Schema::Field SchemaField; for (uint32_t i = 0; i < schema.getNumAttributeFields(); ++i) { const SchemaField &field = schema.getAttributeField(i); - search::fef::FieldInfo fieldInfo(search::fef::FieldType::ATTRIBUTE, - convertCollectionType(field.getCollectionType()), - field.getName(), _fields.size()); + FieldInfo fieldInfo(FieldType::ATTRIBUTE, + field.getCollectionType(), + field.getName(), _fields.size()); fieldInfo.set_data_type(field.getDataType()); insertField(fieldInfo); } for (uint32_t i = 0; i < schema.getNumIndexFields(); ++i) { const SchemaField &field = schema.getIndexField(i); - search::fef::FieldInfo fieldInfo(search::fef::FieldType::INDEX, - convertCollectionType(field.getCollectionType()), - field.getName(), _fields.size()); + FieldInfo fieldInfo(FieldType::INDEX, + field.getCollectionType(), + field.getName(), _fields.size()); fieldInfo.set_data_type(field.getDataType()); if (indexproperties::IsFilterField::check( _properties, field.getName())) @@ -62,19 +48,19 @@ IndexEnvironment::extractFields(const search::index::Schema &schema) } } for (const auto &attr : schema.getImportedAttributeFields()) { - search::fef::FieldInfo field(search::fef::FieldType::ATTRIBUTE, - convertCollectionType(attr.getCollectionType()), - attr.getName(), _fields.size()); + FieldInfo field(FieldType::ATTRIBUTE, + attr.getCollectionType(), + attr.getName(), _fields.size()); field.set_data_type(attr.getDataType()); insertField(field); } //TODO: This is a kludge to get [documentmetastore] searchable { - search::fef::FieldInfo fieldInfo(search::fef::FieldType::HIDDEN_ATTRIBUTE, - search::fef::CollectionType::SINGLE, - DocumentMetaStore::getFixedName(), - _fields.size()); + FieldInfo fieldInfo(FieldType::HIDDEN_ATTRIBUTE, + FieldInfo::CollectionType::SINGLE, + DocumentMetaStore::getFixedName(), + _fields.size()); fieldInfo.set_data_type(FieldInfo::DataType::RAW); fieldInfo.setFilter(true); insertField(fieldInfo); diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h index 08ac92d6f04..479427dd24a 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h @@ -14,13 +14,13 @@ private: struct EstimateMatchFrequency : vespalib::Rendezvous<Matches, double> { EstimateMatchFrequency(size_t n) : vespalib::Rendezvous<Matches, double>(n) {} - virtual void mingle(); + virtual void mingle() override; }; struct SelectBest : vespalib::Rendezvous<std::vector<feature_t>, size_t> { size_t topN; SelectBest(size_t n, size_t topN_in) : vespalib::Rendezvous<std::vector<feature_t>, size_t>(n), topN(topN_in) {} - virtual void mingle(); + virtual void mingle() override; bool cmp(const uint32_t &a, const uint32_t &b) { return (in(a)[out(a)] > in(b)[out(b)]); } @@ -35,7 +35,7 @@ private: struct RangeCover : vespalib::Rendezvous<RangePair, RangePair> { RangeCover(size_t n) : vespalib::Rendezvous<RangePair, RangePair>(n) {} - virtual void mingle(); + virtual void mingle() override; }; EstimateMatchFrequency _estimate_match_frequency; SelectBest _selectBest; @@ -45,13 +45,13 @@ public: MatchLoopCommunicator(size_t threads, size_t topN); ~MatchLoopCommunicator(); - virtual double estimate_match_frequency(const Matches &matches) { + virtual double estimate_match_frequency(const Matches &matches) override { return _estimate_match_frequency.rendezvous(matches); } - virtual size_t selectBest(const std::vector<feature_t> &sortedScores) { + virtual size_t selectBest(const std::vector<feature_t> &sortedScores) override { return _selectBest.rendezvous(sortedScores); } - virtual RangePair rangeCover(const RangePair &ranges) { + virtual RangePair rangeCover(const RangePair &ranges) override { return _rangeCover.rendezvous(ranges); } }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp index f971e2633de..7f4823e7eb5 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp @@ -23,15 +23,15 @@ struct TimedMatchLoopCommunicator : IMatchLoopCommunicator { IMatchLoopCommunicator &communicator; fastos::StopWatch rerank_time; TimedMatchLoopCommunicator(IMatchLoopCommunicator &com) : communicator(com) {} - virtual double estimate_match_frequency(const Matches &matches) { + virtual double estimate_match_frequency(const Matches &matches) override { return communicator.estimate_match_frequency(matches); } - virtual size_t selectBest(const std::vector<feature_t> &sortedScores) { + virtual size_t selectBest(const std::vector<feature_t> &sortedScores) override { size_t result = communicator.selectBest(sortedScores); rerank_time.start(); return result; } - virtual RangePair rangeCover(const RangePair &ranges) { + virtual RangePair rangeCover(const RangePair &ranges) override { RangePair result = communicator.rangeCover(ranges); rerank_time.stop(); return result; diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h index d20e71e370a..f924dfcf0a2 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h @@ -105,7 +105,7 @@ public: ResultProcessor &rp, vespalib::DualMergeDirector &md, uint32_t distributionKey); - virtual void run(); + virtual void run() override; const MatchingStats::Partition &get_thread_stats() const { return thread_stats; } double get_match_time() const { return match_time_s; } PartialResult::UP extract_result() { return std::move(resultContext->result); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h b/searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h index f0006925bfb..5616ef67d95 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h +++ b/searchcore/src/vespa/searchcore/proton/matching/matchdatareservevisitor.h @@ -23,7 +23,7 @@ public: template <class TermNode> void visitTerm(TermNode &n) { n.allocateTerms(_mdl); } - virtual void visit(ProtonNodeTypes::Equiv &n) { + virtual void visit(ProtonNodeTypes::Equiv &n) override { MatchDataReserveVisitor subAllocator(n.children_mdl); for (size_t i = 0; i < n.getChildren().size(); ++i) { n.getChildren()[i]->accept(subAllocator); diff --git a/searchcore/src/vespa/searchcore/proton/matching/partial_result.h b/searchcore/src/vespa/searchcore/proton/matching/partial_result.h index e39b0ed92f1..fb8245b1477 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/partial_result.h +++ b/searchcore/src/vespa/searchcore/proton/matching/partial_result.h @@ -47,7 +47,7 @@ public: _sortData.push_back(sd); _sortDataSize += sd.second; } - virtual void merge(Source &rhs); + virtual void merge(Source &rhs) override; }; } // namespace proton::matching diff --git a/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h b/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h index 475d058be9f..bf3d2c5c1ad 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h +++ b/searchcore/src/vespa/searchcore/proton/matching/resolveviewvisitor.h @@ -25,7 +25,7 @@ public: template <class TermNode> void visitTerm(TermNode &n) { n.resolve(_resolver, _indexEnv); } - virtual void visit(ProtonNodeTypes::Equiv &n) { + virtual void visit(ProtonNodeTypes::Equiv &n) override { visitChildren(n); n.resolveFromChildren(n.getChildren()); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h index ddb3fd253d3..ba5f473fcb1 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h +++ b/searchcore/src/vespa/searchcore/proton/matching/sessionmanager.h @@ -63,7 +63,7 @@ public: size_t getNumSearchSessions() const; std::vector<SearchSessionInfo> getSortedSearchSessionInfo() const; - void pruneTimedOutSessions(fastos::TimeStamp currentTime); + void pruneTimedOutSessions(fastos::TimeStamp currentTime) override; void close(); }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.cpp b/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.cpp index aa97a891d7f..68ff45e0213 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/termdataextractor.cpp @@ -30,14 +30,14 @@ public: } } - void visit(ProtonLocationTerm &) {} + void visit(ProtonLocationTerm &) override {} - virtual void visit(ProtonNodeTypes::AndNot &n) { + virtual void visit(ProtonNodeTypes::AndNot &n) override { assert(n.getChildren().size() > 0); n.getChildren()[0]->accept(*this); } - virtual void visit(ProtonNodeTypes::Equiv &n) { + virtual void visit(ProtonNodeTypes::Equiv &n) override { // XXX: unranked equiv not supported _term_data.push_back(&n); } diff --git a/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp b/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp index 81589cb38fd..b4076e87f7a 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/termdatafromnode.cpp @@ -19,29 +19,29 @@ struct TermDataFromTermVisitor data = &n; } - virtual void visit(ProtonAnd &) {} - virtual void visit(ProtonAndNot &) {} - virtual void visit(ProtonNear &) {} - virtual void visit(ProtonONear &) {} - virtual void visit(ProtonOr &) {} - virtual void visit(ProtonRank &) {} - virtual void visit(ProtonWeakAnd &) {} - - virtual void visit(ProtonWeightedSetTerm &n) { visitTerm(n); } - virtual void visit(ProtonDotProduct &n) { visitTerm(n); } - virtual void visit(ProtonWandTerm &n) { visitTerm(n); } - virtual void visit(ProtonPhrase &n) { visitTerm(n); } - virtual void visit(ProtonEquiv &n) { visitTerm(n); } - - virtual void visit(ProtonNumberTerm &n) { visitTerm(n); } - virtual void visit(ProtonLocationTerm &n) { visitTerm(n); } - virtual void visit(ProtonPrefixTerm &n) { visitTerm(n); } - virtual void visit(ProtonRangeTerm &n) { visitTerm(n); } - virtual void visit(ProtonStringTerm &n) { visitTerm(n); } - virtual void visit(ProtonSubstringTerm &n) { visitTerm(n); } - virtual void visit(ProtonSuffixTerm &n) { visitTerm(n); } - virtual void visit(ProtonPredicateQuery &) { } - virtual void visit(ProtonRegExpTerm &n) { visitTerm(n); } + virtual void visit(ProtonAnd &) override {} + virtual void visit(ProtonAndNot &) override {} + virtual void visit(ProtonNear &) override {} + virtual void visit(ProtonONear &) override {} + virtual void visit(ProtonOr &) override {} + virtual void visit(ProtonRank &) override {} + virtual void visit(ProtonWeakAnd &) override {} + + virtual void visit(ProtonWeightedSetTerm &n) override { visitTerm(n); } + virtual void visit(ProtonDotProduct &n) override { visitTerm(n); } + virtual void visit(ProtonWandTerm &n) override { visitTerm(n); } + virtual void visit(ProtonPhrase &n) override { visitTerm(n); } + virtual void visit(ProtonEquiv &n) override { visitTerm(n); } + + virtual void visit(ProtonNumberTerm &n) override { visitTerm(n); } + virtual void visit(ProtonLocationTerm &n) override { visitTerm(n); } + virtual void visit(ProtonPrefixTerm &n) override { visitTerm(n); } + virtual void visit(ProtonRangeTerm &n) override { visitTerm(n); } + virtual void visit(ProtonStringTerm &n) override { visitTerm(n); } + virtual void visit(ProtonSubstringTerm &n) override { visitTerm(n); } + virtual void visit(ProtonSuffixTerm &n) override { visitTerm(n); } + virtual void visit(ProtonPredicateQuery &) override { } + virtual void visit(ProtonRegExpTerm &n) override { visitTerm(n); } }; } // namespace diff --git a/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h b/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h index c877d5ed4c7..59df279739b 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h @@ -24,23 +24,23 @@ public: const searchcorespi::IFlushTarget &getTarget() const { return *_target; } // Implements searchcorespi::IFlushTarget - virtual MemoryGain getApproxMemoryGain() const { + virtual MemoryGain getApproxMemoryGain() const override { return _target->getApproxMemoryGain(); } - virtual DiskGain getApproxDiskGain() const { + virtual DiskGain getApproxDiskGain() const override { return _target->getApproxDiskGain(); } - virtual SerialNum getFlushedSerialNum() const { + virtual SerialNum getFlushedSerialNum() const override { return _target->getFlushedSerialNum(); } - virtual Time getLastFlushTime() const { + virtual Time getLastFlushTime() const override { return _target->getLastFlushTime(); } - virtual bool needUrgentFlush() const { + virtual bool needUrgentFlush() const override { return _target->needUrgentFlush(); } - virtual searchcorespi::FlushTask::UP initFlush(SerialNum currentSerial); - virtual searchcorespi::FlushStats getLastFlushStats() const { + virtual searchcorespi::FlushTask::UP initFlush(SerialNum currentSerial) override; + virtual searchcorespi::FlushStats getLastFlushStats() const override { return _target->getLastFlushStats(); } diff --git a/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_task.h b/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_task.h index fdd11a66dbb..b2bff7321e1 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_task.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_task.h @@ -20,8 +20,8 @@ public: searchcorespi::FlushTask::UP task); // Implements searchcorespi::FlushTask - virtual void run(); - virtual search::SerialNum getFlushSerial() const { + virtual void run() override; + virtual search::SerialNum getFlushSerial() const override { return _task->getFlushSerial(); } }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/job_tracker.h b/searchcore/src/vespa/searchcore/proton/metrics/job_tracker.h index fb5f9b336f3..3826afc2bc4 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/job_tracker.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/job_tracker.h @@ -30,8 +30,8 @@ public: double sampleLoad(time_point now, const std::lock_guard<std::mutex> &guard); // Implements IJobTracker - virtual void start(); - virtual void end(); + virtual void start() override; + virtual void end() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h index 6d668bc1839..e901662990b 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/metrics_engine.h @@ -51,7 +51,7 @@ public: LegacyAttributeMetrics *totalAttributes, const std::string &name) override; virtual void cleanAttributes(const AttributeMetricsCollection &subAttributes, - LegacyAttributeMetrics *totalAttributes); + LegacyAttributeMetrics *totalAttributes) override; virtual void addRankProfile(LegacyDocumentDBMetrics &owner, const std::string &name, size_t numDocIdPartitions) override; diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp index 289f51ac195..2a17cb97952 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp @@ -86,7 +86,7 @@ public: : _bucketSet() { } ~BucketIdListResultHandler(); - virtual void handle(const BucketIdListResult &result) { + virtual void handle(const BucketIdListResult &result) override { const BucketIdListResult::List &buckets = result.getList(); for (size_t i = 0; i < buckets.size(); ++i) { _bucketSet.insert(buckets[i]); @@ -114,7 +114,7 @@ public: BucketIdListResultHandler() { } ~SynchronizedBucketIdListResultHandler(); - virtual void handle(const BucketIdListResult &result) { + virtual void handle(const BucketIdListResult &result) override { { vespalib::LockGuard guard(_lock); BucketIdListResultHandler::handle(result); @@ -136,7 +136,7 @@ public: { } ~BucketInfoResultHandler(); - virtual void handle(const BucketInfoResult &result) { + virtual void handle(const BucketInfoResult &result) override { if (_first) { _result = result; _first = false; @@ -182,9 +182,9 @@ class SequenceOfOne : public Sequence<T> { public: SequenceOfOne(const T &value) : _done(false), _value(value) {} - virtual bool valid() const { return !_done; } - virtual T get() const { return _value; } - virtual void next() { _done = true; } + virtual bool valid() const override { return !_done; } + virtual T get() const override { return _value; } + virtual void next() override { _done = true; } }; template <typename T> @@ -273,7 +273,7 @@ PersistenceEngine::initialize() } -PartitionStateListResult +PersistenceEngine::PartitionStateListResult PersistenceEngine::getPartitionStates() const { PartitionStateList list(1); @@ -388,7 +388,7 @@ PersistenceEngine::put(const Bucket& b, Timestamp t, const document::Document::S return latch.getResult(); } -RemoveResult +PersistenceEngine::RemoveResult PersistenceEngine::remove(const Bucket& b, Timestamp t, const DocumentId& did, Context&) { std::shared_lock<std::shared_timed_mutex> rguard(_rwMutex); @@ -412,7 +412,7 @@ PersistenceEngine::remove(const Bucket& b, Timestamp t, const DocumentId& did, C } -UpdateResult +PersistenceEngine::UpdateResult PersistenceEngine::update(const Bucket& b, Timestamp t, const DocumentUpdate::SP& upd, Context&) { if (!_writeFilter.acceptWriteOperation()) { @@ -446,7 +446,7 @@ PersistenceEngine::update(const Bucket& b, Timestamp t, const DocumentUpdate::SP } -GetResult +PersistenceEngine::GetResult PersistenceEngine::get(const Bucket& b, const document::FieldSet& fields, const DocumentId& did, @@ -478,7 +478,7 @@ PersistenceEngine::get(const Bucket& b, } -CreateIteratorResult +PersistenceEngine::CreateIteratorResult PersistenceEngine::createIterator(const Bucket &bucket, const document::FieldSet& fields, const Selection &selection, @@ -508,7 +508,7 @@ PersistenceEngine::createIterator(const Bucket &bucket, } -IterateResult +PersistenceEngine::IterateResult PersistenceEngine::iterate(IteratorId id, uint64_t maxByteSize, Context&) const { std::shared_lock<std::shared_timed_mutex> rguard(_rwMutex); @@ -688,7 +688,7 @@ PersistenceEngine::saveClusterState(const ClusterState &calc) } } -ClusterState::SP +PersistenceEngine::ClusterState::SP PersistenceEngine::savedClusterState(void) const { LockGuard guard(_lock); @@ -728,7 +728,7 @@ private: public: ActiveBucketIdListResultHandler() : _bucketMap() { } - virtual void handle(const BucketIdListResult &result) { + virtual void handle(const BucketIdListResult &result) override { const BucketIdListResult::List &buckets = result.getList(); for (size_t i = 0; i < buckets.size(); ++i) { IR ir(_bucketMap.insert(std::make_pair(buckets[i], 1u))); diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h index a651b85f705..40d59453673 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h @@ -12,34 +12,32 @@ namespace proton { -using document::DocumentUpdate; -using storage::spi::Bucket; -using storage::spi::BucketIdListResult; -using storage::spi::BucketInfo; -using storage::spi::BucketInfoResult; -using storage::spi::ClusterState; -using storage::spi::Context; -using storage::spi::CreateIteratorResult; -using storage::spi::GetResult; -using storage::spi::IncludedVersions; -using storage::spi::IterateResult; -using storage::spi::IteratorId; -using storage::spi::MaintenanceLevel; -using storage::spi::PartitionId; -using storage::spi::PartitionStateListResult; -using storage::spi::RemoveResult; -using storage::spi::Result; -using storage::spi::Selection; -using storage::spi::Timestamp; -using storage::spi::TimestampList; -using storage::spi::UpdateResult; - class IPersistenceEngineOwner; class PersistenceEngine : public storage::spi::AbstractPersistenceProvider { private: typedef vespalib::Sequence<IPersistenceHandler *> PersistenceHandlerSequence; - + using DocumentUpdate = document::DocumentUpdate; + using Bucket = storage::spi::Bucket; + using BucketIdListResult = storage::spi::BucketIdListResult; + using BucketInfo = storage::spi::BucketInfo; + using BucketInfoResult = storage::spi::BucketInfoResult; + using ClusterState = storage::spi::ClusterState; + using Context = storage::spi::Context; + using CreateIteratorResult = storage::spi::CreateIteratorResult; + using GetResult = storage::spi::GetResult; + using IncludedVersions = storage::spi::IncludedVersions; + using IterateResult = storage::spi::IterateResult; + using IteratorId = storage::spi::IteratorId; + using MaintenanceLevel = storage::spi::MaintenanceLevel; + using PartitionId = storage::spi::PartitionId; + using PartitionStateListResult = storage::spi::PartitionStateListResult; + using RemoveResult = storage::spi::RemoveResult; + using Result = storage::spi::Result; + using Selection = storage::spi::Selection; + using Timestamp = storage::spi::Timestamp; + using TimestampList = storage::spi::TimestampList; + using UpdateResult = storage::spi::UpdateResult; class HandlerSnapshot { private: PersistenceHandlerSequence::UP _handlers; @@ -114,7 +112,7 @@ public: virtual BucketIdListResult listBuckets(PartitionId) const override; virtual Result setClusterState(const ClusterState& calc) override; virtual Result setActiveState(const Bucket& bucket, BucketInfo::ActiveState newState) override; - virtual BucketInfoResult getBucketInfo(const Bucket&) const; + virtual BucketInfoResult getBucketInfo(const Bucket&) const override; virtual Result put(const Bucket&, Timestamp, const document::Document::SP&, Context&) override; virtual RemoveResult remove(const Bucket&, Timestamp, const document::DocumentId&, Context&) override; virtual UpdateResult update(const Bucket&, Timestamp, const document::DocumentUpdate::SP&, Context&) override; diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h index fcc9c362306..d802b8da8ac 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h @@ -23,7 +23,7 @@ public: virtual void send(mbus::Reply::UP reply, ResultUP result, bool documentWasFound, - double latency_ms); + double latency_ms) override; void await() { _latch.await(); } diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp index 33b27f947c7..e572a5494f3 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp @@ -5,6 +5,7 @@ #include <vespa/searchcore/proton/attribute/attribute_populator.h> #include <vespa/searchcore/proton/attribute/document_field_populator.h> #include <vespa/searchcore/proton/attribute/filter_attribute_manager.h> +#include <vespa/searchlib/attribute/attributevector.h> #include <vespa/log/log.h> LOG_SETUP(".proton.reprocessing.attribute_reprocessing_initializer"); @@ -13,6 +14,7 @@ using namespace search::index; using search::AttributeGuard; using search::AttributeVector; using search::SerialNum; +using search::index::schema::DataType; namespace proton { @@ -30,7 +32,7 @@ toStr(bool value) bool fastPartialUpdateAttribute(const schema::DataType &attrType) { // Partial update to tensor or predicate attribute must update document - return ((attrType != schema::BOOLEANTREE) && (attrType != schema::TENSOR) && (attrType != schema::DataType::REFERENCE)); + return ((attrType != DataType::BOOLEANTREE) && (attrType != DataType::TENSOR) && (attrType != DataType::REFERENCE)); } @@ -101,7 +103,7 @@ getFieldsToPopulate(const ARIConfig &newCfg, bool unchangedField = inspector.hasUnchangedField(name); // NOTE: If it is a string and index field we shall // keep the original in order to preserve annotations. - bool isStringIndexField = attrField.getDataType() == schema::STRING && + bool isStringIndexField = attrField.getDataType() == DataType::STRING && newCfg.getSchema().isIndexField(name); bool populateField = !inNewAttrMgr && unchangedField && !isStringIndexField && fastPartialUpdateAttribute(attrType); diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h index feaff2030bb..05aa10db4e5 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.h @@ -47,9 +47,9 @@ public: search::SerialNum serialNum); // Implements IReprocessingInitializer - virtual bool hasReprocessors() const; + virtual bool hasReprocessors() const override; - virtual void initialize(IReprocessingHandler &handler); + virtual void initialize(IReprocessingHandler &handler) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/document_reprocessing_handler.h b/searchcore/src/vespa/searchcore/proton/reprocessing/document_reprocessing_handler.h index f950e3b61a9..0f7feed137e 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/document_reprocessing_handler.h +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/document_reprocessing_handler.h @@ -25,7 +25,7 @@ private: public: RewriteVisitor(DocumentReprocessingHandler &handler) : _handler(handler) {} // Implements search::IDocumentStoreRewriteVisitor - virtual void visit(uint32_t lid, document::Document &doc) { + virtual void visit(uint32_t lid, document::Document &doc) override { _handler.rewriteVisit(lid, doc); } }; @@ -57,18 +57,18 @@ public: } // Implements IReprocessingHandler - virtual void addReader(const IReprocessingReader::SP &reader) { + virtual void addReader(const IReprocessingReader::SP &reader) override { _readers.push_back(reader); } - virtual void addRewriter(const IReprocessingRewriter::SP &rewriter) { + virtual void addRewriter(const IReprocessingRewriter::SP &rewriter) override { _rewriters.push_back(rewriter); } // Implements search::IDocumentStoreReadVisitor - virtual void visit(uint32_t lid, const document::Document &doc); + virtual void visit(uint32_t lid, const document::Document &doc) override; - virtual void visit(uint32_t lid); + virtual void visit(uint32_t lid) override; void done(); }; diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/i_reprocessing_reader.h b/searchcore/src/vespa/searchcore/proton/reprocessing/i_reprocessing_reader.h index f8c800f6e2e..f75ab92550a 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/i_reprocessing_reader.h +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/i_reprocessing_reader.h @@ -20,7 +20,9 @@ struct IReprocessingReader * Handle the given existing document. */ virtual void handleExisting(uint32_t lid, const document::Document &doc) = 0; - virtual void done() = 0; + + // signals that there are no more documents + virtual void done() {} }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h b/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h index 013f9e9f004..a30dfb81b94 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/reprocess_documents_task.h @@ -38,13 +38,12 @@ public: uint32_t docIdLimit); virtual void - run(); + run() override; virtual void - updateProgress(double progress); + updateProgress(double progress) override; - virtual Progress - getProgress() const; + virtual Progress getProgress() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/attribute_writer_factory.h b/searchcore/src/vespa/searchcore/proton/server/attribute_writer_factory.h index 0de74f4a4ee..0ba79025f21 100644 --- a/searchcore/src/vespa/searchcore/proton/server/attribute_writer_factory.h +++ b/searchcore/src/vespa/searchcore/proton/server/attribute_writer_factory.h @@ -14,7 +14,7 @@ struct AttributeWriterFactory : public IAttributeWriterFactory { AttributeWriterFactory() {} virtual IAttributeWriter::SP create(const IAttributeWriter::SP &old, - const AttributeCollectionSpec &attrSpec) const + const AttributeCollectionSpec &attrSpec) const override { const AttributeWriter &oldAdapter = dynamic_cast<const AttributeWriter &>(*old.get()); const proton::IAttributeManager::SP &oldMgr = oldAdapter.getAttributeManager(); diff --git a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp index aa2cb4e982d..8eb229a5e6b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.cpp @@ -33,25 +33,25 @@ public: } virtual bool - shouldBeReady(const document::BucketId &bucket) const + shouldBeReady(const document::BucketId &bucket) const override { return _calc.shouldBeReady(Bucket(bucket, PartitionId(0))); } virtual bool - clusterUp(void) const + clusterUp(void) const override { return _calc.clusterUp(); } virtual bool - nodeUp(void) const + nodeUp(void) const override { return _calc.nodeUp(); } virtual bool - nodeInitializing() const + nodeInitializing() const override { return _calc.nodeInitializing(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.h b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.h index aeb48804031..b666a0612ef 100644 --- a/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.h +++ b/searchcore/src/vespa/searchcore/proton/server/clusterstatehandler.h @@ -35,7 +35,7 @@ private: // Implements IBucketModifiedHandler virtual void - notifyBucketModified(const document::BucketId &bucket); + notifyBucketModified(const document::BucketId &bucket) override; public: ClusterStateHandler(vespalib::Executor &executor); @@ -44,10 +44,10 @@ public: ~ClusterStateHandler(); virtual void - addClusterStateChangedHandler(IClusterStateChangedHandler *handler); + addClusterStateChangedHandler(IClusterStateChangedHandler *handler) override; virtual void - removeClusterStateChangedHandler(IClusterStateChangedHandler *handler); + removeClusterStateChangedHandler(IClusterStateChangedHandler *handler) override; /** * Implements the cluster state aspect of IPersistenceHandler. diff --git a/searchcore/src/vespa/searchcore/proton/server/docstorevalidator.h b/searchcore/src/vespa/searchcore/proton/server/docstorevalidator.h index 6057a801460..f0eaa4bb01d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/docstorevalidator.h +++ b/searchcore/src/vespa/searchcore/proton/server/docstorevalidator.h @@ -21,8 +21,8 @@ class DocStoreValidator : public search::IDocumentStoreReadVisitor public: DocStoreValidator(IDocumentMetaStore &dms); - virtual void visit(uint32_t lid, const document::Document &doc); - virtual void visit(uint32_t lid); + virtual void visit(uint32_t lid, const document::Document &doc) override; + virtual void visit(uint32_t lid) override; void visitDone(void); void killOrphans(search::IDocumentStore &store, search::SerialNum serialNum); diff --git a/searchcore/src/vespa/searchcore/proton/server/document_meta_store_read_guards.cpp b/searchcore/src/vespa/searchcore/proton/server/document_meta_store_read_guards.cpp index 680dadda5dd..24ff8fd4272 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_meta_store_read_guards.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/document_meta_store_read_guards.cpp @@ -2,6 +2,7 @@ #include "document_meta_store_read_guards.h" #include "documentsubdbcollection.h" +#include "idocumentsubdb.h" namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/document_scan_iterator.h b/searchcore/src/vespa/searchcore/proton/server/document_scan_iterator.h index eed523ed058..d5767ed2353 100644 --- a/searchcore/src/vespa/searchcore/proton/server/document_scan_iterator.h +++ b/searchcore/src/vespa/searchcore/proton/server/document_scan_iterator.h @@ -23,11 +23,11 @@ public: DocumentScanIterator(const IDocumentMetaStore &_metaStore); // Implements IDocumentScanIterator - virtual bool valid() const; + virtual bool valid() const override; virtual search::DocumentMetaData next(uint32_t compactLidLimit, uint32_t maxDocsToScan, - bool retry); + bool retry) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index d64a57f78e3..0d74b015754 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -16,11 +16,15 @@ #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchcore/proton/common/schemautil.h> +#include <vespa/searchcore/proton/common/statusreport.h> #include <vespa/searchcore/proton/index/index_writer.h> #include <vespa/searchcore/proton/initializer/task_runner.h> +#include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h> +#include <vespa/searchcore/proton/metrics/metricswireservice.h> #include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h> #include <vespa/searchcore/proton/reference/i_document_db_reference_registry.h> #include <vespa/searchcore/proton/reference/document_db_reference_resolver.h> +#include <vespa/searchcore/proton/docsummary/isummarymanager.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/configconverter.h> #include <vespa/searchlib/engine/docsumreply.h> @@ -36,7 +40,6 @@ using vespa::config::search::AttributesConfig; using vespa::config::search::core::ProtonConfig; using search::index::SchemaBuilder; using vespalib::JSONStringer; -using vespalib::FileHeader; using vespalib::Executor; using vespalib::IllegalStateException; using vespalib::StateExplorer; @@ -45,7 +48,6 @@ using vespalib::makeTask; using vespalib::makeClosure; using namespace proton::matching; using namespace search; -using namespace search::docsummary; using namespace search::engine; using namespace search::fef; using namespace search::index; @@ -57,6 +59,7 @@ using search::common::FileHeaderContext; using proton::initializer::InitializerTask; using proton::initializer::TaskRunner; using search::makeLambdaTask; +using searchcorespi::IFlushTarget; namespace proton { @@ -97,8 +100,8 @@ DocumentDB::DocumentDB(const vespalib::string &baseDir, const HwInfo &hwInfo) : IDocumentDBConfigOwner(), IReplayConfig(), - FeedHandler::IOwner(), - IDocumentSubDB::IOwner(), + IFeedHandlerOwner(), + IDocumentSubDBOwner(), IClusterStateChangedHandler(), IWipeOldRemovedFieldsHandler(), search::transactionlog::SyncProxy(), diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h index 3b6c335f1e6..d01ae7618f6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h @@ -9,25 +9,19 @@ #include "documentdbconfig.h" #include "documentsubdbcollection.h" #include "feedhandler.h" +#include "i_feed_handler_owner.h" #include "i_lid_space_compaction_handler.h" #include "ifeedview.h" #include "ireplayconfig.h" #include "iwipeoldremovedfieldshandler.h" #include "maintenancecontroller.h" #include "i_document_db_config_owner.h" -#include "searchable_doc_subdb_configurer.h" -#include "searchabledocsubdb.h" -#include "summaryadapter.h" +#include "executorthreadingservice.h" #include "visibilityhandler.h" +#include "i_document_subdb_owner.h" -#include <vespa/searchcore/proton/attribute/attributemanager.h> -#include <vespa/searchcore/proton/attribute/i_attribute_writer.h> #include <vespa/searchcore/proton/common/doctypename.h> -#include <vespa/searchcore/proton/common/statusreport.h> #include <vespa/searchcore/proton/common/monitored_refcount.h> -#include <vespa/searchcore/proton/docsummary/summarymanager.h> -#include <vespa/searchcore/proton/documentmetastore/i_document_meta_store.h> -#include <vespa/searchcore/proton/index/i_index_writer.h> #include <vespa/searchcore/proton/matching/sessionmanager.h> #include <vespa/searchcore/proton/metrics/documentdb_job_trackers.h> #include <vespa/searchcore/proton/metrics/documentdb_metrics_collection.h> @@ -42,8 +36,6 @@ #include <mutex> #include <condition_variable> -using vespa::config::search::core::ProtonConfig; - namespace search { @@ -58,8 +50,9 @@ namespace transactionlog { class TransLogClient; } } // namespace search namespace proton { -class MetricsWireService; class IDocumentDBOwner; +class MetricsWireService; +class StatusReport; namespace configvalidator { class Result; } @@ -71,8 +64,8 @@ namespace configvalidator { class Result; } */ class DocumentDB : public IDocumentDBConfigOwner, public IReplayConfig, - public FeedHandler::IOwner, - public IDocumentSubDB::IOwner, + public IFeedHandlerOwner, + public IDocumentSubDBOwner, public IClusterStateChangedHandler, public IWipeOldRemovedFieldsHandler, public search::transactionlog::SyncProxy @@ -92,6 +85,9 @@ private: using InitializeThreads = std::shared_ptr<vespalib::ThreadStackExecutorBase>; + using IFlushTargetList = std::vector<std::shared_ptr<searchcorespi::IFlushTarget>>; + using StatusReportUP = std::unique_ptr<StatusReport>; + using ProtonConfig = vespa::config::search::core::ProtonConfig; DocTypeName _docTypeName; vespalib::string _baseDir; @@ -192,7 +188,7 @@ private: * Redo interrupted reprocessing if last entry in transaction log * is a config change. */ - virtual void enterRedoReprocessState(); + virtual void enterRedoReprocessState() override; void enterApplyLiveConfigState(); /** @@ -208,17 +204,17 @@ private: void performDropFeedView2(IFeedView::SP feedView); /** - * Implements FeedHandler::IOwner + * Implements IFeedHandlerOwner */ - virtual void onTransactionLogReplayDone() __attribute__((noinline)); - virtual void onPerformPrune(SerialNum flushedSerial); - virtual bool isFeedBlockedByRejectedConfig(); + virtual void onTransactionLogReplayDone() override __attribute__((noinline)); + virtual void onPerformPrune(SerialNum flushedSerial) override; + virtual bool isFeedBlockedByRejectedConfig() override; /** - * Implements FeedHandler::IOwner + * Implements IFeedHandlerOwner **/ - virtual void performWipeHistory(); - virtual bool getAllowPrune(void) const; + virtual void performWipeHistory() override; + virtual bool getAllowPrune(void) const override; void writeWipeHistoryTransactionLogEntry( @@ -235,13 +231,13 @@ private: /** * Implements IClusterStateChangedHandler */ - virtual void notifyClusterStateChanged(const IBucketStateCalculator::SP &newCalc); + virtual void notifyClusterStateChanged(const IBucketStateCalculator::SP &newCalc) override; void notifyAllBucketsChanged(); /** * Implements IWipeOldRemovedFieldsHandler */ - virtual void wipeOldRemovedFields(TimeStamp wipeTimeLimit); + virtual void wipeOldRemovedFields(TimeStamp wipeTimeLimit) override; void updateLegacyMetrics(LegacyDocumentDBMetrics &metrics); void updateMetrics(DocumentDBTaggedMetrics &metrics); void updateMetrics(DocumentDBTaggedMetrics::AttributeMetrics &metrics); @@ -413,7 +409,7 @@ public: std::unique_ptr<search::engine::DocsumReply> getDocsums(const search::engine::DocsumRequest & request); - IFlushTarget::List getFlushTargets(); + IFlushTargetList getFlushTargets(); void flushDone(SerialNum flushedSerial); virtual SerialNum @@ -425,7 +421,7 @@ public: return _feedHandler.getSerialNum(); } - StatusReport::UP reportStatus() const; + StatusReportUP reportStatus() const; /** * Reference counting @@ -439,9 +435,9 @@ public: /** * Implements IReplayConfig API. */ - virtual void replayConfig(SerialNum serialNum); + virtual void replayConfig(SerialNum serialNum) override; - virtual void replayWipeHistory(SerialNum serialNum, TimeStamp wipeTimeLimit); + virtual void replayWipeHistory(SerialNum serialNum, TimeStamp wipeTimeLimit) override; const DocTypeName & getDocTypeName(void) const { return _docTypeName; } @@ -454,11 +450,11 @@ public: void newConfigSnapshot(DocumentDBConfig::SP snapshot); // Implements DocumentDBConfigOwner - void reconfigure(const DocumentDBConfig::SP & snapshot); + void reconfigure(const DocumentDBConfig::SP & snapshot) override; int64_t getActiveGeneration() const; - // Implements IDocSubDB::IOwner + // Implements IDocumentSubDBOwner void syncFeedView() override; std::shared_ptr<searchcorespi::IIndexManagerFactory> @@ -468,7 +464,7 @@ public: uint32_t getDistributionKey() const override; /** - * Implements FeedHandler::IOwner + * Implements IFeedHandlerOwner **/ void injectMaintenanceJobs(const DocumentDBMaintenanceConfig &config); void performStartMaintenance(void); @@ -488,7 +484,7 @@ public: * * Sync transaction log to syncTo. */ - virtual void sync(SerialNum syncTo); + virtual void sync(SerialNum syncTo) override; void enterReprocessState(); void enterOnlineState(); void waitForOnlineState(); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp index 5dd4520e2b0..5aa608607a3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp @@ -13,11 +13,12 @@ using proton::matching::SessionManager; using search::index::Schema; using search::SerialNum; using vespa::config::search::core::ProtonConfig; +using searchcorespi::IFlushTarget; namespace proton { DocumentSubDBCollection::DocumentSubDBCollection( - IDocumentSubDB::IOwner &owner, + IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer, const IGetSerialNum &getSerialNum, const DocTypeName &docTypeName, diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h index 5114c656231..3a1b883fb25 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h @@ -1,22 +1,30 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include "ibucketstatecalculator.h" -#include "idocumentsubdb.h" -#include "ifeedview.h" -#include "searchable_doc_subdb_configurer.h" +#include <vespa/vespalib/util/varholder.h> #include <vespa/searchcore/config/config-proton.h> -#include <vespa/searchcore/proton/matching/sessionmanager.h> -#include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h> -#include <vespa/searchcorespi/flush/iflushtarget.h> -#include <vespa/searchcorespi/index/ithreadingservice.h> #include <vespa/searchlib/common/serialnum.h> -#include <vespa/searchlib/transactionlog/syncproxy.h> #include <vespa/searchcore/proton/reprocessing/reprocessingrunner.h> #include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h> -#include <vespa/searchcore/proton/initializer/initializer_task.h> #include <mutex> +namespace vespalib +{ +class Clock; +class ThreadExecutor; +class ThreadStackExecutorBase; +} + +namespace search { +namespace common { class FileHeaderContext; } +namespace transactionlog { class SyncProxy; } +} + +namespace searchcorespi { +class IFlushTarget; +namespace index { class IThreadingService; } +} + namespace proton { class DocumentDBConfig; class DocumentDBMetricsCollection; @@ -25,6 +33,22 @@ class MetricsWireService; class ICommitable; class IDocumentDBReferenceResolver; class IGetSerialNum; +class DocTypeName; +class HwInfo; +class IFeedView; +struct IBucketStateCalculator; +class IDocumentSubDBOwner; +class IDocumentSubDB; +class IDocumentRetriever; +class IRreprocessingTask; +class ReconfigParams; + +namespace matching { +class QueryLimiter; +class SessionManager; +} + +namespace initializer { class InitializerTask; } class DocumentSubDBCollection { public: @@ -33,8 +57,12 @@ public: typedef search::SerialNum SerialNum; private: + using IFeedViewSP = std::shared_ptr<IFeedView>; + using IBucketStateCalculatorSP = std::shared_ptr<IBucketStateCalculator>; + using SessionManagerSP = std::shared_ptr<matching::SessionManager>; + using IFlushTargetList = std::vector<std::shared_ptr<searchcorespi::IFlushTarget>>; SubDBVector _subDBs; - IBucketStateCalculator::SP _calc; + IBucketStateCalculatorSP _calc; const uint32_t _readySubDbId; const uint32_t _remSubDbId; const uint32_t _notReadySubDbId; @@ -47,7 +75,7 @@ private: public: DocumentSubDBCollection( - IDocumentSubDB::IOwner &owner, + IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer, const IGetSerialNum &getSerialNum, const DocTypeName &docTypeName, @@ -65,7 +93,7 @@ public: const HwInfo &hwInfo); ~DocumentSubDBCollection(); - void setBucketStateCalculator(const IBucketStateCalculator::SP &calc) { + void setBucketStateCalculator(const IBucketStateCalculatorSP &calc) { _calc = calc; } @@ -93,7 +121,7 @@ public: return *_bucketDBHandler; } - initializer::InitializerTask::SP + std::shared_ptr<initializer::InitializerTask> createInitializer(const DocumentDBConfig &configSnapshot, SerialNum configSerialNum, const vespa::config::search::core::ProtonConfig::Summary &protonSummaryCfg, @@ -101,7 +129,7 @@ public: void initViews(const DocumentDBConfig &configSnapshot, - const matching::SessionManager::SP &sessionManager); + const SessionManagerSP &sessionManager); void clearViews(void); void onReplayDone(void); @@ -119,8 +147,8 @@ public: const ReconfigParams ¶ms, IDocumentDBReferenceResolver &resolver); - IFeedView::SP getFeedView(); - IFlushTarget::List getFlushTargets(); + IFeedViewSP getFeedView(); + IFlushTargetList getFlushTargets(); ReprocessingRunner &getReprocessingRunner() { return _reprocessingRunner; } double getReprocessingProgress() const; void close(); diff --git a/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.h b/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.h index e2332d6ab94..c9e49eb1469 100644 --- a/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.h +++ b/searchcore/src/vespa/searchcore/proton/server/executor_thread_service.h @@ -22,15 +22,15 @@ public: /** * Implements IThreadService */ - virtual vespalib::Executor::Task::UP execute(vespalib::Executor::Task::UP task) { + virtual vespalib::Executor::Task::UP execute(vespalib::Executor::Task::UP task) override { return _executor.execute(std::move(task)); } - virtual void run(vespalib::Runnable &runnable); - virtual vespalib::Syncable &sync() { + virtual void run(vespalib::Runnable &runnable) override; + virtual vespalib::Syncable &sync() override { _executor.sync(); return *this; } - virtual bool isCurrentThread() const; + virtual bool isCurrentThread() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h index 2cf63363f6f..111d28d7b37 100644 --- a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h +++ b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h @@ -39,7 +39,7 @@ public: /** * Implements vespalib::Syncable */ - virtual vespalib::Syncable &sync(); + virtual vespalib::Syncable &sync() override; void shutdown(); @@ -58,10 +58,10 @@ public: /** * Implements IThreadingService */ - virtual searchcorespi::index::IThreadService &master() { + virtual searchcorespi::index::IThreadService &master() override { return _masterService; } - virtual searchcorespi::index::IThreadService &index() { + virtual searchcorespi::index::IThreadService &index() override { return _indexService; } diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp index 2619f25f85d..0337673b9da 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp @@ -6,6 +6,7 @@ #include "fast_access_document_retriever.h" #include "document_subdb_initializer.h" #include "reconfig_params.h" +#include "i_document_subdb_owner.h" #include <vespa/searchcore/proton/attribute/attribute_collection_spec_factory.h> #include <vespa/searchcore/proton/attribute/attribute_factory.h> #include <vespa/searchcore/proton/attribute/attribute_manager_initializer.h> @@ -27,6 +28,7 @@ using search::AttributeVector; using search::SerialNum; using search::index::Schema; using proton::initializer::InitializerTask; +using searchcorespi::IFlushTarget; namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h index dad703c174b..4fff4be5a75 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h @@ -89,7 +89,7 @@ protected: AttributeCollectionSpec::UP createAttributeSpec(const AttributeSpecs &attrCfg, SerialNum serialNum) const; AttributeManager::SP getAndResetInitAttributeManager(); - virtual IFlushTarget::List getFlushTargetsInternal(); + virtual IFlushTargetList getFlushTargetsInternal() override; void reconfigureAttributeMetrics(const IAttributeManager &newMgr, const IAttributeManager &oldMgr); IReprocessingTask::UP diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index 6cdf87eaaaf..f2d17df16bf 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -5,6 +5,8 @@ #include "replaypacketdispatcher.h" #include "tlcproxy.h" #include "ddbstate.h" +#include "i_feed_handler_owner.h" +#include "ifeedview.h" #include <vespa/documentapi/messagebus/documentprotocol.h> #include <vespa/documentapi/messagebus/messages/documentreply.h> #include <vespa/documentapi/messagebus/messages/feedreply.h> @@ -15,6 +17,7 @@ #include <vespa/searchcore/proton/feedoperation/operations.h> #include <vespa/searchcore/proton/persistenceengine/transport_latch.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> +#include <vespa/searchcorespi/index/ithreadingservice.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> #include <vespa/vespalib/util/exceptions.h> @@ -37,7 +40,6 @@ using storage::spi::Timestamp; using storage::spi::UpdateResult; using vespalib::Executor; using vespalib::IllegalStateException; -using vespalib::ThreadStackExecutorBase; using vespalib::makeClosure; using vespalib::makeTask; using vespalib::make_string; @@ -510,7 +512,7 @@ FeedHandler::FeedHandler(IThreadingService &writeService, const DocTypeName &docTypeName, PerDocTypeFeedMetrics &metrics, DDBState &state, - IOwner &owner, + IFeedHandlerOwner &owner, const IResourceWriteFilter &writeFilter, IReplayConfig &replayConfig, search::transactionlog::Writer *tlsDirectWriter, diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.h b/searchcore/src/vespa/searchcore/proton/server/feedhandler.h index 4c6e9966052..726039e0be7 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.h @@ -2,29 +2,38 @@ #pragma once -#include "feedstate.h" #include "i_operation_storer.h" #include "idocumentmovehandler.h" -#include "ifeedview.h" #include "igetserialnum.h" #include "iheartbeathandler.h" #include "ipruneremoveddocumentshandler.h" -#include "ireplayconfig.h" #include "tlswriter.h" #include "transactionlogmanager.h" +#include <persistence/spi/types.h> #include <vespa/searchcore/proton/common/doctypename.h> -#include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> -#include <vespa/searchcorespi/index/ithreadingservice.h> #include <vespa/searchlib/transactionlog/translogclient.h> -#include <vespa/vespalib/util/blockingthreadstackexecutor.h> -#include <vespa/vespalib/util/executor.h> + +namespace searchcorespi { namespace index { class IThreadingService; } } namespace proton { class ConfigStore; -class FeedConfigStore; -class IDocumentDBOwner; class CreateBucketOperation; class DDBState; +class DeleteBucketOperation; +class FeedConfigStore; +class FeedState; +class FeedToken; +class IDocumentDBOwner; +class IFeedHandlerOwner; +class IFeedView; +class IResourceWriteFilter; +class IReplayConfig; +class JoinBucketsOperation; +class PerDocTypeFeedMetrics; +class PutOperation; +class RemoveOperation; +class SplitBucketOperation; +class UpdateOperation; namespace bucketdb { @@ -50,22 +59,10 @@ private: typedef search::SerialNum SerialNum; typedef storage::spi::Timestamp Timestamp; typedef document::BucketId BucketId; + using FeedStateSP = std::shared_ptr<FeedState>; + using FeedTokenUP = std::unique_ptr<FeedToken>; + using FeedOperationUP = std::unique_ptr<FeedOperation>; -public: - /** - * Interface defining the communication needed with the owner of the feed handler. - */ - struct IOwner { - virtual ~IOwner() {} - virtual void performWipeHistory() = 0; - virtual void onTransactionLogReplayDone() = 0; - virtual void enterRedoReprocessState() = 0; - virtual void onPerformPrune(SerialNum flushedSerial) = 0; - virtual bool isFeedBlockedByRejectedConfig() = 0; - virtual bool getAllowPrune() const = 0; - }; - -private: class TlsMgrWriter : public TlsWriter { TransactionLogManager &_tls_mgr; search::transactionlog::Writer *_tlsDirectWriter; @@ -75,18 +72,18 @@ private: _tls_mgr(tls_mgr), _tlsDirectWriter(tlsDirectWriter) { } - virtual void storeOperation(const FeedOperation &op); - virtual bool erase(SerialNum oldest_to_keep); + virtual void storeOperation(const FeedOperation &op) override; + virtual bool erase(SerialNum oldest_to_keep) override; virtual SerialNum - sync(SerialNum syncTo); + sync(SerialNum syncTo) override; }; typedef searchcorespi::index::IThreadingService IThreadingService; IThreadingService &_writeService; DocTypeName _docTypeName; DDBState &_state; - IOwner &_owner; + IFeedHandlerOwner &_owner; const IResourceWriteFilter &_writeFilter; IReplayConfig &_replayConfig; TransactionLogManager _tlsMgr; @@ -98,7 +95,7 @@ private: SerialNum _prunedSerialNum; bool _delayedPrune; vespalib::Lock _feedLock; - FeedState::SP _feedState; + FeedStateSP _feedState; // used by master write thread tasks IFeedView *_activeFeedView; bucketdb::IBucketDBHandler *_bucketDBHandler; @@ -112,7 +109,7 @@ private: * Delayed handling of feed operations, in master write thread. * The current feed state is sampled here. */ - void doHandleOperation(FeedToken token, FeedOperation::UP op); + void doHandleOperation(FeedToken token, FeedOperationUP op); bool considerWriteOperationForRejection(FeedToken *token, const FeedOperation &op); @@ -120,22 +117,22 @@ private: * Delayed execution of feed operations against feed view, in * master write thread. */ - void performPut(FeedToken::UP token, PutOperation &op); + void performPut(FeedTokenUP token, PutOperation &op); - void performUpdate(FeedToken::UP token, UpdateOperation &op); - void performInternalUpdate(FeedToken::UP token, UpdateOperation &op); - void createNonExistingDocument(FeedToken::UP, const UpdateOperation &op); + void performUpdate(FeedTokenUP token, UpdateOperation &op); + void performInternalUpdate(FeedTokenUP token, UpdateOperation &op); + void createNonExistingDocument(FeedTokenUP, const UpdateOperation &op); - void performRemove(FeedToken::UP token, RemoveOperation &op); + void performRemove(FeedTokenUP token, RemoveOperation &op); private: - void performGarbageCollect(FeedToken::UP token); + void performGarbageCollect(FeedTokenUP token); void - performCreateBucket(FeedToken::UP token, CreateBucketOperation &op); + performCreateBucket(FeedTokenUP token, CreateBucketOperation &op); - void performDeleteBucket(FeedToken::UP token, DeleteBucketOperation &op); - void performSplit(FeedToken::UP token, SplitBucketOperation &op); - void performJoin(FeedToken::UP token, JoinBucketsOperation &op); + void performDeleteBucket(FeedTokenUP token, DeleteBucketOperation &op); + void performSplit(FeedTokenUP token, SplitBucketOperation &op); + void performJoin(FeedTokenUP token, JoinBucketsOperation &op); void performSync(); /** @@ -157,14 +154,14 @@ private: /** * Returns the current feed state of this feed handler. */ - FeedState::SP getFeedState() const; + FeedStateSP getFeedState() const; /** * Used to handle feed state transitions. */ - void changeFeedState(FeedState::SP newState); + void changeFeedState(FeedStateSP newState); - void changeFeedState(FeedState::SP newState, const vespalib::LockGuard &feedGuard); + void changeFeedState(FeedStateSP newState, const vespalib::LockGuard &feedGuard); public: FeedHandler(const FeedHandler &) = delete; @@ -186,7 +183,7 @@ public: const DocTypeName &docTypeName, PerDocTypeFeedMetrics &metrics, DDBState &state, - IOwner &owner, + IFeedHandlerOwner &owner, const IResourceWriteFilter &writerFilter, IReplayConfig &replayConfig, search::transactionlog::Writer *writer, @@ -275,20 +272,20 @@ public: vespalib::string getDocTypeName() const { return _docTypeName.getName(); } void tlsPrune(SerialNum oldest_to_keep); - void performOperation(FeedToken::UP token, FeedOperation::UP op); - void handleOperation(FeedToken token, FeedOperation::UP op); + void performOperation(FeedTokenUP token, FeedOperationUP op); + void handleOperation(FeedToken token, FeedOperationUP op); /** * Implements IDocumentMoveHandler */ virtual void - handleMove(MoveOperation &op); + handleMove(MoveOperation &op) override; /** * Implements IHeartBeatHandler */ virtual void - heartBeat(void); + heartBeat(void) override; virtual void sync(void); @@ -297,19 +294,19 @@ public: * Implements TransLogClient::Session::Callback. */ virtual RPC::Result - receive(const Packet &packet); + receive(const Packet &packet) override; virtual void - eof(void); + eof(void) override; virtual void - inSync(void); + inSync(void) override; /** * Implements IPruneRemovedDocumentsHandler */ void - performPruneRemovedDocuments(PruneRemovedDocumentsOperation &pruneOp); + performPruneRemovedDocuments(PruneRemovedDocumentsOperation &pruneOp) override; void syncTls(SerialNum syncTo); @@ -318,7 +315,7 @@ public: storeRemoteOperation(const FeedOperation &op); // Implements IOperationStorer - virtual void storeOperation(FeedOperation &op); + virtual void storeOperation(FeedOperation &op) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp index 6c008f6870b..2e79db1e599 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp @@ -2,6 +2,8 @@ #include "feedstates.h" #include "feedconfigstore.h" #include "replaypacketdispatcher.h" +#include "ifeedview.h" +#include "ireplayconfig.h" #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> @@ -76,61 +78,61 @@ public: _config_store(config_store) { } - virtual void replay(const PutOperation &op) { + virtual void replay(const PutOperation &op) override { _feed_view_ptr->handlePut(NULL, op); } - virtual void replay(const RemoveOperation &op) { + virtual void replay(const RemoveOperation &op) override { _feed_view_ptr->handleRemove(NULL, op); } - virtual void replay(const UpdateOperation &op) { + virtual void replay(const UpdateOperation &op) override { _feed_view_ptr->handleUpdate(NULL, op); } - virtual void replay(const NoopOperation &) {} // ignored - virtual void replay(const NewConfigOperation &op) { + virtual void replay(const NoopOperation &) override {} // ignored + virtual void replay(const NewConfigOperation &op) override { _replay_config.replayConfig(op.getSerialNum()); } - virtual void replay(const WipeHistoryOperation &op) { + virtual void replay(const WipeHistoryOperation &op) override { _config_store.saveWipeHistoryConfig(op.getSerialNum(), op.getWipeTimeLimit()); _replay_config.replayWipeHistory(op.getSerialNum(), op.getWipeTimeLimit()); } - virtual void replay(const DeleteBucketOperation &op) { + virtual void replay(const DeleteBucketOperation &op) override { _feed_view_ptr->handleDeleteBucket(op); } - virtual void replay(const SplitBucketOperation &op) { + virtual void replay(const SplitBucketOperation &op) override { _bucketDBHandler.handleSplit(op.getSerialNum(), op.getSource(), op.getTarget1(), op.getTarget2()); } - virtual void replay(const JoinBucketsOperation &op) { + virtual void replay(const JoinBucketsOperation &op) override { _bucketDBHandler.handleJoin(op.getSerialNum(), op.getSource1(), op.getSource2(), op.getTarget()); } - virtual void replay(const PruneRemovedDocumentsOperation &op) { + virtual void replay(const PruneRemovedDocumentsOperation &op) override { _feed_view_ptr->handlePruneRemovedDocuments(op); } - virtual void replay(const SpoolerReplayStartOperation &op) { + virtual void replay(const SpoolerReplayStartOperation &op) override { (void) op; } - virtual void replay(const SpoolerReplayCompleteOperation &op) { + virtual void replay(const SpoolerReplayCompleteOperation &op) override { (void) op; } - virtual void replay(const MoveOperation &op) { + virtual void replay(const MoveOperation &op) override { _feed_view_ptr->handleMove(op); } - virtual void replay(const CreateBucketOperation &) { + virtual void replay(const CreateBucketOperation &) override { } - virtual void replay(const CompactLidSpaceOperation &op) { + virtual void replay(const CompactLidSpaceOperation &op) override { _feed_view_ptr->handleCompactLidSpace(op); } - virtual NewConfigOperation::IStreamHandler &getNewConfigStreamHandler() { + virtual NewConfigOperation::IStreamHandler &getNewConfigStreamHandler() override { return _config_store; } - virtual document::DocumentTypeRepo &getDeserializeRepo() { + virtual document::DocumentTypeRepo &getDeserializeRepo() override { return *_feed_view_ptr->getDocumentTypeRepo(); } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.h b/searchcore/src/vespa/searchcore/proton/server/feedstates.h index 53a7bdd0ee6..22a31c49554 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.h +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.h @@ -28,12 +28,12 @@ public: { } - virtual void handleOperation(FeedToken, FeedOperation::UP op) { + virtual void handleOperation(FeedToken, FeedOperation::UP op) override { throwExceptionInHandleOperation(_doc_type_name, *op); } virtual void - receive(const PacketWrapper::SP &wrap, vespalib::Executor &) { + receive(const PacketWrapper::SP &wrap, vespalib::Executor &) override { throwExceptionInReceive(_doc_type_name.c_str(), wrap->packet.range().from(), wrap->packet.range().to(), @@ -57,12 +57,12 @@ public: IReplayConfig &replay_config, FeedConfigStore &config_store); - virtual void handleOperation(FeedToken, FeedOperation::UP op) { + virtual void handleOperation(FeedToken, FeedOperation::UP op) override { throwExceptionInHandleOperation(_doc_type_name, *op); } virtual void receive(const PacketWrapper::SP &wrap, - vespalib::Executor &executor); + vespalib::Executor &executor) override; }; @@ -79,12 +79,12 @@ public: _handler(handler) { } - virtual void handleOperation(FeedToken token, FeedOperation::UP op) { + virtual void handleOperation(FeedToken token, FeedOperation::UP op) override { _handler.performOperation(FeedToken::UP(new FeedToken(token)), std::move(op)); } virtual void - receive(const PacketWrapper::SP &wrap, vespalib::Executor &) + receive(const PacketWrapper::SP &wrap, vespalib::Executor &) override { throwExceptionInReceive(_handler.getDocTypeName().c_str(), wrap->packet.range().from(), diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.h index 8998098dd90..3a108e866b3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.h @@ -36,12 +36,12 @@ public: virtual ~FileConfigManager(void); - virtual SerialNum getBestSerialNum() const; - virtual SerialNum getOldestSerialNum() const; + virtual SerialNum getBestSerialNum() const override; + virtual SerialNum getOldestSerialNum() const override; virtual void saveConfig(const DocumentDBConfig &snapshot, const search::index::Schema &historySchema, - SerialNum serialNum); + SerialNum serialNum) override; /** * Load a config snapshot from disk corresponding to the given @@ -59,20 +59,20 @@ public: virtual void loadConfig(const DocumentDBConfig ¤tSnapshot, SerialNum serialNum, DocumentDBConfig::SP &loadedSnapshot, - search::index::Schema::SP &historySchema); + search::index::Schema::SP &historySchema) override; - virtual void removeInvalid(); - virtual void prune(SerialNum serialNum); - virtual bool hasValidSerial(SerialNum serialNum) const; + virtual void removeInvalid() override; + virtual void prune(SerialNum serialNum) override; + virtual bool hasValidSerial(SerialNum serialNum) const override; - virtual SerialNum getPrevValidSerial(SerialNum serialNum) const; + virtual SerialNum getPrevValidSerial(SerialNum serialNum) const override; /** * Clone config except for history schema. * Used when wiping history. */ virtual void saveWipeHistoryConfig(SerialNum serialNum, - fastos::TimeStamp wipeTimeLimit); + fastos::TimeStamp wipeTimeLimit) override; /** @@ -81,7 +81,7 @@ public: * Used for serializing config into transaction log. */ virtual void - serializeConfig(SerialNum serialNum, vespalib::nbostream &stream); + serializeConfig(SerialNum serialNum, vespalib::nbostream &stream) override; /** @@ -93,7 +93,7 @@ public: * transaction log. */ virtual void - deserializeConfig(SerialNum serialNum, vespalib::nbostream &stream); + deserializeConfig(SerialNum serialNum, vespalib::nbostream &stream) override; virtual void setProtonConfig(const ProtonConfigSP &protonConfig) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.cpp index f7c1595240e..6ecdbf8e51d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/flushhandlerproxy.cpp @@ -6,6 +6,8 @@ #include <vespa/log/log.h> LOG_SETUP(".proton.server.flushhandlerproxy"); +using searchcorespi::IFlushTarget; + namespace proton { FlushHandlerProxy::FlushHandlerProxy(const DocumentDB::SP &documentDB) diff --git a/searchcore/src/vespa/searchcore/proton/server/heart_beat_job.h b/searchcore/src/vespa/searchcore/proton/server/heart_beat_job.h index 0741594c567..3e3c396fb7f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/heart_beat_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/heart_beat_job.h @@ -23,7 +23,7 @@ public: const DocumentDBHeartBeatConfig &config); // Implements IMaintenanceJob - virtual bool run(); + virtual bool run() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h b/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h new file mode 100644 index 00000000000..20b2529d991 --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/server/i_document_subdb_owner.h @@ -0,0 +1,26 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#pragma once + +#include <vespa/vespalib/stllike/string.h> +#include <memory> + +namespace searchcorespi { class IIndexManagerFactory; } + +namespace proton { + +/** + * Interface defining the communication needed with the owner of the + * document sub db. + */ +class IDocumentSubDBOwner +{ +public: + virtual ~IDocumentSubDBOwner() {} + virtual void syncFeedView() = 0; + virtual std::shared_ptr<searchcorespi::IIndexManagerFactory> + getIndexManagerFactory(const vespalib::stringref &name) const = 0; + virtual vespalib::string getName() const = 0; + virtual uint32_t getDistributionKey() const = 0; +}; + +} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/i_feed_handler_owner.h b/searchcore/src/vespa/searchcore/proton/server/i_feed_handler_owner.h new file mode 100644 index 00000000000..639cfdba42f --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/server/i_feed_handler_owner.h @@ -0,0 +1,23 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include <vespa/searchlib/common/serialnum.h> + +namespace proton { + +/** + * Interface defining the communication needed with the owner of the + * feed handler. + */ +struct IFeedHandlerOwner { + virtual ~IFeedHandlerOwner() {} + virtual void performWipeHistory() = 0; + virtual void onTransactionLogReplayDone() = 0; + virtual void enterRedoReprocessState() = 0; + virtual void onPerformPrune(search::SerialNum flushedSerial) = 0; + virtual bool isFeedBlockedByRejectedConfig() = 0; + virtual bool getAllowPrune() const = 0; +}; + +} // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/i_operation_storer.h b/searchcore/src/vespa/searchcore/proton/server/i_operation_storer.h index 3d75244a188..a28b257f8bd 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_operation_storer.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_operation_storer.h @@ -2,10 +2,10 @@ #pragma once -#include <vespa/searchcore/proton/feedoperation/feedoperation.h> - namespace proton { +class FeedOperation; + /** * Interface for a component assigning serial numbers and storing feed operations. */ diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h index 72fad6f621c..7d3be44a7ee 100644 --- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h @@ -2,10 +2,8 @@ #pragma once #include <vespa/searchcore/config/config-proton.h> -#include <vespa/searchcore/proton/documentmetastore/i_document_meta_store.h> #include <vespa/searchcore/proton/matching/matching_stats.h> #include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h> -#include <vespa/searchcorespi/flush/iflushtarget.h> #include <vespa/searchlib/common/serialnum.h> #include <vespa/searchlib/util/searchable_stats.h> @@ -15,11 +13,13 @@ namespace search { class Schema; } } + namespace document { class DocumentId; } namespace searchcorespi { - class IIndexManagerFactory; - class IIndexManager; +class IFlushTarget; +class IIndexManagerFactory; +class IIndexManager; } namespace proton { namespace matching { class SessionManager; } @@ -54,23 +54,12 @@ class ReconfigParams; class IDocumentSubDB { public: - class IOwner - { - public: - virtual ~IOwner() {} - virtual void syncFeedView() = 0; - virtual std::shared_ptr<searchcorespi::IIndexManagerFactory> - getIndexManagerFactory(const vespalib::stringref &name) const = 0; - virtual vespalib::string getName() const = 0; - virtual uint32_t getDistributionKey() const = 0; - }; - using UP = std::unique_ptr<IDocumentSubDB>; using SerialNum = search::SerialNum; using Schema = search::index::Schema; using SchemaSP = std::shared_ptr<Schema>; using ProtonConfig = vespa::config::search::core::ProtonConfig; - using IFlushTarget = searchcorespi::IFlushTarget; + using IFlushTargetList = std::vector<std::shared_ptr<searchcorespi::IFlushTarget>>; public: IDocumentSubDB() { } virtual ~IDocumentSubDB() { } @@ -101,7 +90,7 @@ public: virtual const std::shared_ptr<ISummaryAdapter> &getSummaryAdapter() const = 0; virtual const std::shared_ptr<IIndexWriter> &getIndexWriter() const = 0; virtual IDocumentMetaStoreContext &getDocumentMetaStoreContext() = 0; - virtual IFlushTarget::List getFlushTargets() = 0; + virtual IFlushTargetList getFlushTargets() = 0; virtual size_t getNumDocs() const = 0; virtual size_t getNumActiveDocs() const = 0; /** diff --git a/searchcore/src/vespa/searchcore/proton/server/ifeedview.h b/searchcore/src/vespa/searchcore/proton/server/ifeedview.h index 10b86b57885..b4a8b71f64e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ifeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/ifeedview.h @@ -2,23 +2,23 @@ #pragma once -#include <vespa/document/repo/documenttyperepo.h> -#include <vespa/searchcore/proton/documentmetastore/i_simple_document_meta_store.h> -#include <vespa/searchcore/proton/common/feedtoken.h> -#include <vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h> -#include <vespa/searchcore/proton/feedoperation/deletebucketoperation.h> -#include <vespa/searchcore/proton/feedoperation/joinbucketsoperation.h> -#include <vespa/searchcore/proton/feedoperation/pruneremoveddocumentsoperation.h> -#include <vespa/searchcore/proton/feedoperation/putoperation.h> -#include <vespa/searchcore/proton/feedoperation/removeoperation.h> -#include <vespa/searchcore/proton/feedoperation/splitbucketoperation.h> -#include <vespa/searchcore/proton/feedoperation/updateoperation.h> -#include <vespa/searchlib/transactionlog/common.h> +#include <vespa/searchlib/common/serialnum.h> +#include <memory> + +namespace document { class DocumentTypeRepo; } namespace proton { +class CompactLidSpaceOperation; +class DeleteBucketOperation; +class FeedToken; +class ISimpleDocumentMetaStore; class MoveOperation; +class PruneRemovedDocumentsOperation; +class PutOperation; +class RemoveOperation; +class UpdateOperation; /** * Interface for a feed view as seen from a feed handler. @@ -26,7 +26,6 @@ class MoveOperation; class IFeedView { protected: - typedef search::transactionlog::Packet Packet; IFeedView() = default; public: typedef std::shared_ptr<IFeedView> SP; @@ -35,7 +34,7 @@ public: IFeedView & operator = (const IFeedView &) = delete; virtual ~IFeedView() { } - virtual const document::DocumentTypeRepo::SP &getDocumentTypeRepo() const = 0; + virtual const std::shared_ptr<document::DocumentTypeRepo> &getDocumentTypeRepo() const = 0; /** * Access to const version of document meta store. diff --git a/searchcore/src/vespa/searchcore/proton/server/job_tracked_maintenance_job.h b/searchcore/src/vespa/searchcore/proton/server/job_tracked_maintenance_job.h index 6bd227ae193..5def9651f4d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/job_tracked_maintenance_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/job_tracked_maintenance_job.h @@ -22,12 +22,12 @@ public: ~JobTrackedMaintenanceJob(); // Implements IMaintenanceJob - virtual bool isBlocked() const { return _job->isBlocked(); } - virtual void unBlock() { _job->unBlock(); } - virtual void registerRunner(IMaintenanceJobRunner *runner) { + virtual bool isBlocked() const override { return _job->isBlocked(); } + virtual void unBlock() override { _job->unBlock(); } + virtual void registerRunner(IMaintenanceJobRunner *runner) override { _job->registerRunner(runner); } - virtual bool run(); + virtual bool run() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h index 19ca603a972..67361cefc9c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h @@ -20,15 +20,15 @@ public: const vespalib::string &docTypeName); // Implements ILidSpaceCompactionHandler - virtual vespalib::string getName() const { + virtual vespalib::string getName() const override { return _docTypeName + "." + _subDb.getName(); } - virtual uint32_t getSubDbId() const { return _subDb.getSubDbId(); } - virtual search::LidUsageStats getLidStatus() const; - virtual IDocumentScanIterator::UP getIterator() const; - virtual MoveOperation::UP createMoveOperation(const search::DocumentMetaData &document, uint32_t moveToLid) const; - virtual void handleMove(const MoveOperation &op); - virtual void handleCompactLidSpace(const CompactLidSpaceOperation &op); + virtual uint32_t getSubDbId() const override { return _subDb.getSubDbId(); } + virtual search::LidUsageStats getLidStatus() const override; + virtual IDocumentScanIterator::UP getIterator() const override; + virtual MoveOperation::UP createMoveOperation(const search::DocumentMetaData &document, uint32_t moveToLid) const override; + virtual void handleMove(const MoveOperation &op) override; + virtual void handleCompactLidSpace(const CompactLidSpaceOperation &op) override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.h b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.h index e3027a729f1..53d2081aaa5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.h @@ -56,7 +56,7 @@ public: virtual void notifyDiskMemUsage(DiskMemUsageState state) override; // Implements IMaintenanceJob - virtual bool run(); + virtual bool run() override; virtual void registerRunner(IMaintenanceJobRunner *runner) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp b/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp index bdd1a46eed4..3fd28f1e13c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/maintenancecontroller.cpp @@ -25,7 +25,7 @@ private: MaintenanceJobRunner *_job; public: JobWrapperTask(MaintenanceJobRunner *job) : _job(job) {} - virtual void run() { _job->run(); } + virtual void run() override { _job->run(); } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenancejobrunner.h b/searchcore/src/vespa/searchcore/proton/server/maintenancejobrunner.h index a7e50cc3c79..f39e5972273 100644 --- a/searchcore/src/vespa/searchcore/proton/server/maintenancejobrunner.h +++ b/searchcore/src/vespa/searchcore/proton/server/maintenancejobrunner.h @@ -31,7 +31,7 @@ public: MaintenanceJobRunner(vespalib::Executor &executor, IMaintenanceJob::UP job); - virtual void run(); + virtual void run() override; void stop() { _stopped = true; } bool isRunning() const; const IMaintenanceJob &getJob() const { return *_job; } diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h b/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h index 27bf81a0f8a..57411c81e61 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h +++ b/searchcore/src/vespa/searchcore/proton/server/memoryconfigstore.h @@ -27,21 +27,21 @@ public: MemoryConfigStore(ConfigMaps::SP maps); ~MemoryConfigStore(); - virtual SerialNum getBestSerialNum() const; - virtual SerialNum getOldestSerialNum() const; - virtual bool hasValidSerial(SerialNum serial) const; - virtual SerialNum getPrevValidSerial(SerialNum serial) const; + virtual SerialNum getBestSerialNum() const override; + virtual SerialNum getOldestSerialNum() const override; + virtual bool hasValidSerial(SerialNum serial) const override; + virtual SerialNum getPrevValidSerial(SerialNum serial) const override; virtual void saveConfig(const DocumentDBConfig &config, const Schema &history, - SerialNum serial); + SerialNum serial) override; virtual void loadConfig(const DocumentDBConfig &, SerialNum serial, DocumentDBConfig::SP &loaded_config, - Schema::SP &history_schema); - virtual void removeInvalid(); - void prune(SerialNum serial); - virtual void saveWipeHistoryConfig(SerialNum serial, fastos::TimeStamp wipeTimeLimit); - virtual void serializeConfig(SerialNum, vespalib::nbostream &); - virtual void deserializeConfig(SerialNum, vespalib::nbostream &); + Schema::SP &history_schema) override; + virtual void removeInvalid() override; + void prune(SerialNum serial) override; + virtual void saveWipeHistoryConfig(SerialNum serial, fastos::TimeStamp wipeTimeLimit) override; + virtual void serializeConfig(SerialNum, vespalib::nbostream &) override; + virtual void deserializeConfig(SerialNum, vespalib::nbostream &) override; virtual void setProtonConfig(const ProtonConfigSP &) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp index 4cf24514127..a694f9e733a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/memoryflush.cpp @@ -10,6 +10,7 @@ LOG_SETUP(".proton.server.memoryflush"); using search::SerialNum; using proton::flushengine::TlsStats; +using searchcorespi::IFlushTarget; namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/ooscli.h b/searchcore/src/vespa/searchcore/proton/server/ooscli.h index f11b1d5686f..e07b208bcba 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ooscli.h +++ b/searchcore/src/vespa/searchcore/proton/server/ooscli.h @@ -39,7 +39,7 @@ private: public: OosCli(const OosParams ¶ms, FRT_Supervisor &orb); virtual ~OosCli(); - virtual void PerformTask(); + virtual void PerformTask() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp index 094f0f4dd6f..07a37a1b299 100644 --- a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp @@ -5,6 +5,13 @@ #include "documentretriever.h" #include <vespa/persistence/spi/result.h> #include "documentdb.h" +#include <vespa/searchcore/proton/feedoperation/createbucketoperation.h> +#include <vespa/searchcore/proton/feedoperation/deletebucketoperation.h> +#include <vespa/searchcore/proton/feedoperation/joinbucketsoperation.h> +#include <vespa/searchcore/proton/feedoperation/putoperation.h> +#include <vespa/searchcore/proton/feedoperation/removeoperation.h> +#include <vespa/searchcore/proton/feedoperation/splitbucketoperation.h> +#include <vespa/searchcore/proton/feedoperation/updateoperation.h> #include <vespa/log/log.h> LOG_SETUP(".proton.server.persistencehandlerproxy"); diff --git a/searchcore/src/vespa/searchcore/proton/server/persistenceproviderproxy.h b/searchcore/src/vespa/searchcore/proton/server/persistenceproviderproxy.h index b977415939c..add8a72264d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/persistenceproviderproxy.h +++ b/searchcore/src/vespa/searchcore/proton/server/persistenceproviderproxy.h @@ -5,27 +5,27 @@ namespace proton { -using storage::spi::Bucket; -using storage::spi::BucketIdListResult; -using storage::spi::BucketInfoResult; -using storage::spi::ClusterState; -using storage::spi::Context; -using storage::spi::CreateIteratorResult; -using storage::spi::GetResult; -using storage::spi::IncludedVersions; -using storage::spi::IterateResult; -using storage::spi::IteratorId; -using storage::spi::PartitionId; -using storage::spi::PartitionStateListResult; -using storage::spi::RemoveResult; -using storage::spi::Result; -using storage::spi::Selection; -using storage::spi::Timestamp; -using storage::spi::UpdateResult; - class PersistenceProviderProxy : public storage::spi::PersistenceProvider { private: + using Bucket = storage::spi::Bucket; + using BucketIdListResult = storage::spi::BucketIdListResult; + using BucketInfoResult = storage::spi::BucketInfoResult; + using ClusterState = storage::spi::ClusterState; + using Context = storage::spi::Context; + using CreateIteratorResult = storage::spi::CreateIteratorResult; + using GetResult = storage::spi::GetResult; + using IncludedVersions = storage::spi::IncludedVersions; + using IterateResult = storage::spi::IterateResult; + using IteratorId = storage::spi::IteratorId; + using PartitionId = storage::spi::PartitionId; + using PartitionStateListResult = storage::spi::PartitionStateListResult; + using RemoveResult = storage::spi::RemoveResult; + using Result = storage::spi::Result; + using Selection = storage::spi::Selection; + using Timestamp = storage::spi::Timestamp; + using UpdateResult = storage::spi::UpdateResult; + storage::spi::PersistenceProvider &_pp; public: @@ -33,68 +33,68 @@ public: virtual ~PersistenceProviderProxy() {} - virtual Result initialize() { + virtual Result initialize() override { return _pp.initialize(); } // Implements PersistenceProvider - virtual PartitionStateListResult getPartitionStates() const { + virtual PartitionStateListResult getPartitionStates() const override { return _pp.getPartitionStates(); } - virtual BucketIdListResult listBuckets(PartitionId partId) const { + virtual BucketIdListResult listBuckets(PartitionId partId) const override { return _pp.listBuckets(partId); } - virtual Result setClusterState(const ClusterState &state) { + virtual Result setClusterState(const ClusterState &state) override { return _pp.setClusterState(state); } virtual Result setActiveState(const Bucket &bucket, - storage::spi::BucketInfo::ActiveState newState) { + storage::spi::BucketInfo::ActiveState newState) override { return _pp.setActiveState(bucket, newState); } - virtual BucketInfoResult getBucketInfo(const Bucket &bucket) const { + virtual BucketInfoResult getBucketInfo(const Bucket &bucket) const override { return _pp.getBucketInfo(bucket); } virtual Result put(const Bucket &bucket, Timestamp timestamp, const storage::spi::DocumentSP& doc, - Context& context) { + Context& context) override { return _pp.put(bucket, timestamp, doc, context); } virtual RemoveResult remove(const Bucket &bucket, Timestamp timestamp, const document::DocumentId &docId, - Context& context) { + Context& context) override { return _pp.remove(bucket, timestamp, docId, context); } virtual RemoveResult removeIfFound(const Bucket &bucket, Timestamp timestamp, const document::DocumentId &docId, - Context& context) { + Context& context) override { return _pp.removeIfFound(bucket, timestamp, docId, context); } virtual UpdateResult update(const Bucket &bucket, Timestamp timestamp, const storage::spi::DocumentUpdateSP& docUpd, - Context& context) { + Context& context) override { return _pp.update(bucket, timestamp, docUpd, context); } - virtual Result flush(const Bucket &bucket, Context& context) { + virtual Result flush(const Bucket &bucket, Context& context) override { return _pp.flush(bucket, context); } virtual GetResult get(const Bucket &bucket, const document::FieldSet& fieldSet, const document::DocumentId &docId, - Context& context) const { + Context& context) const override { return _pp.get(bucket, fieldSet, docId, context); } @@ -102,61 +102,61 @@ public: const document::FieldSet& fieldSet, const Selection &selection, IncludedVersions versions, - Context& context) { + Context& context) override { return _pp.createIterator(bucket, fieldSet, selection, versions, context); } virtual IterateResult iterate(IteratorId itrId, uint64_t maxByteSize, - Context& context) const { + Context& context) const override { return _pp.iterate(itrId, maxByteSize, context); } - virtual Result destroyIterator(IteratorId itrId, Context& context) { + virtual Result destroyIterator(IteratorId itrId, Context& context) override { return _pp.destroyIterator(itrId, context); } - virtual Result createBucket(const Bucket &bucket, Context& context) { + virtual Result createBucket(const Bucket &bucket, Context& context) override { return _pp.createBucket(bucket, context); } - virtual Result deleteBucket(const Bucket &bucket, Context& context) { + virtual Result deleteBucket(const Bucket &bucket, Context& context) override { return _pp.deleteBucket(bucket, context); } - virtual BucketIdListResult getModifiedBuckets() const { + virtual BucketIdListResult getModifiedBuckets() const override { return _pp.getModifiedBuckets(); } virtual Result maintain(const Bucket &bucket, - storage::spi::MaintenanceLevel level) { + storage::spi::MaintenanceLevel level) override { return _pp.maintain(bucket, level); } virtual Result split(const Bucket &source, const Bucket &target1, const Bucket &target2, - Context& context) { + Context& context) override { return _pp.split(source, target1, target2, context); } virtual Result join(const Bucket &source1, const Bucket &source2, const Bucket &target, - Context& context) { + Context& context) override { return _pp.join(source1, source2, target, context); } virtual Result move(const Bucket &source, storage::spi::PartitionId target, - Context& context) { + Context& context) override { return _pp.move(source, target, context); } virtual Result removeEntry(const Bucket &bucket, Timestamp timestamp, - Context& context) { + Context& context) override { return _pp.removeEntry(bucket, timestamp, context); } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index cdf77609da3..6c76cbb9753 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -12,6 +12,7 @@ #include "searchhandlerproxy.h" #include "simpleflush.h" #include "proton_config_snapshot.h" +#include "fileconfigmanager.h" #include <vespa/document/repo/documenttyperepo.h> #include <vespa/messagebus/emptyreply.h> @@ -30,7 +31,6 @@ #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/util/random.h> -#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchcore/proton/common/hw_info_sampler.h> #include <vespa/searchcore/proton/reference/document_db_reference_registry.h> #include <vespa/searchcore/proton/reference/i_document_db_reference.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index aadc0eb1287..706f36f8543 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -13,8 +13,10 @@ #include "rpc_hooks.h" #include "bootstrapconfig.h" #include <vespa/persistence/proxy/providerstub.h> +#include <vespa/searchcore/proton/common/hw_info.h> #include <vespa/searchcore/proton/flushengine/flushengine.h> #include <vespa/searchcore/proton/matchengine/matchengine.h> +#include <vespa/searchcore/proton/matching/querylimiter.h> #include <vespa/searchcore/proton/metrics/metrics_engine.h> #include <vespa/searchcore/proton/persistenceengine/i_resource_write_filter.h> #include <vespa/searchcore/proton/persistenceengine/ipersistenceengineowner.h> @@ -58,7 +60,6 @@ private: typedef search::engine::MonitorRequest MonitorRequest; typedef search::engine::MonitorReply MonitorReply; typedef search::engine::MonitorClient MonitorClient; - typedef search::docsummary::JuniperProperties JuniperProperties; typedef storage::spi::ProviderStub ProviderStub; typedef std::map<DocTypeName, DocumentDB::SP> DocumentDBMap; typedef BootstrapConfig::ProtonConfigSP ProtonConfigSP; @@ -92,7 +93,7 @@ private: virtual void addTags(vespalib::GenericHeader &header, - const vespalib::string &name) const; + const vespalib::string &name) const override; void setClusterName(const vespalib::string &clusterName, @@ -158,7 +159,7 @@ private: virtual void removeDocumentDB(const DocTypeName &docTypeName) override; virtual void applyConfig(const BootstrapConfig::SP & configSnapshot) override; - virtual MonitorReply::UP ping(MonitorRequest::UP request, MonitorClient &client); + virtual MonitorReply::UP ping(MonitorRequest::UP request, MonitorClient &client) override; /** * Called by the metrics update hook (typically in the context of @@ -232,7 +233,7 @@ public: virtual void getComponentConfig(Consumer &consumer) override; // implements IPersistenceEngineOwner interface - virtual void setClusterState(const storage::spi::ClusterState &calc); + virtual void setClusterState(const storage::spi::ClusterState &calc) override; /** * Return the oldest active config generation used by proton. @@ -245,7 +246,7 @@ public: vespalib::string getBadConfigs(void) const; - virtual StatusReport::List getStatusReports() const; + virtual StatusReport::List getStatusReports() const override; MatchEngine & getMatchEngine() { return *_matchEngine; } FlushEngine & getFlushEngine() { return *_flushEngine; } @@ -253,7 +254,7 @@ public: bool isReplayDone() const { return _isReplayDone; } - virtual bool isInitializing() const { + virtual bool isInitializing() const override { return _isInitializing; } diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.h b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.h index 8a0595e77d4..6c859a0db5d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.h @@ -43,7 +43,7 @@ public: DocumentDBConfig::SP getDocumentDBConfig(const DocTypeName & docTypeName) const; - void Run(FastOS_ThreadInterface * thread, void *arg); + void Run(FastOS_ThreadInterface * thread, void *arg) override; private: typedef std::map<DocTypeName, DocumentDBConfigManager::SP> DBManagerMap; diff --git a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.h b/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.h index c53f40a3e26..917cfabbc71 100644 --- a/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/prune_session_cache_job.h @@ -19,7 +19,7 @@ public: double jobInterval); // Implements IMaintenanceJob - virtual bool run(); + virtual bool run() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.h b/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.h index 1d13bb35420..47cb814454a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.h +++ b/searchcore/src/vespa/searchcore/proton/server/pruneremoveddocumentsjob.h @@ -44,7 +44,7 @@ public: IFrozenBucketHandler &frozenHandler); // Implements IMaintenanceJob - virtual bool run(); + virtual bool run() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp index be509bfba44..c6a6a4529a8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp @@ -139,7 +139,7 @@ SearchableDocSubDBConfigurer::reconfigureIndexSearchable() { SearchableFeedView::SP feedView(_feedView.get()); const IIndexWriter::SP &indexWriter = feedView->getIndexWriter(); - const IIndexManager::SP &indexManager = indexWriter->getIndexManager(); + const searchcorespi::IIndexManager::SP &indexManager = indexWriter->getIndexManager(); reconfigureMatchView(indexManager->getSearchable()); const SearchView::SP searchView(_searchView.get()); reconfigureFeedView(searchView); diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp index fb15c505c04..f122b7ec826 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchable_feed_view.cpp @@ -4,6 +4,7 @@ #include "forcecommitcontext.h" #include "operationdonecontext.h" #include "removedonecontext.h" +#include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/metrics/feed_metrics.h> #include <vespa/searchcore/proton/documentmetastore/ilidreusedelayer.h> #include <vespa/searchcore/proton/reference/i_gid_to_lid_change_handler.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index c893118e6f4..aedd0678ae0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -4,6 +4,7 @@ #include "fast_access_document_retriever.h" #include "document_subdb_initializer.h" #include "reconfig_params.h" +#include "i_document_subdb_owner.h" #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/flushengine/threadedflushtarget.h> #include <vespa/searchcore/proton/index/index_manager_initializer.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h index 3beb7441000..780295a7cc0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h @@ -73,8 +73,9 @@ public: private: typedef FastAccessDocSubDB Parent; + using IFlushTargetList = std::vector<std::shared_ptr<searchcorespi::IFlushTarget>>; - IIndexManager::SP _indexMgr; + searchcorespi::IIndexManager::SP _indexMgr; IIndexWriter::SP _indexWriter; vespalib::VarHolder<SearchView::SP> _rSearchView; vespalib::VarHolder<SearchableFeedView::SP> _rFeedView; @@ -103,7 +104,7 @@ private: void reconfigureIndexSearchable(); void syncViews(); protected: - IFlushTarget::List getFlushTargetsInternal(); + IFlushTargetList getFlushTargetsInternal() override; using Parent::updateLidReuseDelayer; @@ -144,7 +145,7 @@ public: return _rSearchView.get()->getAttributeManager(); } - const IIndexManager::SP &getIndexManager() const override { + const searchcorespi::IIndexManager::SP &getIndexManager() const override { return _indexMgr; } diff --git a/searchcore/src/vespa/searchcore/proton/server/simpleflush.h b/searchcore/src/vespa/searchcore/proton/server/simpleflush.h index 82e379a345a..263367ad7e6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/simpleflush.h +++ b/searchcore/src/vespa/searchcore/proton/server/simpleflush.h @@ -9,6 +9,7 @@ namespace proton { class SimpleFlush : public IFlushStrategy { private: + using IFlushTarget = searchcorespi::IFlushTarget; class CompareTarget { public: bool operator () (const FlushContext::SP &lhs, const FlushContext::SP &rhs) const { @@ -22,7 +23,7 @@ public: // Implements IFlushStrategy virtual FlushContext::List getFlushTargets(const FlushContext::List &targetList, - const flushengine::TlsStatsMap &tlsStatsMap) const; + const flushengine::TlsStatsMap &tlsStatsMap) const override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp index d6f0cd179dc..464602a76b4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp @@ -7,6 +7,7 @@ #include "storeonlydocsubdb.h" #include "document_subdb_initializer.h" #include "reconfig_params.h" +#include "i_document_subdb_owner.h" #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandlerinitializer.h> #include <vespa/searchcore/proton/docsummary/summarymanagerinitializer.h> @@ -47,12 +48,13 @@ using vespalib::makeClosure; using proton::documentmetastore::LidReuseDelayer; using fastos::TimeStamp; using proton::initializer::InitializerTask; +using searchcorespi::IFlushTarget; namespace proton { namespace { -IIndexManager::SP nullIndexManager; +searchcorespi::IIndexManager::SP nullIndexManager; IIndexWriter::SP nullIndexWriter; } @@ -75,7 +77,7 @@ StoreOnlyDocSubDB::Config::Config(const DocTypeName &docTypeName, { } StoreOnlyDocSubDB::Config::~Config() { } -StoreOnlyDocSubDB::Context::Context(IDocumentSubDB::IOwner &owner, +StoreOnlyDocSubDB::Context::Context(IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer, const IGetSerialNum &getSerialNum, const search::common::FileHeaderContext &fileHeaderContext, @@ -445,7 +447,7 @@ StoreOnlyDocSubDB::getAttributeManager() const return proton::IAttributeManager::SP(); } -const IIndexManager::SP & +const searchcorespi::IIndexManager::SP & StoreOnlyDocSubDB::getIndexManager() const { return nullIndexManager; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index 44ad409cfdb..49428c38d3d 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -27,6 +27,7 @@ class MetricsWireService; class LegacyDocumentDBMetrics; class FeedHandler; class DocumentMetaStoreInitializerResult; +class IDocumentSubDBOwner; namespace initializer { class InitializerTask; } namespace bucketdb { class IBucketDBHandlerInitializer; } @@ -38,11 +39,11 @@ namespace documentmetastore { class LidReuseDelayerConfig; } class DocSubDB : public IDocumentSubDB { protected: - IOwner &_owner; + IDocumentSubDBOwner &_owner; search::transactionlog::SyncProxy &_tlSyncer; public: - DocSubDB(IOwner &owner, search::transactionlog::SyncProxy &tlSyncer) + DocSubDB(IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer) : IDocumentSubDB(), _owner(owner), _tlSyncer(tlSyncer) @@ -107,7 +108,7 @@ public: }; struct Context { - IDocumentSubDB::IOwner &_owner; + IDocumentSubDBOwner &_owner; search::transactionlog::SyncProxy &_tlSyncer; const IGetSerialNum &_getSerialNum; const search::common::FileHeaderContext &_fileHeaderContext; @@ -119,7 +120,7 @@ public: std::mutex &_configMutex; const HwInfo &_hwInfo; - Context(IDocumentSubDB::IOwner &owner, + Context(IDocumentSubDBOwner &owner, search::transactionlog::SyncProxy &tlSyncer, const IGetSerialNum &getSerialNum, const search::common::FileHeaderContext &fileHeaderContext, @@ -166,7 +167,7 @@ private: TlsSyncer _tlsSyncer; DocumentMetaStoreFlushTarget::SP _dmsFlushTarget; - IFlushTarget::List getFlushTargets() override; + IFlushTargetList getFlushTargets() override; protected: const uint32_t _subDbId; const SubDbType _subDbType; @@ -188,7 +189,7 @@ protected: void setupDocumentMetaStore(std::shared_ptr<DocumentMetaStoreInitializerResult> dmsResult); void initFeedView(const DocumentDBConfig &configSnapshot); - virtual IFlushTarget::List getFlushTargetsInternal(); + virtual IFlushTargetList getFlushTargetsInternal(); StoreOnlyFeedView::Context getStoreOnlyFeedViewContext(const DocumentDBConfig &configSnapshot); StoreOnlyFeedView::PersistentParams getFeedViewPersistentParams(); vespalib::string getSubDbName() const; diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp index 2541900b036..ac24469e4d2 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp @@ -4,6 +4,7 @@ #include "storeonlyfeedview.h" #include <vespa/searchcore/proton/common/bucketfactory.h> #include <vespa/searchcore/proton/common/commit_time_tracker.h> +#include <vespa/searchcore/proton/common/feedtoken.h> #include <vespa/searchcore/proton/metrics/feed_metrics.h> #include <vespa/searchcore/proton/documentmetastore/ilidreusedelayer.h> #include <vespa/vespalib/stllike/string.h> diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h index a5f7b970a85..78f78a60ff0 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.h @@ -64,6 +64,7 @@ public: using OnOperationDoneType = const std::shared_ptr<OperationDoneContext> &; using OnPutDoneType = const std::shared_ptr<PutDoneContext> &; using OnRemoveDoneType = const std::shared_ptr<RemoveDoneContext> &; + using FeedTokenUP = std::unique_ptr<FeedToken>; struct Context { @@ -162,11 +163,11 @@ private: const document::DocumentId &docId); void - internalPut(FeedToken::UP token, + internalPut(FeedTokenUP token, const PutOperation &putOp); void - internalUpdate(FeedToken::UP token, + internalUpdate(FeedTokenUP token, const UpdateOperation &updOp); void @@ -182,7 +183,7 @@ private: search::DocumentIdT & lid) const; void - internalRemove(FeedToken::UP token, + internalRemove(FeedTokenUP token, const RemoveOperation &rmOp); // Removes documents from meta store and document store. @@ -191,13 +192,13 @@ private: bool remove_index_and_attribute_fields, bool immediateCommit); - void internalRemove(FeedToken::UP token, + void internalRemove(FeedTokenUP token, SerialNum serialNum, search::DocumentIdT lid, FeedOperation::Type opType); // Ack token early if visibility delay is nonzero - void considerEarlyAck(FeedToken::UP &token, FeedOperation::Type opType); + void considerEarlyAck(FeedTokenUP &token, FeedOperation::Type opType); virtual void notifyGidToLidChange(const document::GlobalId &gid, uint32_t lid); @@ -305,13 +306,13 @@ public: * Implements IFeedView. */ virtual const document::DocumentTypeRepo::SP & - getDocumentTypeRepo() const { return _repo; } + getDocumentTypeRepo() const override { return _repo; } /** * Implements IFeedView. */ virtual const ISimpleDocumentMetaStore * - getDocumentMetaStorePtr() const; + getDocumentMetaStorePtr() const override; /** * Similar to IPersistenceHandler functions. @@ -320,43 +321,40 @@ public: */ virtual void - preparePut(PutOperation &putOp); + preparePut(PutOperation &putOp) override; virtual void - handlePut(FeedToken *token, - const PutOperation &putOp); + handlePut(FeedToken *token, const PutOperation &putOp) override; virtual void - prepareUpdate(UpdateOperation &updOp); + prepareUpdate(UpdateOperation &updOp) override; virtual void - handleUpdate(FeedToken *token, - const UpdateOperation &updOp); + handleUpdate(FeedToken *token, const UpdateOperation &updOp) override; virtual void - prepareRemove(RemoveOperation &rmOp); + prepareRemove(RemoveOperation &rmOp) override; virtual void - handleRemove(FeedToken *token, - const RemoveOperation &rmOp); + handleRemove(FeedToken *token, const RemoveOperation &rmOp) override; virtual void - prepareDeleteBucket(DeleteBucketOperation &delOp); + prepareDeleteBucket(DeleteBucketOperation &delOp) override; virtual void - handleDeleteBucket(const DeleteBucketOperation &delOp); + handleDeleteBucket(const DeleteBucketOperation &delOp) override; virtual void - prepareMove(MoveOperation &putOp); + prepareMove(MoveOperation &putOp) override; virtual void - handleMove(const MoveOperation &putOp); + handleMove(const MoveOperation &putOp) override; virtual void - heartBeat(search::SerialNum serialNum); + heartBeat(search::SerialNum serialNum) override; virtual void - sync(); + sync() override; virtual void forceCommit(SerialNum serialNum) override; @@ -370,10 +368,10 @@ public: * Called by writer thread. */ virtual void - handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &pruneOp); + handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &pruneOp) override; virtual void - handleCompactLidSpace(const CompactLidSpaceOperation &op); + handleCompactLidSpace(const CompactLidSpaceOperation &op) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/summaryadapter.h b/searchcore/src/vespa/searchcore/proton/server/summaryadapter.h index 2e874ad4d25..cbb2e8d0e94 100644 --- a/searchcore/src/vespa/searchcore/proton/server/summaryadapter.h +++ b/searchcore/src/vespa/searchcore/proton/server/summaryadapter.h @@ -28,7 +28,7 @@ public: virtual void heartBeat(search::SerialNum serialNum) override; - virtual const search::IDocumentStore &getDocumentStore() const { + virtual const search::IDocumentStore &getDocumentStore() const override { return _imgr->getBackingStore(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h index 37a6c3bf5a5..067369127af 100644 --- a/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/transactionlogmanager.h @@ -19,7 +19,7 @@ class TransactionLogManager : public TransactionLogManagerBase TransLogClient::Visitor::UP _visitor; virtual void doLogReplayComplete(const vespalib::string &domainName, - int64_t elapsedTime) const; + int64_t elapsedTime) const override; public: /** diff --git a/searchcore/src/vespa/searchcore/proton/server/wipe_old_removed_fields_job.h b/searchcore/src/vespa/searchcore/proton/server/wipe_old_removed_fields_job.h index 0a2b5fe3b6f..eb8ec4a7649 100644 --- a/searchcore/src/vespa/searchcore/proton/server/wipe_old_removed_fields_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/wipe_old_removed_fields_job.h @@ -21,7 +21,7 @@ public: const DocumentDBWipeOldRemovedFieldsConfig &config); // Implements IMaintenanceJob - virtual bool run(); + virtual bool run() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp index 8f56aa90a98..a41f76fef3c 100644 --- a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp @@ -27,7 +27,7 @@ public: { } - void run() { + void run() override { _client.getDocsumsDone(_engine.getDocsums(_request.release())); } }; diff --git a/searchcore/src/vespa/searchcore/proton/test/buckethandler.h b/searchcore/src/vespa/searchcore/proton/test/buckethandler.h index 4b256bb1443..4d5caa3119b 100644 --- a/searchcore/src/vespa/searchcore/proton/test/buckethandler.h +++ b/searchcore/src/vespa/searchcore/proton/test/buckethandler.h @@ -26,10 +26,10 @@ public: ~BucketHandler(); virtual void - addBucketStateChangedHandler(IBucketStateChangedHandler *handler); + addBucketStateChangedHandler(IBucketStateChangedHandler *handler) override; virtual void - removeBucketStateChangedHandler(IBucketStateChangedHandler *handler); + removeBucketStateChangedHandler(IBucketStateChangedHandler *handler) override; void notifyBucketStateChanged(const document::BucketId &bucketId, diff --git a/searchcore/src/vespa/searchcore/proton/test/clusterstatehandler.h b/searchcore/src/vespa/searchcore/proton/test/clusterstatehandler.h index 78e1c73b35a..60d44391956 100644 --- a/searchcore/src/vespa/searchcore/proton/test/clusterstatehandler.h +++ b/searchcore/src/vespa/searchcore/proton/test/clusterstatehandler.h @@ -26,10 +26,10 @@ public: ~ClusterStateHandler(); virtual void - addClusterStateChangedHandler(IClusterStateChangedHandler *handler); + addClusterStateChangedHandler(IClusterStateChangedHandler *handler) override; virtual void - removeClusterStateChangedHandler(IClusterStateChangedHandler *handler); + removeClusterStateChangedHandler(IClusterStateChangedHandler *handler) override; void notifyClusterStateChanged(const IBucketStateCalculator::SP &newCalc); diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h index 42f4a4dc0cf..3a3fc00e6f0 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h @@ -73,7 +73,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB const ISummaryAdapter::SP &getSummaryAdapter() const override { return _summaryAdapter; } const IIndexWriter::SP &getIndexWriter() const override { return _indexWriter; } IDocumentMetaStoreContext &getDocumentMetaStoreContext() override { return _metaStoreCtx; } - IFlushTarget::List getFlushTargets() override { return IFlushTarget::List(); } + IFlushTargetList getFlushTargets() override { return IFlushTargetList(); } size_t getNumDocs() const override { return 0; } size_t getNumActiveDocs() const override { return 0; } bool hasDocument(const document::DocumentId &) override { return false; } diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h b/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h index a86cbbbc5f6..871b9b5a50f 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_feed_view.h @@ -2,6 +2,7 @@ #pragma once #include <vespa/searchcore/proton/server/ifeedview.h> +#include <vespa/document/repo/documenttyperepo.h> namespace proton { @@ -17,31 +18,29 @@ struct DummyFeedView : public IFeedView DummyFeedView(const document::DocumentTypeRepo::SP &docTypeRepo) : _docTypeRepo(docTypeRepo) {} - virtual const document::DocumentTypeRepo::SP &getDocumentTypeRepo() const { + virtual const document::DocumentTypeRepo::SP &getDocumentTypeRepo() const override { return _docTypeRepo; } - virtual const ISimpleDocumentMetaStore *getDocumentMetaStorePtr() const { + virtual const ISimpleDocumentMetaStore *getDocumentMetaStorePtr() const override { return std::nullptr_t(); } - virtual void preparePut(PutOperation &) {} + virtual void preparePut(PutOperation &) override {} virtual void handlePut(FeedToken *, - const PutOperation &) {} - virtual void prepareUpdate(UpdateOperation &) {} + const PutOperation &) override {} + virtual void prepareUpdate(UpdateOperation &) override {} virtual void handleUpdate(FeedToken *, - const UpdateOperation &) {} - virtual void prepareRemove(RemoveOperation &) {} + const UpdateOperation &) override {} + virtual void prepareRemove(RemoveOperation &) override {} virtual void handleRemove(FeedToken *, - const RemoveOperation &) {} - virtual void prepareDeleteBucket(DeleteBucketOperation &) {} - virtual void handleDeleteBucket(const DeleteBucketOperation &) {} - virtual void handleSplit(FeedToken *, const SplitBucketOperation &) {} - virtual void handleJoin(FeedToken *, const JoinBucketsOperation &) {} - virtual void prepareMove(MoveOperation &) {} - virtual void handleMove(const MoveOperation &) {} - virtual void heartBeat(search::SerialNum) {} - virtual void sync() {} - virtual void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &) {} - virtual void handleCompactLidSpace(const CompactLidSpaceOperation &) {} + const RemoveOperation &) override {} + virtual void prepareDeleteBucket(DeleteBucketOperation &) override {} + virtual void handleDeleteBucket(const DeleteBucketOperation &) override {} + virtual void prepareMove(MoveOperation &) override {} + virtual void handleMove(const MoveOperation &) override {} + virtual void heartBeat(search::SerialNum) override {} + virtual void sync() override {} + virtual void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &) override {} + virtual void handleCompactLidSpace(const CompactLidSpaceOperation &) override {} void forceCommit(search::SerialNum) override { } }; diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h b/searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h index 34b246a1d1b..07891c1ac66 100644 --- a/searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h +++ b/searchcore/src/vespa/searchcore/proton/test/mock_index_manager.h @@ -10,7 +10,7 @@ namespace test { /** * Mock of the IIndexManager interface used for unit testing. */ -struct MockIndexManager : public IIndexManager +struct MockIndexManager : public searchcorespi::IIndexManager { virtual void putDocument(uint32_t, const Document &, SerialNum) override {} virtual void removeDocument(uint32_t, SerialNum) override {} diff --git a/searchcorespi/src/tests/plugin/factoryregistry_test.cpp b/searchcorespi/src/tests/plugin/factoryregistry_test.cpp index 3c0214576c8..cc71f1c2005 100644 --- a/searchcorespi/src/tests/plugin/factoryregistry_test.cpp +++ b/searchcorespi/src/tests/plugin/factoryregistry_test.cpp @@ -15,13 +15,13 @@ struct MyFactory : IIndexManagerFactory { virtual IIndexManager::UP createIndexManager(const IndexManagerConfig &, const index::IndexMaintainerConfig &, - const index::IndexMaintainerContext &) { + const index::IndexMaintainerContext &) override { return IIndexManager::UP(); } virtual config::ConfigKeySet getConfigKeys( const string &, const search::index::Schema &, - const config::ConfigInstance &) { + const config::ConfigInstance &) override { return config::ConfigKeySet(); } }; diff --git a/searchcorespi/src/tests/plugin/plugin.cpp b/searchcorespi/src/tests/plugin/plugin.cpp index eff33e69464..839c026607c 100644 --- a/searchcorespi/src/tests/plugin/plugin.cpp +++ b/searchcorespi/src/tests/plugin/plugin.cpp @@ -19,18 +19,18 @@ public: virtual void putDocument(uint32_t, const Document &, SerialNum) override { } virtual void removeDocument(uint32_t, SerialNum) override { } virtual void commit(SerialNum, OnWriteDoneType) override { } - virtual void heartBeat(SerialNum ) {} - virtual SerialNum getCurrentSerialNum() const { return 0; } - virtual SerialNum getFlushedSerialNum() const { return 0; } - virtual IndexSearchable::SP getSearchable() const { + virtual void heartBeat(SerialNum ) override {} + virtual SerialNum getCurrentSerialNum() const override { return 0; } + virtual SerialNum getFlushedSerialNum() const override { return 0; } + virtual IndexSearchable::SP getSearchable() const override { IndexSearchable::SP s; return s; } - virtual SearchableStats getSearchableStats() const { + virtual SearchableStats getSearchableStats() const override { SearchableStats s; return s; } - virtual searchcorespi::IFlushTarget::List getFlushTargets() { + virtual searchcorespi::IFlushTarget::List getFlushTargets() override { searchcorespi::IFlushTarget::List l; return l; } @@ -43,11 +43,11 @@ class IndexManagerFactory : public searchcorespi::IIndexManagerFactory public: virtual IIndexManager::UP createIndexManager(const IndexManagerConfig &managerCfg, const index::IndexMaintainerConfig &maintainerConfig, - const index::IndexMaintainerContext &maintainerContext); + const index::IndexMaintainerContext &maintainerContext) override; virtual ConfigKeySet getConfigKeys(const string &configId, const Schema &schema, - const ConfigInstance &rootConfig); + const ConfigInstance &rootConfig) override; }; IIndexManager::UP diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp index 9bc5e547462..85cf1efe4fe 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexcollection.cpp @@ -177,28 +177,28 @@ private: _result = mixer.mix(); } - virtual void visit(And &) { } - virtual void visit(AndNot &) { } - virtual void visit(Or &) { } - virtual void visit(WeakAnd &) { } - virtual void visit(Equiv &) { } - virtual void visit(Rank &) { } - virtual void visit(Near &) { } - virtual void visit(ONear &) { } - - virtual void visit(WeightedSetTerm &n) { visitTerm(n); } - virtual void visit(DotProduct &n) { visitTerm(n); } - virtual void visit(WandTerm &n) { visitTerm(n); } - virtual void visit(Phrase &n) { visitTerm(n); } - virtual void visit(NumberTerm &n) { visitTerm(n); } - virtual void visit(LocationTerm &n) { visitTerm(n); } - virtual void visit(PrefixTerm &n) { visitTerm(n); } - virtual void visit(RangeTerm &n) { visitTerm(n); } - virtual void visit(StringTerm &n) { visitTerm(n); } - virtual void visit(SubstringTerm &n) { visitTerm(n); } - virtual void visit(SuffixTerm &n) { visitTerm(n); } - virtual void visit(PredicateQuery &n) { visitTerm(n); } - virtual void visit(RegExpTerm &n) { visitTerm(n); } + virtual void visit(And &) override { } + virtual void visit(AndNot &) override { } + virtual void visit(Or &) override { } + virtual void visit(WeakAnd &) override { } + virtual void visit(Equiv &) override { } + virtual void visit(Rank &) override { } + virtual void visit(Near &) override { } + virtual void visit(ONear &) override { } + + virtual void visit(WeightedSetTerm &n) override { visitTerm(n); } + virtual void visit(DotProduct &n) override { visitTerm(n); } + virtual void visit(WandTerm &n) override { visitTerm(n); } + virtual void visit(Phrase &n) override { visitTerm(n); } + virtual void visit(NumberTerm &n) override { visitTerm(n); } + virtual void visit(LocationTerm &n) override { visitTerm(n); } + virtual void visit(PrefixTerm &n) override { visitTerm(n); } + virtual void visit(RangeTerm &n) override { visitTerm(n); } + virtual void visit(StringTerm &n) override { visitTerm(n); } + virtual void visit(SubstringTerm &n) override { visitTerm(n); } + virtual void visit(SuffixTerm &n) override { visitTerm(n); } + virtual void visit(PredicateQuery &n) override { visitTerm(n); } + virtual void visit(RegExpTerm &n) override { visitTerm(n); } public: CreateBlueprintVisitor(const IIndexCollection &indexes, diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h index fa4b2ad85fb..3919265272c 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexflushtarget.h @@ -22,16 +22,16 @@ public: IndexFlushTarget(IndexMaintainer &indexMaintainer); // Implements IFlushTarget - virtual MemoryGain getApproxMemoryGain() const; - virtual DiskGain getApproxDiskGain() const; - virtual SerialNum getFlushedSerialNum() const; - virtual Time getLastFlushTime() const; + virtual MemoryGain getApproxMemoryGain() const override; + virtual DiskGain getApproxDiskGain() const override; + virtual SerialNum getFlushedSerialNum() const override; + virtual Time getLastFlushTime() const override; virtual bool - needUrgentFlush() const; + needUrgentFlush() const override; - virtual Task::UP initFlush(SerialNum currentSerial); - virtual FlushStats getLastFlushStats() const { return _lastStats; } + virtual Task::UP initFlush(SerialNum currentSerial) override; + virtual FlushStats getLastFlushStats() const override { return _lastStats; } virtual uint64_t getApproxBytesToWriteToDisk() const override; }; diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp index 412c5b8c4a2..62308100b7e 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.cpp @@ -20,14 +20,14 @@ private: public: Fusioner(IndexMaintainer &indexMaintainer, FlushStats &stats, SerialNum serialNum) : _indexMaintainer(indexMaintainer), _stats(stats), _serialNum(serialNum) {} - virtual void run() { + virtual void run() override { vespalib::string outputFusionDir = _indexMaintainer.doFusion(_serialNum); // the target must live until this task is done (handled by flush engine). _stats.setPath(outputFusionDir); } virtual SerialNum - getFlushSerial(void) const + getFlushSerial(void) const override { return 0u; // Zero means that no tls syncing is needed } diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.h b/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.h index 6b67a150cec..b9dd7b48d54 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexfusiontarget.h @@ -20,14 +20,14 @@ public: IndexFusionTarget(IndexMaintainer &indexMaintainer); // Implements IFlushTarget - virtual MemoryGain getApproxMemoryGain() const; - virtual DiskGain getApproxDiskGain() const; - virtual SerialNum getFlushedSerialNum() const; - virtual Time getLastFlushTime() const; - virtual bool needUrgentFlush() const; - - virtual Task::UP initFlush(SerialNum currentSerial); - virtual FlushStats getLastFlushStats() const { return _lastStats; } + virtual MemoryGain getApproxMemoryGain() const override; + virtual DiskGain getApproxDiskGain() const override; + virtual SerialNum getFlushedSerialNum() const override; + virtual Time getLastFlushTime() const override; + virtual bool needUrgentFlush() const override; + + virtual Task::UP initFlush(SerialNum currentSerial) override; + virtual FlushStats getLastFlushStats() const override { return _lastStats; } virtual uint64_t getApproxBytesToWriteToDisk() const override; }; diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp index c075e98e1fc..795bf67f48e 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp @@ -59,7 +59,7 @@ public: _closure(std::move(closure)) { } - virtual void run() { + virtual void run() override { _result = _reconfigurer.reconfigure(std::move(_closure)); } }; @@ -73,7 +73,7 @@ public: _reconfigurer(reconfigurer), _closure(std::move(closure)) { } - virtual void run() { + virtual void run() override { _reconfigurer.reconfigure(std::move(_closure)); } }; diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h index 34c25632012..b8f5e668701 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h @@ -283,7 +283,7 @@ class IndexMaintainer : public IIndexManager, * result. */ bool reconfigure(vespalib::Closure0<bool>::UP closure); - virtual void warmupDone(ISearchableIndexCollection::SP current); + virtual void warmupDone(ISearchableIndexCollection::SP current) override; bool makeSureAllRemainingWarmupIsDone(ISearchableIndexCollection::SP keepAlive); void scheduleCommit(); void commit(); diff --git a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h index 7f96b401268..376cdca4f40 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h +++ b/searchcorespi/src/vespa/searchcorespi/index/warmupindexcollection.h @@ -47,7 +47,7 @@ public: Blueprint::UP createBlueprint(const IRequestContext & requestContext, const FieldSpecList &fields, - const Node &term); + const Node &term) override; search::SearchableStats getSearchableStats() const override; search::SerialNum getSerialNum() const override; void accept(IndexSearchableVisitor &visitor) const override; diff --git a/searchlib/src/apps/docstore/benchmarkdatastore.cpp b/searchlib/src/apps/docstore/benchmarkdatastore.cpp index 12feaf9727d..2393a82b44c 100644 --- a/searchlib/src/apps/docstore/benchmarkdatastore.cpp +++ b/searchlib/src/apps/docstore/benchmarkdatastore.cpp @@ -18,7 +18,7 @@ class BenchmarkDataStoreApp : public FastOS_Application { void usage(void); int benchmark(const vespalib::string & directory, size_t numReads, size_t numThreads, size_t perChunk, const vespalib::string & readType); - int Main(void); + int Main(void) override; void read(size_t numReads, size_t perChunk, const IDataStore * dataStore); }; diff --git a/searchlib/src/apps/docstore/create-idx-from-dat.cpp b/searchlib/src/apps/docstore/create-idx-from-dat.cpp index da6b887c27c..2e85bb168cb 100644 --- a/searchlib/src/apps/docstore/create-idx-from-dat.cpp +++ b/searchlib/src/apps/docstore/create-idx-from-dat.cpp @@ -13,7 +13,7 @@ class CreateIdxFileFromDatApp : public FastOS_Application { void usage(void); int createIdxFile(const vespalib::string & datFileName, const vespalib::string & idxFileName); - int Main(void); + int Main(void) override; }; void diff --git a/searchlib/src/apps/docstore/documentstoreinspect.cpp b/searchlib/src/apps/docstore/documentstoreinspect.cpp index 3ea5b3fcd68..ffd23f30dba 100644 --- a/searchlib/src/apps/docstore/documentstoreinspect.cpp +++ b/searchlib/src/apps/docstore/documentstoreinspect.cpp @@ -14,7 +14,7 @@ class DocumentStoreInspectApp : public FastOS_Application void usage(void); int verify(const vespalib::string & directory); int dumpIdxFile(const vespalib::string & file); - int Main(void); + int Main(void) override; }; diff --git a/searchlib/src/apps/docstore/verifylogdatastore.cpp b/searchlib/src/apps/docstore/verifylogdatastore.cpp index 2d723e7e5c1..e586b1b4ed7 100644 --- a/searchlib/src/apps/docstore/verifylogdatastore.cpp +++ b/searchlib/src/apps/docstore/verifylogdatastore.cpp @@ -14,7 +14,7 @@ class VerifyLogDataStoreApp : public FastOS_Application { void usage(void); int verify(const vespalib::string & directory); - int Main(void); + int Main(void) override; }; diff --git a/searchlib/src/apps/expgolomb/expgolomb.cpp b/searchlib/src/apps/expgolomb/expgolomb.cpp index 1070a9dab8f..4d783d8eaa4 100644 --- a/searchlib/src/apps/expgolomb/expgolomb.cpp +++ b/searchlib/src/apps/expgolomb/expgolomb.cpp @@ -16,7 +16,7 @@ class ExpGolombApp : public FastOS_Application testExpGolomb64le(int kValue); int - Main(void); + Main(void) override; }; diff --git a/searchlib/src/apps/fileheaderinspect/fileheaderinspect.cpp b/searchlib/src/apps/fileheaderinspect/fileheaderinspect.cpp index 3f0801a3a3f..2407be0b4c2 100644 --- a/searchlib/src/apps/fileheaderinspect/fileheaderinspect.cpp +++ b/searchlib/src/apps/fileheaderinspect/fileheaderinspect.cpp @@ -28,7 +28,7 @@ private: public: Application(); ~Application(); - int Main(); + int Main() override; }; Application::Application() : diff --git a/searchlib/src/apps/loadattribute/loadattribute.cpp b/searchlib/src/apps/loadattribute/loadattribute.cpp index ea1a3697f4c..e82ab3ac645 100644 --- a/searchlib/src/apps/loadattribute/loadattribute.cpp +++ b/searchlib/src/apps/loadattribute/loadattribute.cpp @@ -24,7 +24,7 @@ private: void usage(); public: - int Main(); + int Main() override; }; void diff --git a/searchlib/src/apps/tests/biglogtest.cpp b/searchlib/src/apps/tests/biglogtest.cpp index 3b943d9fd17..04201fdedce 100644 --- a/searchlib/src/apps/tests/biglogtest.cpp +++ b/searchlib/src/apps/tests/biglogtest.cpp @@ -32,7 +32,7 @@ private: vespalib::RandomGen _randomgenerator; public: - int Main() { + int Main() override { TEST_INIT("big_logdatastore_test"); if (_argc > 0) { diff --git a/searchlib/src/apps/tests/memoryindexstress_test.cpp b/searchlib/src/apps/tests/memoryindexstress_test.cpp index fec55d35975..60e70566c9e 100644 --- a/searchlib/src/apps/tests/memoryindexstress_test.cpp +++ b/searchlib/src/apps/tests/memoryindexstress_test.cpp @@ -28,7 +28,6 @@ LOG_SETUP("memoryindexstress_test"); using document::AnnotationType; -using document::DataType; using document::Document; using document::DocumentId; using document::DocumentType; @@ -37,11 +36,12 @@ using document::FieldValue; using document::Span; using document::SpanList; using document::StringFieldValue; +using search::ScheduleTaskCallback; +using search::index::schema::DataType; +using search::makeLambdaTask; using search::query::Node; using search::query::SimplePhrase; using search::query::SimpleStringTerm; -using search::makeLambdaTask; -using search::ScheduleTaskCallback; using namespace search::fef; using namespace search::index; using namespace search::memoryindex; @@ -64,8 +64,8 @@ Schema makeSchema() { Schema schema; - schema.addIndexField(Schema::IndexField(title, schema::STRING)); - schema.addIndexField(Schema::IndexField(body, schema::STRING)); + schema.addIndexField(Schema::IndexField(title, DataType::STRING)); + schema.addIndexField(Schema::IndexField(body, DataType::STRING)); return schema; } @@ -78,8 +78,8 @@ makeDocTypeRepoConfig(void) doc_type_name, document::config_builder::Struct(header_name), document::config_builder::Struct(body_name). - addField(title, DataType::T_STRING). - addField(body, DataType::T_STRING)); + addField(title, document::DataType::T_STRING). + addField(body, document::DataType::T_STRING)); return builder.config(); } diff --git a/searchlib/src/apps/uniform/uniform.cpp b/searchlib/src/apps/uniform/uniform.cpp index 18bdcadbc20..356c5e832aa 100644 --- a/searchlib/src/apps/uniform/uniform.cpp +++ b/searchlib/src/apps/uniform/uniform.cpp @@ -36,7 +36,7 @@ class UniformApp : public FastOS_Application reportBits(void); int - Main(void); + Main(void) override; }; diff --git a/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp b/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp index fa54ac8ca66..99049c0dea7 100644 --- a/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp +++ b/searchlib/src/apps/vespa-index-inspect/vespa-index-inspect.cpp @@ -19,25 +19,26 @@ #include <vespa/log/log.h> LOG_SETUP("vespa-index-inspect"); -using search::index::Schema; -using search::index::SchemaUtil; -using search::index::DictionaryFileRandRead; -using search::index::PostingListFileRandRead; -using search::index::PostingListOffsetAndCounts; -using search::index::PostingListCounts; -using search::index::PostingListHandle; +using search::TuneFileSeqRead; +using search::diskindex::DocIdMapping; +using search::diskindex::FieldReader; +using search::diskindex::PageDict4FileSeqRead; using search::diskindex::PageDict4RandRead; +using search::diskindex::WordNumMapping; using search::diskindex::Zc4PosOccRandRead; +using search::fef::FieldPositionsIterator; using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataArray; -using search::fef::FieldPositionsIterator; -using search::queryeval::SearchIterator; +using search::index::DictionaryFileRandRead; using search::index::DocIdAndFeatures; -using search::diskindex::DocIdMapping; -using search::diskindex::WordNumMapping; -using search::diskindex::FieldReader; -using search::diskindex::PageDict4FileSeqRead; -using search::TuneFileSeqRead; +using search::index::PostingListCounts; +using search::index::PostingListFileRandRead; +using search::index::PostingListHandle; +using search::index::PostingListOffsetAndCounts; +using search::index::Schema; +using search::index::SchemaUtil; +using search::index::schema::DataType; +using search::queryeval::SearchIterator; using namespace search::index; namespace @@ -238,13 +239,13 @@ public: ~ShowPostingListSubApp(void); virtual void - usage(bool showHeader); + usage(bool showHeader) override; virtual bool - getOptions(void); + getOptions(void) override; virtual int - run(void); + run(void) override; void showPostingList(void); @@ -411,7 +412,7 @@ ShowPostingListSubApp::readDocIdLimit(const Schema &schema) uint32_t numIndexFields = schema.getNumIndexFields(); for (uint32_t fieldId = 0; fieldId < numIndexFields; ++fieldId) { const Schema::IndexField &field = schema.getIndexField(fieldId); - if (field.getDataType() == schema::STRING) { + if (field.getDataType() == DataType::STRING) { FieldReader fr; if (!fr.open(_indexDir + "/" + field.getName() + "/", tuneFileRead)) @@ -740,13 +741,13 @@ public: ~DumpWordsSubApp(void); virtual void - usage(bool showHeader); + usage(bool showHeader) override; virtual bool - getOptions(void); + getOptions(void) override; virtual int - run(void); + run(void) override; void dumpWords(void); @@ -922,7 +923,7 @@ public: usage(void); int - Main(void); + Main(void) override; }; diff --git a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp index 7409ad4abbd..e97887c107e 100644 --- a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp +++ b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp @@ -330,9 +330,9 @@ State::~State() {} //----------------------------------------------------------------------------- struct MyApp : public FastOS_Application { - int Main(); + int Main() override; int usage(); - virtual bool useProcessStarter() const { return false; } + virtual bool useProcessStarter() const override { return false; } }; int diff --git a/searchlib/src/tests/aggregator/perdocexpr.cpp b/searchlib/src/tests/aggregator/perdocexpr.cpp index 81fbc964d9e..b68370334c5 100644 --- a/searchlib/src/tests/aggregator/perdocexpr.cpp +++ b/searchlib/src/tests/aggregator/perdocexpr.cpp @@ -1228,7 +1228,7 @@ void testAggregationResult(AggregationResult & aggr, const AggrGetter & g, TEST("testAggregationResults") { struct SumGetter : AggrGetter { - virtual const ResultNode &operator()(const AggregationResult & r) const + virtual const ResultNode &operator()(const AggregationResult & r) const override { return static_cast<const SumAggregationResult &>(r).getSum(); } }; SumAggregationResult sum; diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp index b1786a36597..421c3ce7138 100644 --- a/searchlib/src/tests/attribute/attribute_test.cpp +++ b/searchlib/src/tests/attribute/attribute_test.cpp @@ -251,7 +251,7 @@ private: public: AttributeTest() { } - int Main(); + int Main() override; }; void AttributeTest::testBaseName() diff --git a/searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp b/searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp index 6e1fc0ff80d..1f53bbc3ea1 100644 --- a/searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp +++ b/searchlib/src/tests/attribute/attributemanager/attributemanager_test.cpp @@ -48,7 +48,7 @@ public: AttributeManagerTest() { } - int Main(); + int Main() override; }; diff --git a/searchlib/src/tests/attribute/attributesearcher.h b/searchlib/src/tests/attribute/attributesearcher.h index 0978411c974..e776f549219 100644 --- a/searchlib/src/tests/attribute/attributesearcher.h +++ b/searchlib/src/tests/attribute/attributesearcher.h @@ -72,7 +72,7 @@ public: { _status._numClients = 1; } - virtual void doRun() = 0; + virtual void doRun() override = 0; AttributeSearcherStatus & getStatus() { return _status; } void buildTermQuery(std::vector<char> & buffer, const vespalib::string & index, const char * term, bool prefix = false); }; @@ -114,7 +114,7 @@ public: { _status._numQueries = numQueries; } - virtual void doRun(); + virtual void doRun() override; }; template <typename T> @@ -192,7 +192,7 @@ public: { _status._numQueries = numQueries; } - virtual void doRun(); + virtual void doRun() override; }; void @@ -234,7 +234,7 @@ public: { _status._numQueries = numQueries; } - virtual void doRun(); + virtual void doRun() override; }; void diff --git a/searchlib/src/tests/attribute/attributeupdater.h b/searchlib/src/tests/attribute/attributeupdater.h index 2e5b1cc2622..72db4779c03 100644 --- a/searchlib/src/tests/attribute/attributeupdater.h +++ b/searchlib/src/tests/attribute/attributeupdater.h @@ -161,7 +161,7 @@ public: uint32_t minValueCount, uint32_t maxValueCount); ~AttributeUpdaterThread(); - virtual void doRun(); + virtual void doRun() override; }; template <typename Vector, typename T, typename BT> diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp index 47944548f32..9f30f1e0713 100644 --- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp +++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp @@ -141,7 +141,7 @@ public: delete _threadPool; } } - int Main(); + int Main() override; }; diff --git a/searchlib/src/tests/attribute/comparator/comparator_test.cpp b/searchlib/src/tests/attribute/comparator/comparator_test.cpp index 2a4c3c6fb87..ccc565407b8 100644 --- a/searchlib/src/tests/attribute/comparator/comparator_test.cpp +++ b/searchlib/src/tests/attribute/comparator/comparator_test.cpp @@ -42,7 +42,7 @@ private: public: Test() {} - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp index 58db1d11fec..24a9d85a068 100644 --- a/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp +++ b/searchlib/src/tests/attribute/enumeratedsave/enumeratedsave_test.cpp @@ -106,8 +106,8 @@ public: ~MemAttr(); // Implements IAttributeSaveTarget - virtual bool setup() { return true; } - virtual void close() {} + virtual bool setup() override { return true; } + virtual void close() override {} virtual IAttributeFileWriter &datWriter() override { return _datWriter; } virtual IAttributeFileWriter &idxWriter() override { return _idxWriter; } virtual IAttributeFileWriter &weightWriter() override { diff --git a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp index 63d12aaf242..7944e81ac55 100644 --- a/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp +++ b/searchlib/src/tests/attribute/enumstore/enumstore_test.cpp @@ -100,7 +100,7 @@ private: public: EnumStoreTest() {} - int Main(); + int Main() override; }; EnumStoreTest::Reader::Reader(uint32_t generation, const IndexVector & indices, const ExpectedVector & expected) diff --git a/searchlib/src/tests/attribute/extendattributes/extendattribute.cpp b/searchlib/src/tests/attribute/extendattributes/extendattribute.cpp index 0bb751d26ee..9e15f666130 100644 --- a/searchlib/src/tests/attribute/extendattributes/extendattribute.cpp +++ b/searchlib/src/tests/attribute/extendattributes/extendattribute.cpp @@ -18,7 +18,7 @@ private: void testExtendString(Attribute & attr); public: - int Main(); + int Main() override; }; template <typename Attribute> diff --git a/searchlib/src/tests/attribute/guard/attributeguard.cpp b/searchlib/src/tests/attribute/guard/attributeguard.cpp index 5c90caa094b..9eef5e93490 100644 --- a/searchlib/src/tests/attribute/guard/attributeguard.cpp +++ b/searchlib/src/tests/attribute/guard/attributeguard.cpp @@ -11,7 +11,7 @@ namespace search { class AttributeGuardTest : public vespalib::TestApp { public: - int Main(); + int Main() override; }; int diff --git a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp index 89ca125c45e..20590a11da0 100644 --- a/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp +++ b/searchlib/src/tests/attribute/multi_value_mapping/multi_value_mapping_test.cpp @@ -26,17 +26,17 @@ class MyAttribute : public search::NotImplementedAttribute using MultiValueType = typename MvMapping::MultiValueType; using ConstArrayRef = vespalib::ConstArrayRef<MultiValueType>; MvMapping &_mvMapping; - virtual void onCommit() { } - virtual void onUpdateStat() { } - virtual void onShrinkLidSpace() { + virtual void onCommit() override { } + virtual void onUpdateStat() override { } + virtual void onShrinkLidSpace() override { uint32_t committedDocIdLimit = getCommittedDocIdLimit(); _mvMapping.shrink(committedDocIdLimit); setNumDocs(committedDocIdLimit); } - virtual void removeOldGenerations(generation_t firstUsed) { + virtual void removeOldGenerations(generation_t firstUsed) override { _mvMapping.trimHoldLists(firstUsed); } - virtual void onGenerationChange(generation_t generation) { + virtual void onGenerationChange(generation_t generation) override { _mvMapping.transferHoldLists(generation - 1); } @@ -46,13 +46,13 @@ public: _mvMapping(mvMapping) { } - virtual bool addDoc(DocId &doc) { + virtual bool addDoc(DocId &doc) override { _mvMapping.addDoc(doc); incNumDocs(); updateUncommittedDocIdLimit(doc); return false; } - virtual uint32_t clearDoc(uint32_t docId) { + virtual uint32_t clearDoc(uint32_t docId) override { assert(docId < _mvMapping.size()); _mvMapping.set(docId, ConstArrayRef()); return 1u; diff --git a/searchlib/src/tests/attribute/postinglist/postinglist.cpp b/searchlib/src/tests/attribute/postinglist/postinglist.cpp index 2bd02d433d5..271b062ebcd 100644 --- a/searchlib/src/tests/attribute/postinglist/postinglist.cpp +++ b/searchlib/src/tests/attribute/postinglist/postinglist.cpp @@ -228,7 +228,7 @@ public: { } - int Main(void); + int Main(void) override; }; diff --git a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp index 92effde5686..b2bc047553e 100644 --- a/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp +++ b/searchlib/src/tests/attribute/postinglistattribute/postinglistattribute_test.cpp @@ -170,7 +170,7 @@ private: void testDupValuesInIntArray(); void testDupValuesInStringArray(); public: - int Main(); + int Main() override; }; template <> diff --git a/searchlib/src/tests/attribute/runnable.h b/searchlib/src/tests/attribute/runnable.h index 5038c22a1a5..e36af939943 100644 --- a/searchlib/src/tests/attribute/runnable.h +++ b/searchlib/src/tests/attribute/runnable.h @@ -18,7 +18,7 @@ public: Runnable(uint32_t id) : _id(id), _cond(), _done(false), _stopped(false) { } - void Run(FastOS_ThreadInterface *, void *) { + void Run(FastOS_ThreadInterface *, void *) override { doRun(); vespalib::MonitorGuard guard(_cond); diff --git a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp index bd781a37a5b..c9ebe399ab5 100644 --- a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp @@ -54,22 +54,22 @@ public: _map[attr->getName()] = attr; } - virtual AttributeGuard::UP getAttribute(const vespalib::string &name) const { + virtual AttributeGuard::UP getAttribute(const vespalib::string &name) const override { return AttributeGuard::UP(new AttributeGuard(lookup(name))); } - virtual AttributeGuard::UP getAttributeStableEnum(const vespalib::string &name) const { + virtual AttributeGuard::UP getAttributeStableEnum(const vespalib::string &name) const override { return AttributeGuard::UP(new AttributeEnumGuard(lookup(name))); } - virtual void getAttributeList(std::vector<AttributeGuard> &list) const { + virtual void getAttributeList(std::vector<AttributeGuard> &list) const override { Map::const_iterator pos = _map.begin(); for (; pos != _map.end(); ++pos) { list.push_back(pos->second); } } - virtual IAttributeContext::UP createContext() const { + virtual IAttributeContext::UP createContext() const override { return IAttributeContext::UP(new AttributeContext(*this)); } }; @@ -193,7 +193,7 @@ struct WS { class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; }; int diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp index 6d36dc6bb63..6c8d67c7a61 100644 --- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp @@ -62,7 +62,7 @@ class Test : public vespalib::TestApp { bool search(const Node &term, IAttributeManager &attribute_manager); public: - int Main(); + int Main() override; }; int diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp index ae4d8b91387..618adb006d6 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext.cpp @@ -168,14 +168,14 @@ private: class AttributeIteratorTester : public IteratorTester { public: - virtual bool matches(const SearchIterator & base) const { + virtual bool matches(const SearchIterator & base) const override { return dynamic_cast<const AttributeIterator *>(&base) != NULL; } }; class FlagAttributeIteratorTester : public IteratorTester { public: - virtual bool matches(const SearchIterator & base) const { + virtual bool matches(const SearchIterator & base) const override { return (dynamic_cast<const FlagAttributeIterator *>(&base) != NULL) || (dynamic_cast<const BitVectorIterator *>(&base) != NULL) || (dynamic_cast<const queryeval::EmptySearch *>(&base) != NULL); @@ -184,7 +184,7 @@ private: class AttributePostingListIteratorTester : public IteratorTester { public: - virtual bool matches(const SearchIterator & base) const { + virtual bool matches(const SearchIterator & base) const override { return dynamic_cast<const AttributePostingListIterator *>(&base) != NULL || dynamic_cast<const queryeval::EmptySearch *>(&base) != NULL; @@ -280,7 +280,7 @@ private: public: SearchContextTest(); - int Main(); + int Main() override; }; diff --git a/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp b/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp index a8d53314745..0babb633404 100644 --- a/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp +++ b/searchlib/src/tests/attribute/sourceselector/sourceselector_test.cpp @@ -33,7 +33,7 @@ const uint32_t base_id = 42; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; private: void testSourceSelector(const DocSource *docSource, size_t sz, uint8_t defaultSource, ISourceSelector & selector); void testFixed(const DocSource *docSource, size_t sz); diff --git a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp index 207eb76510a..f1034806e36 100644 --- a/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp +++ b/searchlib/src/tests/attribute/stringattribute/stringattribute_test.cpp @@ -46,7 +46,7 @@ private: void testSingleValue(Attribute & svsa, Config &cfg); public: - int Main(); + int Main() override; }; template <typename Attribute> diff --git a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp index 001a420e83f..17e0641ccaf 100644 --- a/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp +++ b/searchlib/src/tests/bitcompression/expgolomb/expgolomb_test.cpp @@ -65,7 +65,7 @@ public: { } - virtual uint64_t decode() + virtual uint64_t decode() override { unsigned int length; uint64_t val64; @@ -74,14 +74,14 @@ public: return val64; } - virtual void skip() + virtual void skip() override { unsigned int length; UC64_SKIPEXPGOLOMB(_dc._val, _dc._valI, _dc._preRead, _dc._cacheInt, _kValue, EC); } - virtual uint64_t decodeSmall() + virtual uint64_t decodeSmall() override { unsigned int length; uint64_t val64; @@ -90,7 +90,7 @@ public: return val64; } - virtual uint64_t decodeSmallApply() + virtual uint64_t decodeSmallApply() override { unsigned int length; uint64_t val64; @@ -99,7 +99,7 @@ public: return val64; } - virtual void skipSmall() + virtual void skipSmall() override { unsigned int length; UC64_SKIPEXPGOLOMB_SMALL(_dc._val, _dc._valI, _dc._preRead, @@ -135,7 +135,7 @@ public: { } - virtual uint64_t decode() + virtual uint64_t decode() override { unsigned int length; uint64_t val64; @@ -144,14 +144,14 @@ public: return val64; } - virtual void skip() + virtual void skip() override { unsigned int length; UC64_SKIPEXPGOLOMB(_dc._val, _dc._valI, _dc._preRead, _dc._cacheInt, kValue, EC); } - virtual uint64_t decodeSmall() + virtual uint64_t decodeSmall() override { unsigned int length; uint64_t val64; @@ -160,7 +160,7 @@ public: return val64; } - virtual uint64_t decodeSmallApply() + virtual uint64_t decodeSmallApply() override { unsigned int length; uint64_t val64; @@ -169,7 +169,7 @@ public: return val64; } - virtual void skipSmall() + virtual void skipSmall() override { unsigned int length; UC64_SKIPEXPGOLOMB_SMALL(_dc._val, _dc._valI, _dc._preRead, diff --git a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp index c9b962495f4..400d16b3d86 100644 --- a/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp +++ b/searchlib/src/tests/bitvector/bitvectorbenchmark.cpp @@ -25,7 +25,7 @@ private: public: BitVectorBenchmark(); ~BitVectorBenchmark(); - int Main(); + int Main() override; }; BitVectorBenchmark::BitVectorBenchmark() : diff --git a/searchlib/src/tests/btree/btreeaggregation_test.cpp b/searchlib/src/tests/btree/btreeaggregation_test.cpp index aa3ee432df5..ae9cb5b21c7 100644 --- a/searchlib/src/tests/btree/btreeaggregation_test.cpp +++ b/searchlib/src/tests/btree/btreeaggregation_test.cpp @@ -392,7 +392,7 @@ private: void requireThatSmallNodesWorks(); public: - int Main(); + int Main() override; }; diff --git a/searchlib/src/tests/btree/iteratespeed.cpp b/searchlib/src/tests/btree/iteratespeed.cpp index 719dc28c036..bc1be5b495c 100644 --- a/searchlib/src/tests/btree/iteratespeed.cpp +++ b/searchlib/src/tests/btree/iteratespeed.cpp @@ -39,7 +39,7 @@ class IterateSpeed : public FastOS_Application void usage(); int - Main(void); + Main(void) override; }; diff --git a/searchlib/src/tests/bytecomplens/bytecomp.cpp b/searchlib/src/tests/bytecomplens/bytecomp.cpp index 63aa2da15f6..78b5cbd24dd 100644 --- a/searchlib/src/tests/bytecomplens/bytecomp.cpp +++ b/searchlib/src/tests/bytecomplens/bytecomp.cpp @@ -13,7 +13,7 @@ private: void testRandomLengths(); public: - int Main() { + int Main() override { TEST_INIT("bytecomplens_test"); testRandomLengths(); TEST_FLUSH(); TEST_DONE(); diff --git a/searchlib/src/tests/datastore/datastore/datastore_test.cpp b/searchlib/src/tests/datastore/datastore/datastore_test.cpp index ae30a98d0fb..2c9b08f8a12 100644 --- a/searchlib/src/tests/datastore/datastore/datastore_test.cpp +++ b/searchlib/src/tests/datastore/datastore/datastore_test.cpp @@ -36,7 +36,7 @@ public: ParentType::transferHoldLists(generation); } - void trimElemHoldList(generation_t usedGen) { + void trimElemHoldList(generation_t usedGen) override { ParentType::trimElemHoldList(usedGen); } void incDead(EntryRef ref, uint64_t dead) { @@ -143,7 +143,7 @@ private: void requireThatWecanDisableElemHoldList(void); void requireThatBufferGrowthWorks(); public: - int Main(); + int Main() override; }; bool diff --git a/searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp b/searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp index 33800480492..f3c2f73c78c 100644 --- a/searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp +++ b/searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp @@ -9,6 +9,7 @@ LOG_SETUP("bitvector_test"); #include <vespa/vespalib/io/fileutil.h> using namespace search::index; +using search::index::schema::DataType; namespace search { namespace diskindex { @@ -85,7 +86,7 @@ public: requireThatDictionaryHandlesMultipleEntries(bool directio, bool readmmap); Test(); - int Main(); + int Main() override; }; void @@ -191,7 +192,7 @@ Test::Test() : _schema(), _indexId(0) { - _schema.addIndexField(Schema::IndexField("f1", schema::STRING)); + _schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); } int diff --git a/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp b/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp index 55d72f3aa58..adabe0e2679 100644 --- a/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp +++ b/searchlib/src/tests/diskindex/diskindex/diskindex_test.cpp @@ -63,7 +63,7 @@ private: void requireThatSearchIteratorsConforms(); public: Test(); - int Main(); + int Main() override; }; class Verifier : public SearchIteratorVerifier { diff --git a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp index d3cebd9944d..6bde0b965a6 100644 --- a/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp +++ b/searchlib/src/tests/diskindex/fieldwriter/fieldwriter_test.cpp @@ -24,30 +24,32 @@ #include <vespa/log/log.h> LOG_SETUP("fieldwriter_test"); - using search::ResultSet; -using search::fef::TermFieldMatchData; -using search::fef::TermFieldMatchDataArray; -using search::queryeval::SearchIterator; +using search::TuneFileRandRead; +using search::TuneFileSeqRead; +using search::TuneFileSeqWrite; +using search::common::FileHeaderContext; +using search::diskindex::CheckPointFile; +using search::diskindex::DocIdMapping; +using search::diskindex::FieldReader; +using search::diskindex::FieldWriter; +using search::diskindex::PageDict4RandRead; +using search::diskindex::WordNumMapping; using search::fakedata::FakeWord; using search::fakedata::FakeWordSet; -using search::index::PostingListParams; +using search::fef::TermFieldMatchData; +using search::fef::TermFieldMatchDataArray; +using search::index::DummyFileHeaderContext; using search::index::PostingListCounts; using search::index::PostingListOffsetAndCounts; +using search::index::PostingListParams; using search::index::Schema; using search::index::SchemaUtil; -using search::common::FileHeaderContext; -using search::index::DummyFileHeaderContext; -using search::diskindex::CheckPointFile; -using search::TuneFileSeqRead; -using search::TuneFileSeqWrite; -using search::TuneFileRandRead; +using search::index::schema::CollectionType; +using search::index::schema::DataType; +using search::queryeval::SearchIterator; using vespalib::nbostream; -using search::diskindex::FieldWriter; -using search::diskindex::FieldReader; -using search::diskindex::DocIdMapping; -using search::diskindex::WordNumMapping; -using search::diskindex::PageDict4RandRead; + using namespace search::index; // needed to resolve external symbol from httpd.h on AIX @@ -113,7 +115,7 @@ private: public: FieldWriterTest(void); ~FieldWriterTest(void); - int Main(void); + int Main(void) override; }; @@ -188,8 +190,8 @@ WrappedFieldWriter::WrappedFieldWriter(const vespalib::string &namepref, _schema(), _indexId() { - schema::CollectionType ct(schema::SINGLE); - _schema.addIndexField(Schema::IndexField("field1", schema::STRING, ct)); + schema::CollectionType ct(CollectionType::SINGLE); + _schema.addIndexField(Schema::IndexField("field1", DataType::STRING, ct)); _indexId = _schema.getIndexFieldId("field1"); } @@ -324,12 +326,12 @@ WrappedFieldReader::WrappedFieldReader(const vespalib::string &namepref, _oldSchema(), _schema() { - Schema::CollectionType ct(schema::SINGLE); + Schema::CollectionType ct(CollectionType::SINGLE); _oldSchema.addIndexField(Schema::IndexField("field1", - schema::STRING, + DataType::STRING, ct)); _schema.addIndexField(Schema::IndexField("field1", - schema::STRING, + DataType::STRING, ct)); } diff --git a/searchlib/src/tests/diskindex/fusion/fusion_test.cpp b/searchlib/src/tests/diskindex/fusion/fusion_test.cpp index 245da126dbb..f5f1f97d29b 100644 --- a/searchlib/src/tests/diskindex/fusion/fusion_test.cpp +++ b/searchlib/src/tests/diskindex/fusion/fusion_test.cpp @@ -20,16 +20,18 @@ namespace search { - using document::Document; using fef::FieldPositionsIterator; using fef::TermFieldMatchData; using fef::TermFieldMatchDataArray; -using namespace index; -using search::common::FileHeaderContext; using memoryindex::Dictionary; using memoryindex::DocumentInverter; using queryeval::SearchIterator; +using search::common::FileHeaderContext; +using search::index::schema::CollectionType; +using search::index::schema::DataType; + +using namespace index; namespace diskindex { @@ -43,7 +45,7 @@ private: void requireThatFusionIsWorking(const vespalib::string &prefix, bool directio, bool readmmap); public: Test(); - int Main(); + int Main() override; }; namespace { @@ -247,19 +249,20 @@ Test::requireThatFusionIsWorking(const vespalib::string &prefix, schema.addIndexField(Schema::IndexField(iField.getName(), iField.getDataType(), iField.getCollectionType())); - if (iField.getCollectionType() == schema::WEIGHTEDSET) + if (iField.getCollectionType() == CollectionType::WEIGHTEDSET) { schema2.addIndexField(Schema::IndexField(iField.getName(), - iField.getDataType(), - schema::ARRAY)); - else + iField.getDataType(), + CollectionType::ARRAY)); + } else { schema2.addIndexField(Schema::IndexField(iField.getName(), - iField.getDataType(), - iField.getCollectionType())); + iField.getDataType(), + iField.getCollectionType())); + } schema3.addIndexField(Schema::IndexField(iField.getName(), iField.getDataType(), - schema::SINGLE)); + CollectionType::SINGLE)); } - schema3.addIndexField(Schema::IndexField("f4", schema::STRING)); + schema3.addIndexField(Schema::IndexField("f4", DataType::STRING)); schema.addFieldSet(Schema::FieldSet("nc0"). addField("f0").addField("f1")); schema2.addFieldSet(Schema::FieldSet("nc0"). @@ -447,10 +450,10 @@ Test::requireThatFusionIsWorking(const vespalib::string &prefix, Test::Test() : _schema() { - _schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - _schema.addIndexField(Schema::IndexField("f1", schema::STRING)); - _schema.addIndexField(Schema::IndexField("f2", schema::STRING, schema::ARRAY)); - _schema.addIndexField(Schema::IndexField("f3", schema::STRING, schema::WEIGHTEDSET)); + _schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f2", DataType::STRING, CollectionType::ARRAY)); + _schema.addIndexField(Schema::IndexField("f3", DataType::STRING, CollectionType::WEIGHTEDSET)); } int diff --git a/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp b/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp index 37fc78df460..2d12b5c1782 100644 --- a/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp +++ b/searchlib/src/tests/diskindex/pagedict4/pagedict4test.cpp @@ -16,30 +16,33 @@ #include <vespa/log/log.h> LOG_SETUP("pagedict4test"); -using search::bitcompression::PostingListCountFileEncodeContext; -using search::bitcompression::PostingListCountFileDecodeContext; -using search::index::PostingListCounts; -using search::index::PostingListOffsetAndCounts; -using search::index::PostingListParams; -using search::bitcompression::PageDict4SSWriter; -using search::bitcompression::PageDict4SPWriter; +using search::bitcompression::PageDict4PLookupRes; using search::bitcompression::PageDict4PWriter; using search::bitcompression::PageDict4Reader; -using search::bitcompression::PageDict4SSReader; -using search::bitcompression::PageDict4SSLookupRes; using search::bitcompression::PageDict4SPLookupRes; -using search::bitcompression::PageDict4PLookupRes; -using search::index::Schema; -using search::index::DictionaryFileSeqRead; -using search::index::DictionaryFileSeqWrite; -using search::index::DictionaryFileRandRead; +using search::bitcompression::PageDict4SPWriter; +using search::bitcompression::PageDict4SSLookupRes; +using search::bitcompression::PageDict4SSReader; +using search::bitcompression::PageDict4SSWriter; +using search::bitcompression::PostingListCountFileDecodeContext; +using search::bitcompression::PostingListCountFileEncodeContext; using search::diskindex::PageDict4FileSeqRead; using search::diskindex::PageDict4FileSeqWrite; using search::diskindex::PageDict4RandRead; +using search::index::DictionaryFileRandRead; +using search::index::DictionaryFileSeqRead; +using search::index::DictionaryFileSeqWrite; using search::index::DummyFileHeaderContext; +using search::index::PostingListCounts; +using search::index::PostingListOffsetAndCounts; +using search::index::PostingListParams; +using search::index::Schema; +using search::index::schema::CollectionType; +using search::index::schema::DataType; + using namespace search::index; -typedef search::bitcompression::PageDict4StartOffset StartOffset; +using StartOffset = search::bitcompression::PageDict4StartOffset; namespace { @@ -216,7 +219,7 @@ public: usage(void); int - Main(void); + Main(void) override; void testWords(void); @@ -645,8 +648,8 @@ testWords(const std::string &logname, fn << "f0"; schema.addIndexField(Schema:: IndexField(fn.str(), - schema::STRING, - schema::SINGLE)); + DataType::STRING, + CollectionType::SINGLE)); indexes.push_back(0); } { diff --git a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp index f8a7dd28720..649c230ba5c 100644 --- a/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp +++ b/searchlib/src/tests/docstore/document_store_visitor/document_store_visitor_test.cpp @@ -85,7 +85,7 @@ public: } void - sync(SerialNum syncTo) + sync(SerialNum syncTo) override { _syncedTo = syncTo; } @@ -125,10 +125,10 @@ public: using MyVisitorBase::MyVisitorBase; virtual void - visit(uint32_t lid, const Document &doc); + visit(uint32_t lid, const Document &doc) override; virtual void - visit(uint32_t lid); + visit(uint32_t lid) override; }; @@ -159,7 +159,7 @@ public: using MyVisitorBase::MyVisitorBase; virtual void - visit(uint32_t lid, Document &doc); + visit(uint32_t lid, Document &doc) override; }; @@ -184,7 +184,7 @@ public: MyVisitorProgress(); virtual void - updateProgress(double progress); + updateProgress(double progress) override; virtual double getProgress() const; diff --git a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp index 15a70e742ec..f53423a4981 100644 --- a/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp +++ b/searchlib/src/tests/docstore/logdatastore/logdatastore_test.cpp @@ -24,7 +24,7 @@ class MyTlSyncer : public transactionlog::SyncProxy { public: MyTlSyncer(void) : _syncedTo(0) { } - void sync(SerialNum syncTo) { + void sync(SerialNum syncTo) override { _syncedTo = syncTo; } }; @@ -480,7 +480,7 @@ private: _actual.insert(lid); _vcs.verifyDoc(*doc, lid); } - bool allowVisitCaching() const { return _allowVisitCaching; } + bool allowVisitCaching() const override { return _allowVisitCaching; } private: VisitCacheStore &_vcs; vespalib::hash_set<uint32_t> _expected; diff --git a/searchlib/src/tests/engine/docsumapi/docsumapi_test.cpp b/searchlib/src/tests/engine/docsumapi/docsumapi_test.cpp index d96295bb7ad..b89bf6f093f 100644 --- a/searchlib/src/tests/engine/docsumapi/docsumapi_test.cpp +++ b/searchlib/src/tests/engine/docsumapi/docsumapi_test.cpp @@ -26,7 +26,7 @@ class Test : public vespalib::TestApp public: void convertToRequest(); void convertFromReply(); - int Main(); + int Main() override; }; document::GlobalId gid0("aaaaaaaaaaaa"); diff --git a/searchlib/src/tests/engine/monitorapi/monitorapi_test.cpp b/searchlib/src/tests/engine/monitorapi/monitorapi_test.cpp index 0df52cbe0d8..9198a4462c6 100644 --- a/searchlib/src/tests/engine/monitorapi/monitorapi_test.cpp +++ b/searchlib/src/tests/engine/monitorapi/monitorapi_test.cpp @@ -34,7 +34,7 @@ class Test : public vespalib::TestApp public: void convertToRequest(); void convertFromReply(); - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/engine/searchapi/searchapi_test.cpp b/searchlib/src/tests/engine/searchapi/searchapi_test.cpp index ce850c9e1e1..9cfc0d15678 100644 --- a/searchlib/src/tests/engine/searchapi/searchapi_test.cpp +++ b/searchlib/src/tests/engine/searchapi/searchapi_test.cpp @@ -35,7 +35,7 @@ public: void propertyNames(); void convertToRequest(); void convertFromReply(); - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/engine/transportserver/transportserver_test.cpp b/searchlib/src/tests/engine/transportserver/transportserver_test.cpp index 9a5e4f85d88..b7932ea2381 100644 --- a/searchlib/src/tests/engine/transportserver/transportserver_test.cpp +++ b/searchlib/src/tests/engine/transportserver/transportserver_test.cpp @@ -20,9 +20,9 @@ class SyncServer : public search::engine::SearchServer, public search::engine::MonitorServer { private: - virtual SearchReply::UP search(SearchRequest::Source request, SearchClient &client); - virtual DocsumReply::UP getDocsums(DocsumRequest::Source request, DocsumClient &client); - virtual MonitorReply::UP ping(MonitorRequest::UP request, MonitorClient &client); + virtual SearchReply::UP search(SearchRequest::Source request, SearchClient &client) override; + virtual DocsumReply::UP getDocsums(DocsumRequest::Source request, DocsumClient &client) override; + virtual MonitorReply::UP ping(MonitorRequest::UP request, MonitorClient &client) override; SyncServer(const SyncServer &); SyncServer &operator=(const SyncServer &); diff --git a/searchlib/src/tests/features/beta/beta_features.cpp b/searchlib/src/tests/features/beta/beta_features.cpp index 2d992ab82e1..fcb769faef6 100644 --- a/searchlib/src/tests/features/beta/beta_features.cpp +++ b/searchlib/src/tests/features/beta/beta_features.cpp @@ -41,6 +41,7 @@ LOG_SETUP("beta_features_test"); using namespace search::features; using namespace search::fef; using namespace search::fef::test; +using CollectionType = FieldInfo::CollectionType; //--------------------------------------------------------------------------------------------------------------------- // TermPositionList @@ -63,7 +64,7 @@ public: //--------------------------------------------------------------------------------------------------------------------- class Test : public FtTestApp { public: - int Main(); + int Main() override; void testJaroWinklerDistance(); void testProximity(); void testFlowCompleteness(); diff --git a/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp b/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp index 24d1625520d..34b10d19715 100644 --- a/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp +++ b/searchlib/src/tests/features/element_completeness/element_completeness_test.cpp @@ -12,6 +12,7 @@ using namespace search::fef; using namespace search::fef::test; using namespace search::features; +using CollectionType = FieldInfo::CollectionType; std::vector<vespalib::string> featureNamesFoo() { std::vector<vespalib::string> f; @@ -54,7 +55,7 @@ struct IndexFixture { struct FeatureDumpFixture : public IDumpFeatureVisitor { std::vector<vespalib::string> expect; size_t dumped; - virtual void visitDumpFeature(const vespalib::string &name) { + virtual void visitDumpFeature(const vespalib::string &name) override { EXPECT_LESS(dumped, expect.size()); EXPECT_EQUAL(expect[dumped++], name); } diff --git a/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp b/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp index 181f2fb71f3..7fa9e7c8bc2 100644 --- a/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp +++ b/searchlib/src/tests/features/element_similarity_feature/element_similarity_feature_test.cpp @@ -13,6 +13,7 @@ using namespace search::fef; using namespace search::fef::test; using namespace search::features; +using CollectionType = FieldInfo::CollectionType; const vespalib::string DEFAULT = "elementSimilarity(foo)"; const vespalib::string PROXIMITY = "elementSimilarity(foo).proximity"; @@ -64,7 +65,7 @@ struct IndexFixture { struct FeatureDumpFixture : public IDumpFeatureVisitor { std::vector<vespalib::string> actual; FeatureDumpFixture() : IDumpFeatureVisitor(), actual() {} - virtual void visitDumpFeature(const vespalib::string &name) { + virtual void visitDumpFeature(const vespalib::string &name) override { actual.push_back(name); } }; diff --git a/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp b/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp index b947f1a71e2..00aa4ed7b20 100644 --- a/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp +++ b/searchlib/src/tests/features/euclidean_distance/euclidean_distance_test.cpp @@ -27,6 +27,7 @@ typedef search::attribute::BasicType AVBT; typedef search::attribute::CollectionType AVCT; typedef search::AttributeVector::SP AttributePtr; typedef FtTestApp FTA; +using CollectionType = FieldInfo::CollectionType; struct SetupFixture { diff --git a/searchlib/src/tests/features/featurebenchmark.cpp b/searchlib/src/tests/features/featurebenchmark.cpp index a20ec88fef3..40345b1c023 100644 --- a/searchlib/src/tests/features/featurebenchmark.cpp +++ b/searchlib/src/tests/features/featurebenchmark.cpp @@ -36,6 +36,8 @@ typedef search::attribute::CollectionType AVCT; typedef AttributeVector::SP AttributePtr; +using CollectionType = FieldInfo::CollectionType; + class Benchmark : public FtTestApp { public: typedef std::vector<std::pair<vespalib::string, vespalib::string> > KeyValueVector; @@ -130,7 +132,7 @@ private: public: Benchmark() : _factory(), _timer(), _sample() {} - int Main(); + int Main() override; }; diff --git a/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp b/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp index a01b1ad1575..59dacf3c69a 100644 --- a/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp +++ b/searchlib/src/tests/features/imported_dot_product/imported_dot_product_test.cpp @@ -11,6 +11,7 @@ using namespace search::attribute; using namespace search::features; using namespace search::fef; using namespace search::fef::test; +using namespace search::index; template <typename T> std::unique_ptr<fef::Anything> create_param(const vespalib::string& param) { @@ -45,9 +46,9 @@ struct FixtureBase : ImportedAttributeFixture { feature.getQueryEnv().getObjectStore().add("dotProduct.vector.object", std::move(pre_parsed)); } feature.getIndexEnv().getAttributeMap().add(imported_attr); - fef::CollectionType collection_type( + schema::CollectionType collection_type( (imported_attr->getCollectionType() == attribute::CollectionType::ARRAY) - ? fef::CollectionType::ARRAY : fef::CollectionType::WEIGHTEDSET); + ? schema::CollectionType::ARRAY : schema::CollectionType::WEIGHTEDSET); feature.getIndexEnv().getBuilder().addField( FieldType::ATTRIBUTE, collection_type, imported_attr->getName()); ASSERT_TRUE(feature.setup()); @@ -109,7 +110,7 @@ struct ArrayFixture : FixtureBase { feature.getIndexEnv().getAttributeMap().add(imported_attr); feature.getIndexEnv().getBuilder().addField( - FieldType::ATTRIBUTE, fef::CollectionType::ARRAY, imported_attr->getName()); + FieldType::ATTRIBUTE, schema::CollectionType::ARRAY, imported_attr->getName()); bp.setup(feature.getIndexEnv(), params); feature.getQueryEnv().getProperties().add("dotProduct.fancyvector", input_vector); diff --git a/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp b/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp index fe093d41ba7..51405064ac6 100644 --- a/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp +++ b/searchlib/src/tests/features/item_raw_score/item_raw_score_test.cpp @@ -14,6 +14,7 @@ using search::feature_t; using namespace search::fef; using namespace search::fef::test; using namespace search::features; +using CollectionType = FieldInfo::CollectionType; const vespalib::string featureName("itemRawScore(label)"); @@ -36,7 +37,7 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) { + virtual void visitDumpFeature(const vespalib::string &) override { TEST_ERROR("no features should be dumped"); } FeatureDumpFixture() : IDumpFeatureVisitor() {} @@ -47,13 +48,13 @@ struct Labels { virtual ~Labels() {} }; struct NoLabel : public Labels { - virtual void inject(Properties &) const {} + virtual void inject(Properties &) const override {} }; struct SingleLabel : public Labels { vespalib::string label; uint32_t uid; SingleLabel(const vespalib::string &l, uint32_t x) : label(l), uid(x) {} - virtual void inject(Properties &p) const { + virtual void inject(Properties &p) const override { vespalib::asciistream key; key << "vespa.label." << label << ".id"; vespalib::asciistream value; diff --git a/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp b/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp index 87305cd1670..89d59406b55 100644 --- a/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp +++ b/searchlib/src/tests/features/native_dot_product/native_dot_product_test.cpp @@ -14,6 +14,7 @@ using search::feature_t; using namespace search::fef; using namespace search::fef::test; using namespace search::features; +using CollectionType = FieldInfo::CollectionType; const std::string featureName("nativeDotProduct(foo)"); @@ -36,7 +37,7 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) { + virtual void visitDumpFeature(const vespalib::string &) override { TEST_ERROR("no features should be dumped"); } FeatureDumpFixture() : IDumpFeatureVisitor() {} diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp index 3bdb1faa240..770473d5308 100644 --- a/searchlib/src/tests/features/prod_features.cpp +++ b/searchlib/src/tests/features/prod_features.cpp @@ -62,11 +62,11 @@ using search::StringAttribute; using search::WeightedSetStringExtAttribute; using search::attribute::WeightedEnumContent; -typedef AttributeVector::SP AttributePtr; - -typedef search::attribute::Config AVC; -typedef search::attribute::BasicType AVBT; -typedef search::attribute::CollectionType AVCT; +using AttributePtr = AttributeVector::SP; +using AVC = search::attribute::Config; +using AVBT = search::attribute::BasicType; +using AVCT = search::attribute::CollectionType; +using CollectionType = FieldInfo::CollectionType; const double EPS = 10e-6; diff --git a/searchlib/src/tests/features/prod_features.h b/searchlib/src/tests/features/prod_features.h index 510f8cae230..5722a61a1f5 100644 --- a/searchlib/src/tests/features/prod_features.h +++ b/searchlib/src/tests/features/prod_features.h @@ -9,7 +9,7 @@ class Test : public FtTestApp { public: - int Main(); + int Main() override; void testFramework(); void testFtLib(); void testAge(); diff --git a/searchlib/src/tests/features/prod_features_attributematch.cpp b/searchlib/src/tests/features/prod_features_attributematch.cpp index 7ccfd1dea1a..724b8171b4e 100644 --- a/searchlib/src/tests/features/prod_features_attributematch.cpp +++ b/searchlib/src/tests/features/prod_features_attributematch.cpp @@ -13,13 +13,12 @@ using namespace search::fef::test; using search::AttributeVector; using search::AttributeFactory; +using AttributePtr = AttributeVector::SP; -typedef AttributeVector::SP AttributePtr; - -typedef search::attribute::Config AVC; -typedef search::attribute::BasicType AVBT; -typedef search::attribute::CollectionType AVCT; - +using AVC = search::attribute::Config; +using AVBT = search::attribute::BasicType; +using AVCT = search::attribute::CollectionType; +using CollectionType = FieldInfo::CollectionType; void Test::testAttributeMatch() diff --git a/searchlib/src/tests/features/prod_features_fieldmatch.cpp b/searchlib/src/tests/features/prod_features_fieldmatch.cpp index e9bafdb1c78..f2fc7016751 100644 --- a/searchlib/src/tests/features/prod_features_fieldmatch.cpp +++ b/searchlib/src/tests/features/prod_features_fieldmatch.cpp @@ -12,8 +12,8 @@ LOG_SETUP(".prod_features_fieldmatch"); using namespace search::features; using namespace search::fef; using namespace search::fef::test; - using search::AttributeVector; +using CollectionType = FieldInfo::CollectionType; void Test::testFieldMatch() diff --git a/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp b/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp index 04caadd2029..886feffefc4 100644 --- a/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp +++ b/searchlib/src/tests/features/prod_features_fieldtermmatch.cpp @@ -9,6 +9,7 @@ LOG_SETUP(".prod_features_fieldtermmatch"); using namespace search::features; using namespace search::fef; using namespace search::fef::test; +using CollectionType = FieldInfo::CollectionType; void Test::testFieldTermMatch() diff --git a/searchlib/src/tests/features/prod_features_framework.cpp b/searchlib/src/tests/features/prod_features_framework.cpp index 30a48ce61f4..19a048063c3 100644 --- a/searchlib/src/tests/features/prod_features_framework.cpp +++ b/searchlib/src/tests/features/prod_features_framework.cpp @@ -9,6 +9,7 @@ LOG_SETUP(".prod_features_framework"); using namespace search::features; using namespace search::fef; using namespace search::fef::test; +using CollectionType = FieldInfo::CollectionType; void Test::testFramework() diff --git a/searchlib/src/tests/features/raw_score/raw_score_test.cpp b/searchlib/src/tests/features/raw_score/raw_score_test.cpp index b98c60b7c50..1588e4dbe9f 100644 --- a/searchlib/src/tests/features/raw_score/raw_score_test.cpp +++ b/searchlib/src/tests/features/raw_score/raw_score_test.cpp @@ -13,6 +13,7 @@ using search::feature_t; using namespace search::fef; using namespace search::fef::test; using namespace search::features; +using CollectionType = FieldInfo::CollectionType; const std::string featureName("rawScore(foo)"); @@ -35,7 +36,7 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) { + virtual void visitDumpFeature(const vespalib::string &) override { TEST_ERROR("no features should be dumped"); } FeatureDumpFixture() : IDumpFeatureVisitor() {} diff --git a/searchlib/src/tests/features/subqueries/subqueries_test.cpp b/searchlib/src/tests/features/subqueries/subqueries_test.cpp index 4ed3b833853..71b9e8fc8db 100644 --- a/searchlib/src/tests/features/subqueries/subqueries_test.cpp +++ b/searchlib/src/tests/features/subqueries/subqueries_test.cpp @@ -13,6 +13,7 @@ using search::feature_t; using namespace search::fef; using namespace search::fef::test; using namespace search::features; +using CollectionType = FieldInfo::CollectionType; struct BlueprintFactoryFixture { BlueprintFactory factory; @@ -33,7 +34,7 @@ struct IndexFixture { }; struct FeatureDumpFixture : public IDumpFeatureVisitor { - virtual void visitDumpFeature(const vespalib::string &) { + virtual void visitDumpFeature(const vespalib::string &) override { TEST_ERROR("no features should be dumped"); } FeatureDumpFixture() : IDumpFeatureVisitor() {} diff --git a/searchlib/src/tests/features/tensor/tensor_test.cpp b/searchlib/src/tests/features/tensor/tensor_test.cpp index a2477b1cc8e..8e6ddef3842 100644 --- a/searchlib/src/tests/features/tensor/tensor_test.cpp +++ b/searchlib/src/tests/features/tensor/tensor_test.cpp @@ -37,11 +37,12 @@ using vespalib::tensor::TensorCells; using vespalib::tensor::TensorDimensions; using vespalib::tensor::TensorFactory; -typedef search::attribute::Config AVC; -typedef search::attribute::BasicType AVBT; -typedef search::attribute::CollectionType AVCT; -typedef search::AttributeVector::SP AttributePtr; -typedef FtTestApp FTA; +using AVC = search::attribute::Config; +using AVBT = search::attribute::BasicType; +using AVCT = search::attribute::CollectionType; +using AttributePtr = search::AttributeVector::SP; +using FTA = FtTestApp; +using CollectionType = FieldInfo::CollectionType; namespace { diff --git a/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp b/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp index 6a6b9d0a48e..a3e5808bffb 100644 --- a/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp +++ b/searchlib/src/tests/features/text_similarity_feature/text_similarity_feature_test.cpp @@ -13,6 +13,7 @@ using namespace search::fef; using namespace search::fef::test; using namespace search::features; +using CollectionType = FieldInfo::CollectionType; std::vector<vespalib::string> featureNamesFoo() { std::vector<vespalib::string> f; @@ -58,7 +59,7 @@ struct IndexFixture { struct FeatureDumpFixture : public IDumpFeatureVisitor { std::vector<vespalib::string> expect; size_t dumped; - virtual void visitDumpFeature(const vespalib::string &name) { + virtual void visitDumpFeature(const vespalib::string &name) override { EXPECT_LESS(dumped, expect.size()); EXPECT_EQUAL(expect[dumped++], name); } diff --git a/searchlib/src/tests/fef/attributecontent/attributecontent_test.cpp b/searchlib/src/tests/fef/attributecontent/attributecontent_test.cpp index 66430994016..70708536345 100644 --- a/searchlib/src/tests/fef/attributecontent/attributecontent_test.cpp +++ b/searchlib/src/tests/fef/attributecontent/attributecontent_test.cpp @@ -20,7 +20,7 @@ private: void testFill(); public: - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/fef/featurenameparser/featurenameparser_test.cpp b/searchlib/src/tests/fef/featurenameparser/featurenameparser_test.cpp index bc04d1533f7..ef7d00f7cd8 100644 --- a/searchlib/src/tests/fef/featurenameparser/featurenameparser_test.cpp +++ b/searchlib/src/tests/fef/featurenameparser/featurenameparser_test.cpp @@ -38,7 +38,7 @@ public: const vespalib::string &base, ParamList pl, const vespalib::string &output); void testFile(const vespalib::string &name); - int Main(); + int Main() override; }; bool diff --git a/searchlib/src/tests/fef/fef_test.cpp b/searchlib/src/tests/fef/fef_test.cpp index dac63ac1b83..2a3626ee834 100644 --- a/searchlib/src/tests/fef/fef_test.cpp +++ b/searchlib/src/tests/fef/fef_test.cpp @@ -16,7 +16,7 @@ public: void testLayout(); void testObjectStore(); void testTermFieldMatchDataAppend(); - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/fef/parameter/parameter_test.cpp b/searchlib/src/tests/fef/parameter/parameter_test.cpp index 4d6741937d5..6efc5107f1e 100644 --- a/searchlib/src/tests/fef/parameter/parameter_test.cpp +++ b/searchlib/src/tests/fef/parameter/parameter_test.cpp @@ -9,6 +9,7 @@ LOG_SETUP("parameter_test"); #include <vespa/searchlib/fef/test/indexenvironmentbuilder.h> using namespace search::fef::test; +using CollectionType = search::fef::FieldInfo::CollectionType; namespace search { namespace fef { @@ -40,7 +41,7 @@ private: void testParameters(); public: - int Main(); + int Main() override; }; bool diff --git a/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp b/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp index fb56230d018..7d868f96f2a 100644 --- a/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp +++ b/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp @@ -25,7 +25,7 @@ private: public: Benchmark() : _timer(), _sample(0) {} - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/fef/phrasesplitter/phrasesplitter_test.cpp b/searchlib/src/tests/fef/phrasesplitter/phrasesplitter_test.cpp index ce30f4bdb10..d8721a5d682 100644 --- a/searchlib/src/tests/fef/phrasesplitter/phrasesplitter_test.cpp +++ b/searchlib/src/tests/fef/phrasesplitter/phrasesplitter_test.cpp @@ -21,7 +21,7 @@ private: void testSplitterUpdate(); public: - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/fef/properties/properties_test.cpp b/searchlib/src/tests/fef/properties/properties_test.cpp index 7f5594ea821..b63cf82a54e 100644 --- a/searchlib/src/tests/fef/properties/properties_test.cpp +++ b/searchlib/src/tests/fef/properties/properties_test.cpp @@ -13,7 +13,7 @@ struct CopyVisitor : public IPropertiesVisitor Properties &dst; CopyVisitor(Properties &p) : dst(p) {} virtual void visitProperty(const Property::Value &key, - const Property &values) + const Property &values) override { for (uint32_t i = 0; i < values.size(); ++i) { dst.add(key, values.getAt(i)); diff --git a/searchlib/src/tests/fef/resolver/resolver_test.cpp b/searchlib/src/tests/fef/resolver/resolver_test.cpp index e83d02d2577..e7805f123ef 100644 --- a/searchlib/src/tests/fef/resolver/resolver_test.cpp +++ b/searchlib/src/tests/fef/resolver/resolver_test.cpp @@ -14,10 +14,10 @@ class BaseBlueprint : public Blueprint { public: BaseBlueprint() : Blueprint("base") { } virtual void visitDumpFeatures(const IIndexEnvironment &, - IDumpFeatureVisitor &) const {} - virtual Blueprint::UP createInstance() const { return Blueprint::UP(new BaseBlueprint()); } + IDumpFeatureVisitor &) const override {} + virtual Blueprint::UP createInstance() const override { return Blueprint::UP(new BaseBlueprint()); } virtual bool setup(const IIndexEnvironment & indexEnv, - const ParameterList & params) { + const ParameterList & params) override { (void) indexEnv; (void) params; describeOutput("foo", "foo"); describeOutput("bar", "bar"); @@ -37,10 +37,10 @@ class CombineBlueprint : public Blueprint { public: CombineBlueprint() : Blueprint("combine") { } virtual void visitDumpFeatures(const IIndexEnvironment &, - IDumpFeatureVisitor &) const {} - virtual Blueprint::UP createInstance() const { return Blueprint::UP(new CombineBlueprint()); } + IDumpFeatureVisitor &) const override {} + virtual Blueprint::UP createInstance() const override { return Blueprint::UP(new CombineBlueprint()); } virtual bool setup(const IIndexEnvironment & indexEnv, - const ParameterList & params) { + const ParameterList & params) override { (void) indexEnv; (void) params; defineInput("base.foo"); defineInput("base.bar"); @@ -59,7 +59,7 @@ private: void requireThatWeGetUniqueBlueprints(); public: Test(); - int Main(); + int Main() override; }; Test::Test() : diff --git a/searchlib/src/tests/fef/table/table_test.cpp b/searchlib/src/tests/fef/table/table_test.cpp index 7df91c6ee5d..a049df231cc 100644 --- a/searchlib/src/tests/fef/table/table_test.cpp +++ b/searchlib/src/tests/fef/table/table_test.cpp @@ -29,7 +29,7 @@ private: const std::string _tables2Dir; public: TableTest(); - int Main(); + int Main() override; }; TableTest::TableTest() : diff --git a/searchlib/src/tests/fef/termmatchdatamerger/termmatchdatamerger_test.cpp b/searchlib/src/tests/fef/termmatchdatamerger/termmatchdatamerger_test.cpp index 14b74498f2d..2ce802ea8a2 100644 --- a/searchlib/src/tests/fef/termmatchdatamerger/termmatchdatamerger_test.cpp +++ b/searchlib/src/tests/fef/termmatchdatamerger/termmatchdatamerger_test.cpp @@ -30,7 +30,7 @@ public: void testMergeMultifield(); void testMergeDuplicates(); void testMergeFieldLength(); - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/fileheadertk/fileheadertk_test.cpp b/searchlib/src/tests/fileheadertk/fileheadertk_test.cpp index 14c5d0ed6f6..eb0bd9e32b6 100644 --- a/searchlib/src/tests/fileheadertk/fileheadertk_test.cpp +++ b/searchlib/src/tests/fileheadertk/fileheadertk_test.cpp @@ -13,7 +13,7 @@ private: void testVersionTags(); public: - int Main() { + int Main() override { TEST_INIT("fileheadertk_test"); testVersionTags(); TEST_FLUSH(); diff --git a/searchlib/src/tests/grouping/grouping_test.cpp b/searchlib/src/tests/grouping/grouping_test.cpp index fec91a62d17..034f14c92d1 100644 --- a/searchlib/src/tests/grouping/grouping_test.cpp +++ b/searchlib/src/tests/grouping/grouping_test.cpp @@ -161,7 +161,7 @@ public: void testFixedWidthBuckets(); void testThatNanIsConverted(); void testNanSorting(); - int Main(); + int Main() override; private: void testAggregationSimpleSum(AggregationContext & ctx, const AggregationResult & aggr, const ResultNode & ir, const ResultNode & fr, const ResultNode & sr); class CheckAttributeReferences : public vespalib::ObjectOperation, public vespalib::ObjectPredicate @@ -170,12 +170,12 @@ private: CheckAttributeReferences() : _numrefs(0) { } int _numrefs; private: - virtual void execute(vespalib::Identifiable &obj) { + virtual void execute(vespalib::Identifiable &obj) override { if (static_cast<AttributeNode &>(obj).getAttribute() != NULL) { _numrefs++; } } - virtual bool check(const vespalib::Identifiable &obj) const { return obj.inherits(AttributeNode::classId); } + virtual bool check(const vespalib::Identifiable &obj) const override { return obj.inherits(AttributeNode::classId); } }; }; diff --git a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp index 24eda69ea84..e937dbad017 100644 --- a/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp +++ b/searchlib/src/tests/groupingengine/groupingengine_benchmark.cpp @@ -145,14 +145,14 @@ private: CheckAttributeReferences() : _numrefs(0) { } int _numrefs; private: - virtual void execute(vespalib::Identifiable &obj) { + virtual void execute(vespalib::Identifiable &obj) override { if (static_cast<AttributeNode &>(obj).getAttribute() != NULL) { _numrefs++; } } - virtual bool check(const vespalib::Identifiable &obj) const { return obj.inherits(AttributeNode::classId); } + virtual bool check(const vespalib::Identifiable &obj) const override { return obj.inherits(AttributeNode::classId); } }; - int Main(); + int Main() override; }; //----------------------------------------------------------------------------- diff --git a/searchlib/src/tests/groupingengine/groupingengine_test.cpp b/searchlib/src/tests/groupingengine/groupingengine_test.cpp index d3f1df8c501..48ad5f0c6d8 100644 --- a/searchlib/src/tests/groupingengine/groupingengine_test.cpp +++ b/searchlib/src/tests/groupingengine/groupingengine_test.cpp @@ -164,7 +164,7 @@ public: void testThatNanIsConverted(); void testNanSorting(); void testGroupingEngineFromRequest(); - int Main(); + int Main() override; private: bool verifyEqual(const Group & a, const Group & b); void testAggregationSimpleSum(AggregationContext & ctx, const AggregationResult & aggr, const ResultNode & ir, const ResultNode & fr, const ResultNode & sr); @@ -174,12 +174,12 @@ private: CheckAttributeReferences() : _numrefs(0) { } int _numrefs; private: - virtual void execute(vespalib::Identifiable &obj) { + virtual void execute(vespalib::Identifiable &obj) override { if (static_cast<AttributeNode &>(obj).getAttribute() != NULL) { _numrefs++; } } - virtual bool check(const vespalib::Identifiable &obj) const { return obj.inherits(AttributeNode::classId); } + virtual bool check(const vespalib::Identifiable &obj) const override { return obj.inherits(AttributeNode::classId); } }; }; diff --git a/searchlib/src/tests/hitcollector/hitcollector_test.cpp b/searchlib/src/tests/hitcollector/hitcollector_test.cpp index edb2ecdcaaa..1a5f230a0c1 100644 --- a/searchlib/src/tests/hitcollector/hitcollector_test.cpp +++ b/searchlib/src/tests/hitcollector/hitcollector_test.cpp @@ -21,7 +21,7 @@ struct BasicScorer : public HitCollector::DocumentScorer { feature_t _scoreDelta; BasicScorer(feature_t scoreDelta) : _scoreDelta(scoreDelta) {} - virtual feature_t score(uint32_t docId) { + virtual feature_t score(uint32_t docId) override { return docId + _scoreDelta; } }; @@ -30,7 +30,7 @@ struct PredefinedScorer : public HitCollector::DocumentScorer { ScoreMap _scores; PredefinedScorer(const ScoreMap &scores) : _scores(scores) {} - virtual feature_t score(uint32_t docId) { + virtual feature_t score(uint32_t docId) override { feature_t retval = 0.0; auto itr = _scores.find(docId); if (itr != _scores.end()) { @@ -167,14 +167,14 @@ struct Fixture { struct AscendingScoreFixture : Fixture { AscendingScoreFixture() : Fixture() {} - virtual HitRank calculateScore(uint32_t i) { + virtual HitRank calculateScore(uint32_t i) override { return i + 100; } }; struct DescendingScoreFixture : Fixture { DescendingScoreFixture() : Fixture() {} - virtual HitRank calculateScore(uint32_t i) { + virtual HitRank calculateScore(uint32_t i) override { return 100 - i; } }; diff --git a/searchlib/src/tests/index/docbuilder/docbuilder_test.cpp b/searchlib/src/tests/index/docbuilder/docbuilder_test.cpp index 446e782f092..63b1b78339e 100644 --- a/searchlib/src/tests/index/docbuilder/docbuilder_test.cpp +++ b/searchlib/src/tests/index/docbuilder/docbuilder_test.cpp @@ -21,6 +21,7 @@ LOG_SETUP("docbuilder_test"); #include <iostream> using namespace document; +using search::index::schema::CollectionType; namespace search { namespace index { @@ -39,45 +40,45 @@ class Test : public vespalib::TestApp { private: void testBuilder(); public: - int Main(); + int Main() override; }; void Test::testBuilder() { Schema s; - s.addIndexField(Schema::IndexField("ia", schema::STRING)); - s.addIndexField(Schema::IndexField("ib", schema::STRING, schema::ARRAY)); - s.addIndexField(Schema::IndexField("ic", schema::STRING, schema::WEIGHTEDSET)); - s.addUriIndexFields(Schema::IndexField("iu", schema::STRING)); - s.addUriIndexFields(Schema::IndexField("iau", schema::STRING, schema::ARRAY)); - s.addUriIndexFields(Schema::IndexField("iwu", schema::STRING, schema::WEIGHTEDSET)); - s.addAttributeField(Schema::AttributeField("aa", schema::INT32)); - s.addAttributeField(Schema::AttributeField("ab", schema::FLOAT)); - s.addAttributeField(Schema::AttributeField("ac", schema::STRING)); - s.addAttributeField(Schema::AttributeField("ad", schema::INT32, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("ae", schema::FLOAT, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("af", schema::STRING, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("ag", schema::INT32, schema::WEIGHTEDSET)); - s.addAttributeField(Schema::AttributeField("ah", schema::FLOAT, schema::WEIGHTEDSET)); - s.addAttributeField(Schema::AttributeField("ai", schema::STRING, schema::WEIGHTEDSET)); - s.addAttributeField(Schema::AttributeField("asp1", schema::INT32)); - s.addAttributeField(Schema::AttributeField("asp2", schema::INT64)); - s.addAttributeField(Schema::AttributeField("aap1", schema::INT32, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("aap2", schema::INT64, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("awp1", schema::INT32, schema::WEIGHTEDSET)); - s.addAttributeField(Schema::AttributeField("awp2", schema::INT64, schema::WEIGHTEDSET)); + s.addIndexField(Schema::IndexField("ia", schema::DataType::STRING)); + s.addIndexField(Schema::IndexField("ib", schema::DataType::STRING, CollectionType::ARRAY)); + s.addIndexField(Schema::IndexField("ic", schema::DataType::STRING, CollectionType::WEIGHTEDSET)); + s.addUriIndexFields(Schema::IndexField("iu", schema::DataType::STRING)); + s.addUriIndexFields(Schema::IndexField("iau", schema::DataType::STRING, CollectionType::ARRAY)); + s.addUriIndexFields(Schema::IndexField("iwu", schema::DataType::STRING, CollectionType::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("aa", schema::DataType::INT32)); + s.addAttributeField(Schema::AttributeField("ab", schema::DataType::FLOAT)); + s.addAttributeField(Schema::AttributeField("ac", schema::DataType::STRING)); + s.addAttributeField(Schema::AttributeField("ad", schema::DataType::INT32, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("ae", schema::DataType::FLOAT, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("af", schema::DataType::STRING, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("ag", schema::DataType::INT32, CollectionType::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("ah", schema::DataType::FLOAT, CollectionType::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("ai", schema::DataType::STRING, CollectionType::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("asp1", schema::DataType::INT32)); + s.addAttributeField(Schema::AttributeField("asp2", schema::DataType::INT64)); + s.addAttributeField(Schema::AttributeField("aap1", schema::DataType::INT32, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("aap2", schema::DataType::INT64, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("awp1", schema::DataType::INT32, CollectionType::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("awp2", schema::DataType::INT64, CollectionType::WEIGHTEDSET)); - s.addSummaryField(Schema::SummaryField("sa", schema::INT8)); - s.addSummaryField(Schema::SummaryField("sb", schema::INT16)); - s.addSummaryField(Schema::SummaryField("sc", schema::INT32)); - s.addSummaryField(Schema::SummaryField("sd", schema::INT64)); - s.addSummaryField(Schema::SummaryField("se", schema::FLOAT)); - s.addSummaryField(Schema::SummaryField("sf", schema::DOUBLE)); - s.addSummaryField(Schema::SummaryField("sg", schema::STRING)); - s.addSummaryField(Schema::SummaryField("sh", schema::RAW)); - s.addSummaryField(Schema::SummaryField("si", schema::RAW, schema::ARRAY)); - s.addSummaryField(Schema::SummaryField("sj", schema::RAW, schema::WEIGHTEDSET)); + s.addSummaryField(Schema::SummaryField("sa", schema::DataType::INT8)); + s.addSummaryField(Schema::SummaryField("sb", schema::DataType::INT16)); + s.addSummaryField(Schema::SummaryField("sc", schema::DataType::INT32)); + s.addSummaryField(Schema::SummaryField("sd", schema::DataType::INT64)); + s.addSummaryField(Schema::SummaryField("se", schema::DataType::FLOAT)); + s.addSummaryField(Schema::SummaryField("sf", schema::DataType::DOUBLE)); + s.addSummaryField(Schema::SummaryField("sg", schema::DataType::STRING)); + s.addSummaryField(Schema::SummaryField("sh", schema::DataType::RAW)); + s.addSummaryField(Schema::SummaryField("si", schema::DataType::RAW, CollectionType::ARRAY)); + s.addSummaryField(Schema::SummaryField("sj", schema::DataType::RAW, CollectionType::WEIGHTEDSET)); DocBuilder b(s); Document::UP doc; diff --git a/searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp b/searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp index 9f04563ad8b..8dd4afbc8d7 100644 --- a/searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp +++ b/searchlib/src/tests/index/doctypebuilder/doctypebuilder_test.cpp @@ -9,19 +9,22 @@ using namespace document; namespace search { namespace index { +using schema::CollectionType; +using schema::DataType; + TEST("testSearchDocType") { Schema s; - s.addIndexField(Schema::IndexField("ia", schema::STRING)); - s.addIndexField(Schema::IndexField("ib", schema::STRING, schema::ARRAY)); - s.addIndexField(Schema::IndexField("ic", schema::STRING, schema::WEIGHTEDSET)); - s.addUriIndexFields(Schema::IndexField("iu", schema::STRING)); - s.addUriIndexFields(Schema::IndexField("iau", schema::STRING, schema::ARRAY)); - s.addUriIndexFields(Schema::IndexField("iwu", schema::STRING, schema::WEIGHTEDSET)); - s.addAttributeField(Schema::AttributeField("aa", schema::INT32)); - s.addAttributeField(Schema::AttributeField("spos", schema::INT64)); - s.addAttributeField(Schema::AttributeField("apos", schema::INT64, schema::ARRAY)); - s.addAttributeField(Schema::AttributeField("wpos", schema::INT64, schema::WEIGHTEDSET)); - s.addSummaryField(Schema::SummaryField("sa", schema::STRING)); + s.addIndexField(Schema::IndexField("ia", DataType::STRING)); + s.addIndexField(Schema::IndexField("ib", DataType::STRING, CollectionType::ARRAY)); + s.addIndexField(Schema::IndexField("ic", DataType::STRING, CollectionType::WEIGHTEDSET)); + s.addUriIndexFields(Schema::IndexField("iu", DataType::STRING)); + s.addUriIndexFields(Schema::IndexField("iau", DataType::STRING, CollectionType::ARRAY)); + s.addUriIndexFields(Schema::IndexField("iwu", DataType::STRING, CollectionType::WEIGHTEDSET)); + s.addAttributeField(Schema::AttributeField("aa", DataType::INT32)); + s.addAttributeField(Schema::AttributeField("spos", DataType::INT64)); + s.addAttributeField(Schema::AttributeField("apos", DataType::INT64, CollectionType::ARRAY)); + s.addAttributeField(Schema::AttributeField("wpos", DataType::INT64, CollectionType::WEIGHTEDSET)); + s.addSummaryField(Schema::SummaryField("sa", DataType::STRING)); DocTypeBuilder docTypeBuilder(s); document::DocumenttypesConfig config = docTypeBuilder.makeConfig(); @@ -52,8 +55,8 @@ TEST("testSearchDocType") { TEST("require that multiple fields can have the same type") { Schema s; - s.addIndexField(Schema::IndexField("array1", schema::STRING, schema::ARRAY)); - s.addIndexField(Schema::IndexField("array2", schema::STRING, schema::ARRAY)); + s.addIndexField(Schema::IndexField("array1", DataType::STRING, CollectionType::ARRAY)); + s.addIndexField(Schema::IndexField("array2", DataType::STRING, CollectionType::ARRAY)); DocTypeBuilder docTypeBuilder(s); document::DocumenttypesConfig config = docTypeBuilder.makeConfig(); DocumentTypeRepo repo(config); diff --git a/searchlib/src/tests/memoryindex/btree/btree_test.cpp b/searchlib/src/tests/memoryindex/btree/btree_test.cpp index af580d8251e..b3f49a68424 100644 --- a/searchlib/src/tests/memoryindex/btree/btree_test.cpp +++ b/searchlib/src/tests/memoryindex/btree/btree_test.cpp @@ -178,7 +178,7 @@ private: void requireThatIteratorDistanceWorks(); public: - int Main(); + int Main() override; }; template <typename LeafNodeType> diff --git a/searchlib/src/tests/memoryindex/btree/frozenbtree_test.cpp b/searchlib/src/tests/memoryindex/btree/frozenbtree_test.cpp index 817d024c60f..93b78bd1b10 100644 --- a/searchlib/src/tests/memoryindex/btree/frozenbtree_test.cpp +++ b/searchlib/src/tests/memoryindex/btree/frozenbtree_test.cpp @@ -123,7 +123,7 @@ public: { } - int Main(void); + int Main(void) override; }; diff --git a/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp b/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp index c13aeaa1053..9c119b71876 100644 --- a/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp +++ b/searchlib/src/tests/memoryindex/datastore/featurestore_test.cpp @@ -9,6 +9,9 @@ using namespace search::btree; using namespace search::datastore; using namespace search::index; +using search::index::schema::CollectionType; +using search::index::schema::DataType; + namespace search { @@ -44,7 +47,7 @@ public: Test(void); int - Main(void); + Main(void) override; }; @@ -217,8 +220,8 @@ Test::requireThatAddFeaturesTriggersChangeOfBuffer(void) Test::Test() : _schema() { - _schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - _schema.addIndexField(Schema::IndexField("f1", schema::STRING, schema::WEIGHTEDSET)); + _schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f1", DataType::STRING, CollectionType::WEIGHTEDSET)); } diff --git a/searchlib/src/tests/memoryindex/datastore/wordstore_test.cpp b/searchlib/src/tests/memoryindex/datastore/wordstore_test.cpp index fcf96d5afe9..dfe1438bcb5 100644 --- a/searchlib/src/tests/memoryindex/datastore/wordstore_test.cpp +++ b/searchlib/src/tests/memoryindex/datastore/wordstore_test.cpp @@ -15,7 +15,7 @@ private: void requireThatWordsCanBeAddedAndRetrieved(); void requireThatAddWordTriggersChangeOfBuffer(); public: - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp index 4ef2e4e3617..048851f5d94 100644 --- a/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp +++ b/searchlib/src/tests/memoryindex/dictionary/dictionary_test.cpp @@ -27,10 +27,13 @@ using namespace btree; using namespace datastore; using namespace fef; using namespace index; -using queryeval::SearchIterator; + using document::Document; -using vespalib::GenerationHandler; +using queryeval::SearchIterator; +using search::index::schema::CollectionType; +using search::index::schema::DataType; using test::SearchIteratorVerifier; +using vespalib::GenerationHandler; namespace memoryindex { @@ -66,7 +69,7 @@ public: {} virtual void - startWord(const vespalib::stringref &word) + startWord(const vespalib::stringref &word) override { assert(_insideField); assert(!_insideWord); @@ -78,7 +81,7 @@ public: } virtual void - endWord(void) + endWord(void) override { assert(_insideWord); assert(!_insideDoc); @@ -88,7 +91,7 @@ public: } virtual void - startField(uint32_t fieldId) + startField(uint32_t fieldId) override { assert(!_insideField); if (!_firstField) _ss << ","; @@ -98,7 +101,7 @@ public: } virtual void - endField() + endField() override { assert(_insideField); assert(!_insideWord); @@ -108,7 +111,7 @@ public: } virtual void - startDocument(uint32_t docId) + startDocument(uint32_t docId) override { assert(_insideWord); assert(!_insideDoc); @@ -119,7 +122,7 @@ public: } virtual void - endDocument(void) + endDocument(void) override { assert(_insideDoc); assert(!_insideElem); @@ -131,7 +134,7 @@ public: virtual void startElement(uint32_t elementId, int32_t weight, - uint32_t elementLen) + uint32_t elementLen) override { assert(_insideDoc); assert(!_insideElem); @@ -144,7 +147,7 @@ public: } virtual void - endElement(void) + endElement(void) override { assert(_insideElem); _ss << "]"; @@ -153,7 +156,7 @@ public: } virtual void - addOcc(const WordDocElementWordPosFeatures &features) + addOcc(const WordDocElementWordPosFeatures &features) override { assert(_insideElem); if (!_firstPos) _ss << ","; @@ -577,10 +580,10 @@ struct Fixture { Schema _schema; Fixture() : _schema() { - _schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - _schema.addIndexField(Schema::IndexField("f1", schema::STRING)); - _schema.addIndexField(Schema::IndexField("f2", schema::STRING, schema::ARRAY)); - _schema.addIndexField(Schema::IndexField("f3", schema::STRING, schema::WEIGHTEDSET)); + _schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f2", DataType::STRING, CollectionType::ARRAY)); + _schema.addIndexField(Schema::IndexField("f3", DataType::STRING, CollectionType::WEIGHTEDSET)); } const Schema & getSchema() const { return _schema; } }; @@ -1160,9 +1163,9 @@ public: UriFixture() : _schema() { - _schema.addUriIndexFields(Schema::IndexField("iu", schema::STRING)); - _schema.addUriIndexFields(Schema::IndexField("iau", schema::STRING, schema::ARRAY)); - _schema.addUriIndexFields(Schema::IndexField("iwu", schema::STRING, schema::WEIGHTEDSET)); + _schema.addUriIndexFields(Schema::IndexField("iu", DataType::STRING)); + _schema.addUriIndexFields(Schema::IndexField("iau", DataType::STRING, CollectionType::ARRAY)); + _schema.addUriIndexFields(Schema::IndexField("iwu", DataType::STRING, CollectionType::WEIGHTEDSET)); } const Schema & getSchema() const { return _schema; } }; @@ -1368,7 +1371,7 @@ public: SingleFieldFixture() : _schema() { - _schema.addIndexField(Schema::IndexField("i", schema::STRING)); + _schema.addIndexField(Schema::IndexField("i", DataType::STRING)); } const Schema & getSchema() const { return _schema; } }; diff --git a/searchlib/src/tests/memoryindex/documentinverter/documentinverter_test.cpp b/searchlib/src/tests/memoryindex/documentinverter/documentinverter_test.cpp index d69780b9516..89098848cc5 100644 --- a/searchlib/src/tests/memoryindex/documentinverter/documentinverter_test.cpp +++ b/searchlib/src/tests/memoryindex/documentinverter/documentinverter_test.cpp @@ -13,10 +13,12 @@ namespace search { - using document::Document; using index::DocBuilder; using index::Schema; +using index::schema::CollectionType; +using index::schema::DataType; + using namespace index; namespace memoryindex { @@ -103,10 +105,10 @@ struct Fixture makeSchema() { Schema schema; - schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - schema.addIndexField(Schema::IndexField("f1", schema::STRING)); - schema.addIndexField(Schema::IndexField("f2", schema::STRING, schema::ARRAY)); - schema.addIndexField(Schema::IndexField("f3", schema::STRING, schema::WEIGHTEDSET)); + schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f2", DataType::STRING, CollectionType::ARRAY)); + schema.addIndexField(Schema::IndexField("f3", DataType::STRING, CollectionType::WEIGHTEDSET)); return schema; } diff --git a/searchlib/src/tests/memoryindex/fieldinverter/fieldinverter_test.cpp b/searchlib/src/tests/memoryindex/fieldinverter/fieldinverter_test.cpp index eb86015bb27..df292ec2b1d 100644 --- a/searchlib/src/tests/memoryindex/fieldinverter/fieldinverter_test.cpp +++ b/searchlib/src/tests/memoryindex/fieldinverter/fieldinverter_test.cpp @@ -10,10 +10,12 @@ namespace search { - using document::Document; using index::DocBuilder; using index::Schema; +using index::schema::CollectionType; +using index::schema::DataType; + using namespace index; namespace memoryindex { @@ -111,10 +113,10 @@ struct Fixture makeSchema() { Schema schema; - schema.addIndexField(Schema::IndexField("f0", schema::STRING)); - schema.addIndexField(Schema::IndexField("f1", schema::STRING)); - schema.addIndexField(Schema::IndexField("f2", schema::STRING, schema::ARRAY)); - schema.addIndexField(Schema::IndexField("f3", schema::STRING, schema::WEIGHTEDSET)); + schema.addIndexField(Schema::IndexField("f0", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + schema.addIndexField(Schema::IndexField("f2", DataType::STRING, CollectionType::ARRAY)); + schema.addIndexField(Schema::IndexField("f3", DataType::STRING, CollectionType::WEIGHTEDSET)); return schema; } diff --git a/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp b/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp index a1302d7de78..9ed5ff16c9e 100644 --- a/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp +++ b/searchlib/src/tests/memoryindex/memoryindex/memoryindex_test.cpp @@ -22,11 +22,12 @@ LOG_SETUP("memoryindex_test"); using document::Document; using document::FieldValue; +using search::ScheduleTaskCallback; +using search::index::schema::DataType; +using search::makeLambdaTask; using search::query::Node; using search::query::SimplePhrase; using search::query::SimpleStringTerm; -using search::makeLambdaTask; -using search::ScheduleTaskCallback; using namespace search::fef; using namespace search::index; using namespace search::memoryindex; @@ -37,7 +38,7 @@ using namespace search::queryeval; struct Setup { Schema schema; Setup &field(const std::string &name) { - schema.addIndexField(Schema::IndexField(name, schema::STRING)); + schema.addIndexField(Schema::IndexField(name, DataType::STRING)); return *this; } }; diff --git a/searchlib/src/tests/memoryindex/urlfieldinverter/urlfieldinverter_test.cpp b/searchlib/src/tests/memoryindex/urlfieldinverter/urlfieldinverter_test.cpp index 9e6f401cd4c..c50ebc056c8 100644 --- a/searchlib/src/tests/memoryindex/urlfieldinverter/urlfieldinverter_test.cpp +++ b/searchlib/src/tests/memoryindex/urlfieldinverter/urlfieldinverter_test.cpp @@ -14,6 +14,9 @@ namespace search { using document::Document; +using index::schema::CollectionType; +using index::schema::DataType; + using namespace index; @@ -189,7 +192,7 @@ struct Fixture makeSchema(Schema::CollectionType collectionType) { Schema schema; - schema.addUriIndexFields(Schema::IndexField("url", index::schema::STRING, collectionType)); + schema.addUriIndexFields(Schema::IndexField("url", DataType::STRING, collectionType)); return schema; } @@ -246,7 +249,7 @@ struct Fixture }; -TEST_F("requireThatSingleUrlFieldWorks", Fixture(schema::SINGLE)) +TEST_F("requireThatSingleUrlFieldWorks", Fixture(CollectionType::SINGLE)) { f.invertDocument(10, *makeDoc10Single(f._b)); f.pushDocuments(); @@ -285,7 +288,7 @@ TEST_F("requireThatSingleUrlFieldWorks", Fixture(schema::SINGLE)) } -TEST_F("requireThatArrayUrlFieldWorks", Fixture(schema::ARRAY)) +TEST_F("requireThatArrayUrlFieldWorks", Fixture(CollectionType::ARRAY)) { f.invertDocument(10, *makeDoc10Array(f._b)); f.pushDocuments(); @@ -328,7 +331,7 @@ TEST_F("requireThatArrayUrlFieldWorks", Fixture(schema::ARRAY)) f._inserter.toStr()); } -TEST_F("requireThatWeightedSetFieldWorks", Fixture(schema::WEIGHTEDSET)) +TEST_F("requireThatWeightedSetFieldWorks", Fixture(CollectionType::WEIGHTEDSET)) { f.invertDocument(10, *makeDoc10WeightedSet(f._b)); f.pushDocuments(); @@ -373,7 +376,7 @@ TEST_F("requireThatWeightedSetFieldWorks", Fixture(schema::WEIGHTEDSET)) f._inserter.toStr()); } -TEST_F("requireThatAnnotatedSingleUrlFieldWorks", Fixture(schema::SINGLE)) +TEST_F("requireThatAnnotatedSingleUrlFieldWorks", Fixture(CollectionType::SINGLE)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Single(f._b)); @@ -414,7 +417,7 @@ TEST_F("requireThatAnnotatedSingleUrlFieldWorks", Fixture(schema::SINGLE)) } -TEST_F("requireThatAnnotatedArrayUrlFieldWorks", Fixture(schema::ARRAY)) +TEST_F("requireThatAnnotatedArrayUrlFieldWorks", Fixture(CollectionType::ARRAY)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Array(f._b)); @@ -460,7 +463,7 @@ TEST_F("requireThatAnnotatedArrayUrlFieldWorks", Fixture(schema::ARRAY)) } TEST_F("requireThatAnnotatedWeightedSetFieldWorks", - Fixture(schema::WEIGHTEDSET)) + Fixture(CollectionType::WEIGHTEDSET)) { f.enableAnnotations(); f._inserter.setVerbose(); @@ -509,14 +512,14 @@ TEST_F("requireThatAnnotatedWeightedSetFieldWorks", } -TEST_F("requireThatEmptySingleFieldWorks", Fixture(schema::SINGLE)) +TEST_F("requireThatEmptySingleFieldWorks", Fixture(CollectionType::SINGLE)) { f.invertDocument(10, *makeDoc10Empty(f._b)); f.pushDocuments(); EXPECT_EQUAL("", f._inserter.toStr()); } -TEST_F("requireThatEmptyArrayFieldWorks", Fixture(schema::ARRAY)) +TEST_F("requireThatEmptyArrayFieldWorks", Fixture(CollectionType::ARRAY)) { f.invertDocument(10, *makeDoc10Empty(f._b)); f.pushDocuments(); @@ -524,14 +527,14 @@ TEST_F("requireThatEmptyArrayFieldWorks", Fixture(schema::ARRAY)) f._inserter.toStr()); } -TEST_F("requireThatEmptyWeightedSetFieldWorks", Fixture(schema::WEIGHTEDSET)) +TEST_F("requireThatEmptyWeightedSetFieldWorks", Fixture(CollectionType::WEIGHTEDSET)) { f.invertDocument(10, *makeDoc10Empty(f._b)); f.pushDocuments(); EXPECT_EQUAL("", f._inserter.toStr()); } -TEST_F("requireThatAnnotatedEmptySingleFieldWorks", Fixture(schema::SINGLE)) +TEST_F("requireThatAnnotatedEmptySingleFieldWorks", Fixture(CollectionType::SINGLE)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Empty(f._b)); @@ -539,7 +542,7 @@ TEST_F("requireThatAnnotatedEmptySingleFieldWorks", Fixture(schema::SINGLE)) EXPECT_EQUAL("", f._inserter.toStr()); } -TEST_F("requireThatAnnotatedEmptyArrayFieldWorks", Fixture(schema::ARRAY)) +TEST_F("requireThatAnnotatedEmptyArrayFieldWorks", Fixture(CollectionType::ARRAY)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Empty(f._b)); @@ -547,7 +550,7 @@ TEST_F("requireThatAnnotatedEmptyArrayFieldWorks", Fixture(schema::ARRAY)) EXPECT_EQUAL("", f._inserter.toStr()); } -TEST_F("requireThatAnnotatedEmptyWeightedSetFieldWorks", Fixture(schema::WEIGHTEDSET)) +TEST_F("requireThatAnnotatedEmptyWeightedSetFieldWorks", Fixture(CollectionType::WEIGHTEDSET)) { f.enableAnnotations(); f.invertDocument(10, *makeDoc10Empty(f._b)); diff --git a/searchlib/src/tests/nativerank/nativerank.cpp b/searchlib/src/tests/nativerank/nativerank.cpp index 398ca52a190..4c03f14e141 100644 --- a/searchlib/src/tests/nativerank/nativerank.cpp +++ b/searchlib/src/tests/nativerank/nativerank.cpp @@ -18,6 +18,7 @@ LOG_SETUP("nativerank_test"); using namespace search::fef; using namespace search::fef::test; +using CollectionType = FieldInfo::CollectionType; const double EPS = 10e-4; @@ -55,7 +56,7 @@ private: void testNativeRank(); public: - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/nearsearch/nearsearch_test.cpp b/searchlib/src/tests/nearsearch/nearsearch_test.cpp index 8a20a6a27f8..90565ab1e1e 100644 --- a/searchlib/src/tests/nearsearch/nearsearch_test.cpp +++ b/searchlib/src/tests/nearsearch/nearsearch_test.cpp @@ -114,7 +114,7 @@ private: bool testNearSearch(MyQuery &query, uint32_t matchId); public: - int Main(); + int Main() override; void testBasicNear(); void testRepeatedTerms(); }; diff --git a/searchlib/src/tests/postinglistbm/andstress.cpp b/searchlib/src/tests/postinglistbm/andstress.cpp index f3fabde0d61..69aa463b46d 100644 --- a/searchlib/src/tests/postinglistbm/andstress.cpp +++ b/searchlib/src/tests/postinglistbm/andstress.cpp @@ -129,7 +129,7 @@ public: ~AndStressWorker(void); virtual void - Run(FastOS_ThreadInterface *thisThread, void *arg); + Run(FastOS_ThreadInterface *thisThread, void *arg) override; }; diff --git a/searchlib/src/tests/postinglistbm/postinglistbm.cpp b/searchlib/src/tests/postinglistbm/postinglistbm.cpp index 14ff86d4db0..ff09a99ba99 100644 --- a/searchlib/src/tests/postinglistbm/postinglistbm.cpp +++ b/searchlib/src/tests/postinglistbm/postinglistbm.cpp @@ -16,7 +16,10 @@ using search::ResultSet; using search::fef::TermFieldMatchData; using search::fef::TermFieldMatchDataArray; +using search::index::schema::CollectionType; +using search::index::schema::DataType; using search::queryeval::SearchIterator; + using namespace search::index; using namespace search::fakedata; @@ -56,7 +59,7 @@ private: public: PostingListBM(void); ~PostingListBM(void); - int Main(void); + int Main(void) override; }; @@ -372,8 +375,8 @@ PostingListBM::Main(void) do { Schema schema; Schema::IndexField indexField("field0", - schema::STRING, - schema::SINGLE); + DataType::STRING, + CollectionType::SINGLE); schema.addIndexField(indexField); std::unique_ptr<FPFactory> ff(getFPFactory(optArg, schema)); if (ff.get() == NULL) { diff --git a/searchlib/src/tests/predicate/predicate_bounds_posting_list_test.cpp b/searchlib/src/tests/predicate/predicate_bounds_posting_list_test.cpp index 0f7802d63b0..26d4050f440 100644 --- a/searchlib/src/tests/predicate/predicate_bounds_posting_list_test.cpp +++ b/searchlib/src/tests/predicate/predicate_bounds_posting_list_test.cpp @@ -15,8 +15,8 @@ using namespace search::predicate; namespace { struct DummyDocIdLimitProvider : public DocIdLimitProvider { - virtual uint32_t getDocIdLimit() const { return 10000; } - virtual uint32_t getCommittedDocIdLimit() const { return 10000; } + virtual uint32_t getDocIdLimit() const override { return 10000; } + virtual uint32_t getCommittedDocIdLimit() const override { return 10000; } }; vespalib::GenerationHandler generation_handler; diff --git a/searchlib/src/tests/predicate/predicate_index_test.cpp b/searchlib/src/tests/predicate/predicate_index_test.cpp index 5a6b6240e65..cf5c1d6bfb5 100644 --- a/searchlib/src/tests/predicate/predicate_index_test.cpp +++ b/searchlib/src/tests/predicate/predicate_index_test.cpp @@ -19,8 +19,8 @@ using std::vector; namespace { struct DummyDocIdLimitProvider : public DocIdLimitProvider { - virtual uint32_t getDocIdLimit() const { return 10000; } - virtual uint32_t getCommittedDocIdLimit() const { return 10000; } + virtual uint32_t getDocIdLimit() const override { return 10000; } + virtual uint32_t getCommittedDocIdLimit() const override { return 10000; } }; vespalib::GenerationHandler generation_handler; @@ -256,7 +256,7 @@ struct DocIdLimitFinder : SimpleIndexDeserializeObserver<> { { doc_id_limit = 0u; } - void notifyInsert(uint64_t, uint32_t doc_id, uint32_t) { + void notifyInsert(uint64_t, uint32_t doc_id, uint32_t) override { _doc_id_limit = std::max(_doc_id_limit, doc_id); } }; diff --git a/searchlib/src/tests/predicate/predicate_interval_posting_list_test.cpp b/searchlib/src/tests/predicate/predicate_interval_posting_list_test.cpp index 18feb30106f..831e24026ec 100644 --- a/searchlib/src/tests/predicate/predicate_interval_posting_list_test.cpp +++ b/searchlib/src/tests/predicate/predicate_interval_posting_list_test.cpp @@ -14,8 +14,8 @@ using namespace search::predicate; namespace { struct DummyDocIdLimitProvider : public DocIdLimitProvider { - virtual uint32_t getDocIdLimit() const { return 10000; } - virtual uint32_t getCommittedDocIdLimit() const { return 10000; } + virtual uint32_t getDocIdLimit() const override { return 10000; } + virtual uint32_t getCommittedDocIdLimit() const override { return 10000; } }; vespalib::GenerationHandler generation_handler; diff --git a/searchlib/src/tests/predicate/predicate_zero_constraint_posting_list_test.cpp b/searchlib/src/tests/predicate/predicate_zero_constraint_posting_list_test.cpp index 1751c725044..90e34c804e7 100644 --- a/searchlib/src/tests/predicate/predicate_zero_constraint_posting_list_test.cpp +++ b/searchlib/src/tests/predicate/predicate_zero_constraint_posting_list_test.cpp @@ -14,8 +14,8 @@ using namespace search::predicate; namespace { struct DummyDocIdLimitProvider : public DocIdLimitProvider { - virtual uint32_t getDocIdLimit() const { return 10000; } - virtual uint32_t getCommittedDocIdLimit() const { return 10000; } + virtual uint32_t getDocIdLimit() const override { return 10000; } + virtual uint32_t getCommittedDocIdLimit() const override { return 10000; } }; vespalib::GenerationHandler generation_handler; diff --git a/searchlib/src/tests/predicate/predicate_zstar_compressed_posting_list_test.cpp b/searchlib/src/tests/predicate/predicate_zstar_compressed_posting_list_test.cpp index 5946bc926d0..dfa75d48019 100644 --- a/searchlib/src/tests/predicate/predicate_zstar_compressed_posting_list_test.cpp +++ b/searchlib/src/tests/predicate/predicate_zstar_compressed_posting_list_test.cpp @@ -16,8 +16,8 @@ using std::vector; namespace { struct DummyDocIdLimitProvider : public DocIdLimitProvider { - virtual uint32_t getDocIdLimit() const { return 10000; } - virtual uint32_t getCommittedDocIdLimit() const { return 10000; } + virtual uint32_t getDocIdLimit() const override { return 10000; } + virtual uint32_t getCommittedDocIdLimit() const override { return 10000; } }; vespalib::GenerationHandler generation_handler; diff --git a/searchlib/src/tests/predicate/simple_index_test.cpp b/searchlib/src/tests/predicate/simple_index_test.cpp index f8a1d3f1366..933f21ebf3c 100644 --- a/searchlib/src/tests/predicate/simple_index_test.cpp +++ b/searchlib/src/tests/predicate/simple_index_test.cpp @@ -24,21 +24,22 @@ struct MyData { }; struct MyDataSerializer : PostingSerializer<MyData> { - void serialize(const MyData &data, vespalib::DataBuffer& buffer) const { + void serialize(const MyData &data, vespalib::DataBuffer& buffer) const override { buffer.writeInt32(data.data); } }; struct MyDataDeserializer : PostingDeserializer<MyData> { - MyData deserialize(vespalib::DataBuffer& buffer) { return {buffer.readInt32()}; + MyData deserialize(vespalib::DataBuffer& buffer) override { + return {buffer.readInt32()}; } }; struct SimpleDocIdLimitProvider : public DocIdLimitProvider { uint32_t _doc_id_limit = 1; uint32_t _committed_doc_id_limit = 1; - virtual uint32_t getDocIdLimit() const { return _doc_id_limit; } - virtual uint32_t getCommittedDocIdLimit() const { return _committed_doc_id_limit; } + virtual uint32_t getDocIdLimit() const override { return _doc_id_limit; } + virtual uint32_t getCommittedDocIdLimit() const override { return _committed_doc_id_limit; } }; constexpr uint64_t key = 0x123456; @@ -153,7 +154,7 @@ TEST_F("require that SimpleIndex can insert and remove many values.", Fixture) { struct MyObserver : SimpleIndexDeserializeObserver<> { std::map<uint32_t, uint64_t> features; - void notifyInsert(uint64_t my_key, uint32_t my_doc_id, uint32_t) { + void notifyInsert(uint64_t my_key, uint32_t my_doc_id, uint32_t) override { features[my_doc_id] = my_key; } bool hasSeenDoc(uint32_t doc) { diff --git a/searchlib/src/tests/query/customtypevisitor_test.cpp b/searchlib/src/tests/query/customtypevisitor_test.cpp index c9da2757d81..75abcc810b2 100644 --- a/searchlib/src/tests/query/customtypevisitor_test.cpp +++ b/searchlib/src/tests/query/customtypevisitor_test.cpp @@ -25,7 +25,7 @@ class Test : public vespalib::TestApp { template <class T> void requireThatNodeIsVisited(); public: - int Main(); + int Main() override; }; template <class Base> @@ -90,27 +90,27 @@ public: template <typename T> void setVisited() { isVisited<T>() = true; } - virtual void visit(MyAnd &) { setVisited<MyAnd>(); } - virtual void visit(MyAndNot &) { setVisited<MyAndNot>(); } - virtual void visit(MyEquiv &) { setVisited<MyEquiv>(); } - virtual void visit(MyNumberTerm &) { setVisited<MyNumberTerm>(); } - virtual void visit(MyLocationTerm &) { setVisited<MyLocationTerm>(); } - virtual void visit(MyNear &) { setVisited<MyNear>(); } - virtual void visit(MyONear &) { setVisited<MyONear>(); } - virtual void visit(MyOr &) { setVisited<MyOr>(); } - virtual void visit(MyPhrase &) { setVisited<MyPhrase>(); } - virtual void visit(MyPrefixTerm &) { setVisited<MyPrefixTerm>(); } - virtual void visit(MyRangeTerm &) { setVisited<MyRangeTerm>(); } - virtual void visit(MyRank &) { setVisited<MyRank>(); } - virtual void visit(MyStringTerm &) { setVisited<MyStringTerm>(); } - virtual void visit(MySubstrTerm &) { setVisited<MySubstrTerm>(); } - virtual void visit(MySuffixTerm &) { setVisited<MySuffixTerm>(); } - virtual void visit(MyWeakAnd &) { setVisited<MyWeakAnd>(); } - virtual void visit(MyWeightedSetTerm &) { setVisited<MyWeightedSetTerm>(); } - virtual void visit(MyDotProduct &) { setVisited<MyDotProduct>(); } - virtual void visit(MyWandTerm &) { setVisited<MyWandTerm>(); } - virtual void visit(MyPredicateQuery &) { setVisited<MyPredicateQuery>(); } - virtual void visit(MyRegExpTerm &) { setVisited<MyRegExpTerm>(); } + virtual void visit(MyAnd &) override { setVisited<MyAnd>(); } + virtual void visit(MyAndNot &) override { setVisited<MyAndNot>(); } + virtual void visit(MyEquiv &) override { setVisited<MyEquiv>(); } + virtual void visit(MyNumberTerm &) override { setVisited<MyNumberTerm>(); } + virtual void visit(MyLocationTerm &) override { setVisited<MyLocationTerm>(); } + virtual void visit(MyNear &) override { setVisited<MyNear>(); } + virtual void visit(MyONear &) override { setVisited<MyONear>(); } + virtual void visit(MyOr &) override { setVisited<MyOr>(); } + virtual void visit(MyPhrase &) override { setVisited<MyPhrase>(); } + virtual void visit(MyPrefixTerm &) override { setVisited<MyPrefixTerm>(); } + virtual void visit(MyRangeTerm &) override { setVisited<MyRangeTerm>(); } + virtual void visit(MyRank &) override { setVisited<MyRank>(); } + virtual void visit(MyStringTerm &) override { setVisited<MyStringTerm>(); } + virtual void visit(MySubstrTerm &) override { setVisited<MySubstrTerm>(); } + virtual void visit(MySuffixTerm &) override { setVisited<MySuffixTerm>(); } + virtual void visit(MyWeakAnd &) override { setVisited<MyWeakAnd>(); } + virtual void visit(MyWeightedSetTerm &) override { setVisited<MyWeightedSetTerm>(); } + virtual void visit(MyDotProduct &) override { setVisited<MyDotProduct>(); } + virtual void visit(MyWandTerm &) override { setVisited<MyWandTerm>(); } + virtual void visit(MyPredicateQuery &) override { setVisited<MyPredicateQuery>(); } + virtual void visit(MyRegExpTerm &) override { setVisited<MyRegExpTerm>(); } }; template <class T> diff --git a/searchlib/src/tests/query/query-old.cpp b/searchlib/src/tests/query/query-old.cpp index db4b7f87895..ddfd19fbd76 100644 --- a/searchlib/src/tests/query/query-old.cpp +++ b/searchlib/src/tests/query/query-old.cpp @@ -222,7 +222,7 @@ TEST("testQueryLanguage") { class AllowRewrite : public QueryNodeResultFactory { public: - virtual bool getRewriteFloatTerms() const { return true; } + virtual bool getRewriteFloatTerms() const override { return true; } }; const char TERM_UNIQ = ParseItem::ITEM_TERM | ParseItem::IF_UNIQUEID; diff --git a/searchlib/src/tests/query/query_visitor_test.cpp b/searchlib/src/tests/query/query_visitor_test.cpp index b98e14604e3..c54b9580ea8 100644 --- a/searchlib/src/tests/query/query_visitor_test.cpp +++ b/searchlib/src/tests/query/query_visitor_test.cpp @@ -22,7 +22,7 @@ class Test : public vespalib::TestApp { template <class T> void checkVisit(T *node); public: - int Main(); + int Main() override; }; int @@ -44,29 +44,29 @@ public: return b; } - virtual void visit(And &) { isVisited<And>() = true; } - virtual void visit(AndNot &) { isVisited<AndNot>() = true; } - virtual void visit(Equiv &) { isVisited<Equiv>() = true; } - virtual void visit(NumberTerm &) { isVisited<NumberTerm>() = true; } - virtual void visit(LocationTerm &) { isVisited<LocationTerm>() = true; } - virtual void visit(Near &) { isVisited<Near>() = true; } - virtual void visit(ONear &) { isVisited<ONear>() = true; } - virtual void visit(Or &) { isVisited<Or>() = true; } - virtual void visit(Phrase &) { isVisited<Phrase>() = true; } - virtual void visit(PrefixTerm &) { isVisited<PrefixTerm>() = true; } - virtual void visit(RangeTerm &) { isVisited<RangeTerm>() = true; } - virtual void visit(Rank &) { isVisited<Rank>() = true; } - virtual void visit(StringTerm &) { isVisited<StringTerm>() = true; } - virtual void visit(SubstringTerm &) { isVisited<SubstringTerm>() = true; } - virtual void visit(SuffixTerm &) { isVisited<SuffixTerm>() = true; } - virtual void visit(WeakAnd &) { isVisited<WeakAnd>() = true; } - virtual void visit(WeightedSetTerm &) + virtual void visit(And &) override { isVisited<And>() = true; } + virtual void visit(AndNot &) override { isVisited<AndNot>() = true; } + virtual void visit(Equiv &) override { isVisited<Equiv>() = true; } + virtual void visit(NumberTerm &) override { isVisited<NumberTerm>() = true; } + virtual void visit(LocationTerm &) override { isVisited<LocationTerm>() = true; } + virtual void visit(Near &) override { isVisited<Near>() = true; } + virtual void visit(ONear &) override { isVisited<ONear>() = true; } + virtual void visit(Or &) override { isVisited<Or>() = true; } + virtual void visit(Phrase &) override { isVisited<Phrase>() = true; } + virtual void visit(PrefixTerm &) override { isVisited<PrefixTerm>() = true; } + virtual void visit(RangeTerm &) override { isVisited<RangeTerm>() = true; } + virtual void visit(Rank &) override { isVisited<Rank>() = true; } + virtual void visit(StringTerm &) override { isVisited<StringTerm>() = true; } + virtual void visit(SubstringTerm &) override { isVisited<SubstringTerm>() = true; } + virtual void visit(SuffixTerm &) override { isVisited<SuffixTerm>() = true; } + virtual void visit(WeakAnd &) override { isVisited<WeakAnd>() = true; } + virtual void visit(WeightedSetTerm &) override { isVisited<WeightedSetTerm>() = true; } - virtual void visit(DotProduct &) { isVisited<DotProduct>() = true; } - virtual void visit(WandTerm &) { isVisited<WandTerm>() = true; } - virtual void visit(PredicateQuery &) + virtual void visit(DotProduct &) override { isVisited<DotProduct>() = true; } + virtual void visit(WandTerm &) override { isVisited<WandTerm>() = true; } + virtual void visit(PredicateQuery &) override { isVisited<PredicateQuery>() = true; } - virtual void visit(RegExpTerm &) { isVisited<RegExpTerm>() = true; } + virtual void visit(RegExpTerm &) override { isVisited<RegExpTerm>() = true; } }; template <class T> diff --git a/searchlib/src/tests/query/templatetermvisitor_test.cpp b/searchlib/src/tests/query/templatetermvisitor_test.cpp index 369266f5b2d..5415884aa31 100644 --- a/searchlib/src/tests/query/templatetermvisitor_test.cpp +++ b/searchlib/src/tests/query/templatetermvisitor_test.cpp @@ -21,7 +21,7 @@ class Test : public vespalib::TestApp { void requireThatAllTermsCanBeVisited(); public: - int Main(); + int Main() override; }; int diff --git a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp index e8c2a20a21a..e231af20361 100644 --- a/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/blueprint_test.cpp @@ -21,26 +21,26 @@ class MyOr : public IntermediateBlueprint { private: public: - virtual HitEstimate combine(const std::vector<HitEstimate> &data) const { + virtual HitEstimate combine(const std::vector<HitEstimate> &data) const override { return max(data); } - virtual FieldSpecBaseList exposeFields() const { + virtual FieldSpecBaseList exposeFields() const override { return mixChildrenFields(); } - virtual void sort(std::vector<Blueprint*> &children) const { + virtual void sort(std::vector<Blueprint*> &children) const override { std::sort(children.begin(), children.end(), GreaterEstimate()); } - virtual bool inheritStrict(size_t i) const { + virtual bool inheritStrict(size_t i) const override { (void)i; return true; } virtual SearchIterator::UP createIntermediateSearch(const MultiSearch::Children &subSearches, - bool strict, MatchData &md) const + bool strict, MatchData &md) const override { return SearchIterator::UP(new MySearch("or", subSearches, &md, strict)); } @@ -57,7 +57,7 @@ private: public: virtual SearchIterator::UP createIntermediateSearch(const MultiSearch::Children &subSearches, - bool strict, MatchData &md) const + bool strict, MatchData &md) const override { return SearchIterator::UP(new MySearch("or", subSearches, &md, strict)); } @@ -73,21 +73,21 @@ class MyAnd : public AndBlueprint { private: public: - virtual HitEstimate combine(const std::vector<HitEstimate> &data) const { + virtual HitEstimate combine(const std::vector<HitEstimate> &data) const override { return min(data); } - virtual FieldSpecBaseList exposeFields() const { + virtual FieldSpecBaseList exposeFields() const override { return FieldSpecBaseList(); } - virtual bool inheritStrict(size_t i) const { + virtual bool inheritStrict(size_t i) const override { return (i == 0); } virtual SearchIterator::UP createIntermediateSearch(const MultiSearch::Children &subSearches, - bool strict, MatchData &md) const + bool strict, MatchData &md) const override { return SearchIterator::UP(new MySearch("and", subSearches, &md, strict)); } @@ -104,7 +104,7 @@ private: public: virtual SearchIterator::UP createIntermediateSearch(const MultiSearch::Children &subSearches, - bool strict, MatchData &md) const + bool strict, MatchData &md) const override { return SearchIterator::UP(new MySearch("and", subSearches, &md, strict)); } @@ -119,7 +119,7 @@ class OtherAndNot : public AndNotBlueprint public: virtual SearchIterator::UP createIntermediateSearch(const MultiSearch::Children &subSearches, - bool strict, MatchData &md) const + bool strict, MatchData &md) const override { return SearchIterator::UP(new MySearch("andnot", subSearches, &md, strict)); } @@ -136,7 +136,7 @@ struct MyTerm : SimpleLeafBlueprint { MyTerm(const FieldSpecBaseList &fields, uint32_t hitEstimate) : SimpleLeafBlueprint(fields) { setEstimate(HitEstimate(hitEstimate, false)); } - virtual SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const { + virtual SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const override { return SearchIterator::UP(); } }; @@ -180,7 +180,7 @@ public: void requireThatAsStringWorks(); void requireThatVisitMembersWorks(); void requireThatDocIdLimitInjectionWorks(); - int Main(); + int Main() override; }; SearchIterator::UP diff --git a/searchlib/src/tests/queryeval/blueprint/leaf_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/leaf_blueprints_test.cpp index 782e1ea5ea8..513100dc4d3 100644 --- a/searchlib/src/tests/queryeval/blueprint/leaf_blueprints_test.cpp +++ b/searchlib/src/tests/queryeval/blueprint/leaf_blueprints_test.cpp @@ -16,7 +16,7 @@ public: void testEmptyBlueprint(); void testSimpleBlueprint(); void testFakeBlueprint(); - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/queryeval/blueprint/mysearch.h b/searchlib/src/tests/queryeval/blueprint/mysearch.h index 0ea91bd5703..d9593c84dc5 100644 --- a/searchlib/src/tests/queryeval/blueprint/mysearch.h +++ b/searchlib/src/tests/queryeval/blueprint/mysearch.h @@ -26,8 +26,8 @@ private: std::vector<uint32_t> _handles; protected: - virtual void doSeek(uint32_t) {} - virtual void doUnpack(uint32_t) {} + virtual void doSeek(uint32_t) override {} + virtual void doUnpack(uint32_t) override {} public: MySearch(const std::string &tag, bool leaf, bool strict) @@ -92,7 +92,7 @@ public: } } - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const { + virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override { visit(visitor, "_tag", _tag); visit(visitor, "_isLeaf", _isLeaf); visit(visitor, "_isStrict", _isStrict); @@ -111,7 +111,7 @@ class MyLeaf : public SimpleLeafBlueprint public: virtual SearchIterator::UP - createLeafSearch(const TFMDA &tfmda, bool strict) const + createLeafSearch(const TFMDA &tfmda, bool strict) const override { return SearchIterator::UP(new MySearch("leaf", tfmda, strict)); } diff --git a/searchlib/src/tests/queryeval/booleanmatchiteratorwrapper/booleanmatchiteratorwrapper_test.cpp b/searchlib/src/tests/queryeval/booleanmatchiteratorwrapper/booleanmatchiteratorwrapper_test.cpp index bd92acaa799..c40d3c90d1f 100644 --- a/searchlib/src/tests/queryeval/booleanmatchiteratorwrapper/booleanmatchiteratorwrapper_test.cpp +++ b/searchlib/src/tests/queryeval/booleanmatchiteratorwrapper/booleanmatchiteratorwrapper_test.cpp @@ -26,7 +26,7 @@ struct DummyItr : public SearchIterator { ++dtorCnt; } - void doSeek(uint32_t docid) { + void doSeek(uint32_t docid) override { ++seekCnt; if (docid <= 10) { setDocId(10); @@ -37,7 +37,7 @@ struct DummyItr : public SearchIterator { } } - void doUnpack(uint32_t docid) { + void doUnpack(uint32_t docid) override { ++unpackCnt; if (match != 0) { _unpackedDocId = docid; diff --git a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp index 6c4860b6486..b221f57379f 100644 --- a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp +++ b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp @@ -84,11 +84,11 @@ struct MockSearch : public SearchIterator { SearchIterator::initRange(begin, end); setDocId(_initial); } - virtual void doSeek(uint32_t) { + virtual void doSeek(uint32_t) override { ++seekCnt; setAtEnd(); } - virtual void doUnpack(uint32_t) {} + virtual void doUnpack(uint32_t) override {} }; struct MockFixture { diff --git a/searchlib/src/tests/queryeval/equiv/equiv_test.cpp b/searchlib/src/tests/queryeval/equiv/equiv_test.cpp index d838ded85c9..48379789841 100644 --- a/searchlib/src/tests/queryeval/equiv/equiv_test.cpp +++ b/searchlib/src/tests/queryeval/equiv/equiv_test.cpp @@ -18,7 +18,7 @@ using search::fef::FieldPositionsIterator; class Test : public vespalib::TestApp { public: void testEquiv(); - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp b/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp index c4bd736e74c..70ed03716de 100644 --- a/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp +++ b/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp @@ -17,7 +17,7 @@ using namespace search::fef; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; void testTestFakeResult(); void testTerm(); void testPhrase(); diff --git a/searchlib/src/tests/queryeval/getnodeweight/getnodeweight_test.cpp b/searchlib/src/tests/queryeval/getnodeweight/getnodeweight_test.cpp index 949a1364061..0e9fcff0073 100644 --- a/searchlib/src/tests/queryeval/getnodeweight/getnodeweight_test.cpp +++ b/searchlib/src/tests/queryeval/getnodeweight/getnodeweight_test.cpp @@ -13,7 +13,7 @@ using namespace search::queryeval; class Test : public vespalib::TestApp { public: int32_t getWeight(const Node &node); - int Main(); + int Main() override; }; int32_t diff --git a/searchlib/src/tests/queryeval/monitoring_search_iterator/monitoring_search_iterator_test.cpp b/searchlib/src/tests/queryeval/monitoring_search_iterator/monitoring_search_iterator_test.cpp index 3f2a8b10ccc..7eda4e70c8f 100644 --- a/searchlib/src/tests/queryeval/monitoring_search_iterator/monitoring_search_iterator_test.cpp +++ b/searchlib/src/tests/queryeval/monitoring_search_iterator/monitoring_search_iterator_test.cpp @@ -23,12 +23,12 @@ struct HistorySearchIterator : public SearchIterator SearchHistory _history; mutable bool _getPostingInfoCalled; HistorySearchIterator() : _history(), _getPostingInfoCalled(false) {} - virtual void doSeek(uint32_t docId) { + virtual void doSeek(uint32_t docId) override { _history.seek("x", docId); setDocId(docId); } - virtual void doUnpack(uint32_t docId) { _history.unpack("x", docId); } - virtual const PostingInfo *getPostingInfo() const { + virtual void doUnpack(uint32_t docId) override { _history.unpack("x", docId); } + virtual const PostingInfo *getPostingInfo() const override { _getPostingInfoCalled = true; return NULL; } diff --git a/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp b/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp index 8912be56351..4f99f01c290 100644 --- a/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp +++ b/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_bench.cpp @@ -21,7 +21,7 @@ class Test : public vespalib::TestApp { public: void benchmark(); - int Main(); + int Main() override; template <typename T> void testSearch(bool strict); private: diff --git a/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_test.cpp b/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_test.cpp index 6627dcb6b4b..0a6586a31d2 100644 --- a/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_test.cpp +++ b/searchlib/src/tests/queryeval/multibitvectoriterator/multibitvectoriterator_test.cpp @@ -36,7 +36,7 @@ public: void testOptimizeAndOr(); template <typename T> void testSearch(bool strict); - int Main(); + int Main() override; private: void verifySelectiveUnpack(SearchIterator & s, const TermFieldMatchData * tfmd); void searchAndCompare(SearchIterator::UP s, uint32_t docIdLimit); diff --git a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp index d82565a9ec7..e414b10cb24 100644 --- a/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp +++ b/searchlib/src/tests/queryeval/parallel_weak_and/parallel_weak_and_test.cpp @@ -68,7 +68,7 @@ struct TestHeap : public WeakAndHeap ScoresHistory history; TestHeap(uint32_t scoresToTrack_) : WeakAndHeap(scoresToTrack_), history() {} - virtual void adjust(score_t *begin, score_t *end) { + virtual void adjust(score_t *begin, score_t *end) override { Scores scores; for (score_t *itr = begin; itr != end; ++itr) { scores.add(*itr); diff --git a/searchlib/src/tests/queryeval/queryeval.cpp b/searchlib/src/tests/queryeval/queryeval.cpp index e8eed9e50ff..c13f7ac7b1c 100644 --- a/searchlib/src/tests/queryeval/queryeval.cpp +++ b/searchlib/src/tests/queryeval/queryeval.cpp @@ -279,12 +279,12 @@ public: _accumRemove(0), _accumInsert(0) { } - virtual void onRemove(size_t index) { _accumRemove += index; } - virtual void onInsert(size_t index) { _accumInsert += index; } + virtual void onRemove(size_t index) override { _accumRemove += index; } + virtual void onInsert(size_t index) override { _accumInsert += index; } size_t _accumRemove; size_t _accumInsert; private: - virtual void doSeek(uint32_t docid) { (void) docid; } + virtual void doSeek(uint32_t docid) override { (void) docid; } }; TEST("testMultiSearch") { @@ -337,7 +337,7 @@ public: SearchContextParams().useBitVector(true)); } virtual SearchIterator::UP - createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const + createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override { (void) tfmda; return _sc->createIterator(&_tfmd, strict); diff --git a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp index 6f87f6befb0..470b309db0f 100644 --- a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp +++ b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp @@ -39,7 +39,7 @@ struct MyTerm : public search::queryeval::SimpleLeafBlueprint { setEstimate(HitEstimate(hits, (hits == 0))); } virtual SearchIterator::UP createLeafSearch( - const search::fef::TermFieldMatchDataArray &, bool) const + const search::fef::TermFieldMatchDataArray &, bool) const override { return SearchIterator::UP(); } @@ -58,7 +58,7 @@ class Test : public vespalib::TestApp { void requireThatDoomIsPropagated(); public: - int Main(); + int Main() override; }; int diff --git a/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp b/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp index f6446c4b5cb..59f1c93bed0 100644 --- a/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp +++ b/searchlib/src/tests/queryeval/sourceblender/sourceblender.cpp @@ -25,11 +25,11 @@ private: SimpleResult _unpacked; protected: - virtual void doSeek(uint32_t docid) { + virtual void doSeek(uint32_t docid) override { _search->seek(docid); setDocId(_search->getDocId()); } - virtual void doUnpack(uint32_t docid) { + virtual void doUnpack(uint32_t docid) override { _unpacked.addHit(docid); _search->unpack(docid); } diff --git a/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp b/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp index 68d7dec0f87..f0f2752de5f 100644 --- a/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp +++ b/searchlib/src/tests/queryeval/sparse_vector_benchmark/sparse_vector_benchmark_test.cpp @@ -162,7 +162,7 @@ struct ModSearch : SearchIterator { uint32_t step; uint32_t limit; ModSearch(uint32_t step_in, uint32_t limit_in) : step(step_in), limit(limit_in) { setDocId(step); } - virtual void doSeek(uint32_t docid) { + virtual void doSeek(uint32_t docid) override { assert(docid > getDocId()); uint32_t hit = (docid / step) * step; if (hit < docid) { @@ -175,17 +175,17 @@ struct ModSearch : SearchIterator { setAtEnd(); } } - virtual void doUnpack(uint32_t) {} + virtual void doUnpack(uint32_t) override {} }; struct ModSearchFactory : ChildFactory { uint32_t bias; ModSearchFactory() : bias(1) {} explicit ModSearchFactory(int b) : bias(b) {} - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("ModSearch(%u)", bias); } - virtual SearchIterator *createChild(uint32_t idx, uint32_t limit) const { + virtual SearchIterator *createChild(uint32_t idx, uint32_t limit) const override { return new ModSearch(bias + idx, limit); } }; @@ -195,10 +195,10 @@ struct ModSearchFactory : ChildFactory { struct VespaWandFactory : SparseVectorFactory { uint32_t n; VespaWandFactory(uint32_t n_in) : n(n_in) {} - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("VespaWand(%u)", n); } - virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const { + virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override { wand::Terms terms; for (size_t i = 0; i < childCnt; ++i) { terms.push_back(wand::Term(childFactory.createChild(i, limit), default_weight, limit / (i + 1))); @@ -210,10 +210,10 @@ struct VespaWandFactory : SparseVectorFactory { struct RiseWandFactory : SparseVectorFactory { uint32_t n; RiseWandFactory(uint32_t n_in) : n(n_in) {} - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("RiseWand(%u)", n); } - virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const { + virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override { wand::Terms terms; for (size_t i = 0; i < childCnt; ++i) { terms.push_back(wand::Term(childFactory.createChild(i, limit), default_weight, limit / (i + 1))); @@ -224,10 +224,10 @@ struct RiseWandFactory : SparseVectorFactory { struct WeightedSetFactory : SparseVectorFactory { mutable TermFieldMatchData tfmd; - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("WeightedSet"); } - virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const { + virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override { std::vector<SearchIterator*> terms; std::vector<int32_t> weights; for (size_t i = 0; i < childCnt; ++i) { @@ -240,10 +240,10 @@ struct WeightedSetFactory : SparseVectorFactory { struct DotProductFactory : SparseVectorFactory { mutable TermFieldMatchData tfmd; - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("DotProduct"); } - virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const { + virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override { MatchDataLayout layout; std::vector<TermFieldHandle> handles; for (size_t i = 0; i < childCnt; ++i) { @@ -263,10 +263,10 @@ struct DotProductFactory : SparseVectorFactory { }; struct OrFactory : SparseVectorFactory { - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("Or"); } - virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const { + virtual SearchIterator *createSparseVector(ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override { OrSearch::Children children; for (size_t i = 0; i < childCnt; ++i) { children.push_back(childFactory.createChild(i, limit)); @@ -278,19 +278,19 @@ struct OrFactory : SparseVectorFactory { //----------------------------------------------------------------------------- struct NoFilterStrategy : FilterStrategy { - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("NoFilter"); } - virtual SearchIterator *createRoot(SparseVectorFactory &vectorFactory, ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const { + virtual SearchIterator *createRoot(SparseVectorFactory &vectorFactory, ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override { return vectorFactory.createSparseVector(childFactory, childCnt, limit); } }; struct PositiveFilterBeforeStrategy : FilterStrategy { - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("PositiveBefore"); } - virtual SearchIterator *createRoot(SparseVectorFactory &vectorFactory, ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const { + virtual SearchIterator *createRoot(SparseVectorFactory &vectorFactory, ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override { AndSearch::Children children; children.push_back(new ModSearch(2, limit)); // <- 50% hits (hardcoded) children.push_back(vectorFactory.createSparseVector(childFactory, childCnt, limit)); @@ -299,10 +299,10 @@ struct PositiveFilterBeforeStrategy : FilterStrategy { }; struct NegativeFilterAfterStrategy : FilterStrategy { - virtual std::string name() const { + virtual std::string name() const override { return vespalib::make_string("NegativeAfter"); } - virtual SearchIterator *createRoot(SparseVectorFactory &vectorFactory, ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const { + virtual SearchIterator *createRoot(SparseVectorFactory &vectorFactory, ChildFactory &childFactory, uint32_t childCnt, uint32_t limit) const override { AndNotSearch::Children children; children.push_back(vectorFactory.createSparseVector(childFactory, childCnt, limit)); children.push_back(new ModSearch(2, limit)); // <- 50% hits (hardcoded) diff --git a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp index 5a3ddc04295..ac106025cb1 100644 --- a/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp +++ b/searchlib/src/tests/queryeval/termwise_eval/termwise_eval_test.cpp @@ -56,7 +56,7 @@ struct MyTerm : public SearchIterator { } } void doUnpack(uint32_t) override {} - void visitMembers(vespalib::ObjectVisitor &visitor) const { + void visitMembers(vespalib::ObjectVisitor &visitor) const override { visit(visitor, "hits", hits); visit(visitor, "strict", is_strict); } diff --git a/searchlib/src/tests/queryeval/weak_and/rise_wand.h b/searchlib/src/tests/queryeval/weak_and/rise_wand.h index f130f0d1012..60e1ec889b3 100644 --- a/searchlib/src/tests/queryeval/weak_and/rise_wand.h +++ b/searchlib/src/tests/queryeval/weak_and/rise_wand.h @@ -121,8 +121,8 @@ public: RiseWand(const Terms &terms, uint32_t n); virtual ~RiseWand(); void next(); - virtual void doSeek(uint32_t docid); - virtual void doUnpack(uint32_t docid); + virtual void doSeek(uint32_t docid) override; + virtual void doUnpack(uint32_t docid) override; }; typedef RiseWand<TermFreqScorer, std::greater_equal<uint64_t> > TermFrequencyRiseWand; diff --git a/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp b/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp index 67fab2758ea..ed0e6f209fd 100644 --- a/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp +++ b/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp @@ -60,7 +60,7 @@ struct ModSearch : SearchIterator { SearchIterator::initRange(begin, end); setDocId(step); } - virtual void doSeek(uint32_t docid) { + virtual void doSeek(uint32_t docid) override { assert(docid > getDocId()); uint32_t skippedDocs = (docid - getDocId() - 1); uint32_t skippedHits = (skippedDocs / step); @@ -76,7 +76,7 @@ struct ModSearch : SearchIterator { setAtEnd(); } } - virtual void doUnpack(uint32_t docid) { + virtual void doUnpack(uint32_t docid) override { if (tfmd != NULL) { tfmd->reset(docid); search::fef::TermFieldMatchDataPosition pos; @@ -85,7 +85,7 @@ struct ModSearch : SearchIterator { } stats.unpack(); } - virtual const PostingInfo *getPostingInfo() const { return &info; } + virtual const PostingInfo *getPostingInfo() const override { return &info; } }; struct WandFactory { @@ -97,8 +97,8 @@ struct WandFactory { struct VespaWandFactory : WandFactory { uint32_t n; VespaWandFactory(uint32_t n_in) : n(n_in) {} - virtual std::string name() const { return make_string("VESPA WAND (n=%u)", n); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("VESPA WAND (n=%u)", n); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { return SearchIterator::UP(WeakAndSearch::create(terms, n, true)); } }; @@ -106,8 +106,8 @@ struct VespaWandFactory : WandFactory { struct VespaArrayWandFactory : WandFactory { uint32_t n; VespaArrayWandFactory(uint32_t n_in) : n(n_in) {} - virtual std::string name() const { return make_string("VESPA ARRAY WAND (n=%u)", n); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("VESPA ARRAY WAND (n=%u)", n); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { return SearchIterator::UP(WeakAndSearch::createArrayWand(terms, n, true)); } }; @@ -115,8 +115,8 @@ struct VespaArrayWandFactory : WandFactory { struct VespaHeapWandFactory : WandFactory { uint32_t n; VespaHeapWandFactory(uint32_t n_in) : n(n_in) {} - virtual std::string name() const { return make_string("VESPA HEAP WAND (n=%u)", n); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("VESPA HEAP WAND (n=%u)", n); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { return SearchIterator::UP(WeakAndSearch::createHeapWand(terms, n, true)); } }; @@ -125,8 +125,8 @@ struct VespaParallelWandFactory : public WandFactory { SharedWeakAndPriorityQueue scores; TermFieldMatchData rootMatchData; VespaParallelWandFactory(uint32_t n) : scores(n), rootMatchData() {} - virtual std::string name() const { return make_string("VESPA PWAND (n=%u)", scores.getScoresToTrack()); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("VESPA PWAND (n=%u)", scores.getScoresToTrack()); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { return SearchIterator::UP(ParallelWeakAndSearch::create(terms, PWMatchParams(scores, 0, 1, 1), PWRankParams(rootMatchData, MatchData::UP()), true)); @@ -135,8 +135,8 @@ struct VespaParallelWandFactory : public WandFactory { struct VespaParallelArrayWandFactory : public VespaParallelWandFactory { VespaParallelArrayWandFactory(uint32_t n) : VespaParallelWandFactory(n) {} - virtual std::string name() const { return make_string("VESPA ARRAY PWAND (n=%u)", scores.getScoresToTrack()); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("VESPA ARRAY PWAND (n=%u)", scores.getScoresToTrack()); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { return SearchIterator::UP(ParallelWeakAndSearch::createArrayWand(terms, PWMatchParams(scores, 0, 1, 1), PWRankParams(rootMatchData, MatchData::UP()), true)); @@ -145,8 +145,8 @@ struct VespaParallelArrayWandFactory : public VespaParallelWandFactory { struct VespaParallelHeapWandFactory : public VespaParallelWandFactory { VespaParallelHeapWandFactory(uint32_t n) : VespaParallelWandFactory(n) {} - virtual std::string name() const { return make_string("VESPA HEAP PWAND (n=%u)", scores.getScoresToTrack()); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("VESPA HEAP PWAND (n=%u)", scores.getScoresToTrack()); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { return SearchIterator::UP(ParallelWeakAndSearch::createHeapWand(terms, PWMatchParams(scores, 0, 1, 1), PWRankParams(rootMatchData, MatchData::UP()), true)); @@ -156,8 +156,8 @@ struct VespaParallelHeapWandFactory : public VespaParallelWandFactory { struct TermFrequencyRiseWandFactory : WandFactory { uint32_t n; TermFrequencyRiseWandFactory(uint32_t n_in) : n(n_in) {} - virtual std::string name() const { return make_string("RISE WAND TF (n=%u)", n); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("RISE WAND TF (n=%u)", n); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { return SearchIterator::UP(new rise::TermFrequencyRiseWand(terms, n)); } }; @@ -165,8 +165,8 @@ struct TermFrequencyRiseWandFactory : WandFactory { struct DotProductRiseWandFactory : WandFactory { uint32_t n; DotProductRiseWandFactory(uint32_t n_in) : n(n_in) {} - virtual std::string name() const { return make_string("RISE WAND DP (n=%u)", n); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("RISE WAND DP (n=%u)", n); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { return SearchIterator::UP(new rise::DotProductRiseWand(terms, n)); } }; @@ -176,8 +176,8 @@ struct FilterFactory : WandFactory { Stats stats; uint32_t n; FilterFactory(WandFactory &f, uint32_t n_in) : factory(f), n(n_in) {} - virtual std::string name() const { return make_string("Filter (mod=%u) [%s]", n, factory.name().c_str()); } - virtual SearchIterator::UP create(const wand::Terms &terms) { + virtual std::string name() const override { return make_string("Filter (mod=%u) [%s]", n, factory.name().c_str()); } + virtual SearchIterator::UP create(const wand::Terms &terms) override { AndNotSearch::Children children; children.push_back(factory.create(terms).release()); children.push_back(new ModSearch(stats, n, search::endDocId, n, NULL)); @@ -225,10 +225,10 @@ struct WandSetup : Setup { uint32_t weight; MatchData::UP matchData; WandSetup(WandFactory &f, uint32_t c, uint32_t l) : Setup(), factory(f), childCnt(c), limit(l), weight(100), matchData() {} - virtual std::string name() const { + virtual std::string name() const override { return make_string("Wand Setup (terms=%u,docs=%u) [%s]", childCnt, limit, factory.name().c_str()); } - virtual SearchIterator::UP create() { + virtual SearchIterator::UP create() override { MatchDataLayout layout; std::vector<TermFieldHandle> handles; for (size_t i = 0; i < childCnt; ++i) { diff --git a/searchlib/src/tests/queryeval/weak_and_scorers/weak_and_scorers_test.cpp b/searchlib/src/tests/queryeval/weak_and_scorers/weak_and_scorers_test.cpp index 2dec1762c27..55e299462b9 100644 --- a/searchlib/src/tests/queryeval/weak_and_scorers/weak_and_scorers_test.cpp +++ b/searchlib/src/tests/queryeval/weak_and_scorers/weak_and_scorers_test.cpp @@ -26,14 +26,14 @@ struct TestIterator : public SearchIterator _useInfo(useInfo), _unpackDocId(0) {} - virtual void doSeek(uint32_t docId) { + virtual void doSeek(uint32_t docId) override { (void) docId; } - virtual void doUnpack(uint32_t docId) { + virtual void doUnpack(uint32_t docId) override { _unpackDocId = docId; _tfmd.appendPosition(TermFieldMatchDataPosition(0, 0, _termWeight, 1)); } - virtual const PostingInfo *getPostingInfo() const { + virtual const PostingInfo *getPostingInfo() const override { return (_useInfo ? &_info : NULL); } static UP create(int32_t maxWeight, int32_t termWeight, bool useInfo) { diff --git a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp index a819eb77118..d389bf7c4a1 100644 --- a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp +++ b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp @@ -104,11 +104,11 @@ struct MockSearch : public SearchIterator { SearchIterator::initRange(begin, end); setDocId(_initial); } - virtual void doSeek(uint32_t) { + virtual void doSeek(uint32_t) override { ++seekCnt; setAtEnd(); } - virtual void doUnpack(uint32_t) {} + virtual void doUnpack(uint32_t) override {} }; struct MockFixture { diff --git a/searchlib/src/tests/ranksetup/ranksetup_test.cpp b/searchlib/src/tests/ranksetup/ranksetup_test.cpp index ba676ac8e2a..46e646b6493 100644 --- a/searchlib/src/tests/ranksetup/ranksetup_test.cpp +++ b/searchlib/src/tests/ranksetup/ranksetup_test.cpp @@ -54,7 +54,7 @@ class DumpFeatureVisitor : public IDumpFeatureVisitor { public: DumpFeatureVisitor() {} - virtual void visitDumpFeature(const vespalib::string & name) { + virtual void visitDumpFeature(const vespalib::string & name) override { std::cout << "dump feature: " << name << std::endl; } }; @@ -247,7 +247,7 @@ private: public: RankSetupTest(); - int Main(); + int Main() override; }; diff --git a/searchlib/src/tests/sort/sort_test.cpp b/searchlib/src/tests/sort/sort_test.cpp index 68c3aa4d768..1f637fb8dc6 100644 --- a/searchlib/src/tests/sort/sort_test.cpp +++ b/searchlib/src/tests/sort/sort_test.cpp @@ -21,7 +21,7 @@ using vespalib::ConstBufferRef; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; void testUnsignedIntegerSort(); template <typename T> void testSignedIntegerSort(); diff --git a/searchlib/src/tests/sort/sortbenchmark.cpp b/searchlib/src/tests/sort/sortbenchmark.cpp index f028c81ff7a..8a52a07c859 100644 --- a/searchlib/src/tests/sort/sortbenchmark.cpp +++ b/searchlib/src/tests/sort/sortbenchmark.cpp @@ -13,7 +13,7 @@ class Test : public vespalib::TestApp public: typedef std::vector<uint32_t> V; std::vector< std::vector<uint32_t> > _data; - int Main(); + int Main() override; void generateVectors(size_t numVectors, size_t values); V merge(); void twoWayMerge(); diff --git a/searchlib/src/tests/sort/uca.cpp b/searchlib/src/tests/sort/uca.cpp index 121e53a9e7c..c4802f5d3ce 100644 --- a/searchlib/src/tests/sort/uca.cpp +++ b/searchlib/src/tests/sort/uca.cpp @@ -20,7 +20,7 @@ using icu::Collator; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; void testFromDat(); }; diff --git a/searchlib/src/tests/stackdumpiterator/stackdumpiteratortest.h b/searchlib/src/tests/stackdumpiterator/stackdumpiteratortest.h index e661431209c..121653a89d1 100644 --- a/searchlib/src/tests/stackdumpiterator/stackdumpiteratortest.h +++ b/searchlib/src/tests/stackdumpiterator/stackdumpiteratortest.h @@ -8,7 +8,7 @@ class StackDumpIteratorTest : public FastOS_Application { - int Main(); + int Main() override; void Usage(char *progname); bool ShowResult(int testNo, search::SimpleQueryStackDumpIterator &actual, search::SimpleQueryStack &correct, unsigned int expected); bool RunTest(int i, bool verify); diff --git a/searchlib/src/tests/stringenum/stringenum_test.cpp b/searchlib/src/tests/stringenum/stringenum_test.cpp index 8c6ef64dbe3..264fd964a04 100644 --- a/searchlib/src/tests/stringenum/stringenum_test.cpp +++ b/searchlib/src/tests/stringenum/stringenum_test.cpp @@ -18,7 +18,7 @@ class MyApp : public vespalib::TestApp { public: void CheckLookup( search::util::StringEnum *strEnum, const char *str, int value); - int Main(); + int Main() override; MyApp(void) {} }; diff --git a/searchlib/src/tests/transactionlog/translogclient_test.cpp b/searchlib/src/tests/transactionlog/translogclient_test.cpp index 249544984ab..bd0053827d2 100644 --- a/searchlib/src/tests/transactionlog/translogclient_test.cpp +++ b/searchlib/src/tests/transactionlog/translogclient_test.cpp @@ -31,7 +31,7 @@ vespalib::string myhex(const void * b, size_t sz) class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; private: bool createDomainTest(TransLogClient & tls, const vespalib::string & name, size_t preExistingDomains=0); TransLogClient::Session::UP openDomainTest(TransLogClient & tls, const vespalib::string & name); @@ -61,9 +61,9 @@ TEST_APPHOOK(Test); class CallBackTest : public TransLogClient::Subscriber::Callback { private: - virtual RPC::Result receive(const Packet & packet); - virtual void inSync() { _inSync = true; } - virtual void eof() { _eof = true; } + virtual RPC::Result receive(const Packet & packet) override; + virtual void inSync() override { _inSync = true; } + virtual void eof() override { _eof = true; } typedef std::map<SerialNum, ByteBuffer> PacketMap; PacketMap _packetMap; public: @@ -93,9 +93,9 @@ RPC::Result CallBackTest::receive(const Packet & p) class CallBackManyTest : public TransLogClient::Subscriber::Callback { private: - virtual RPC::Result receive(const Packet & packet); - virtual void inSync() { _inSync = true; } - virtual void eof() { _eof = true; } + virtual RPC::Result receive(const Packet & packet) override; + virtual void inSync() override { _inSync = true; } + virtual void eof() override { _eof = true; } public: CallBackManyTest(size_t start) : _inSync(false), _eof(false), _count(start), _value(start) { } void clear() { _inSync = false; _eof = false; _count = 0; _value = 0; } @@ -125,9 +125,9 @@ class CallBackUpdate : public TransLogClient::Subscriber::Callback public: typedef std::map<SerialNum, Identifiable *> PacketMap; private: - virtual RPC::Result receive(const Packet & packet); - virtual void inSync() { _inSync = true; } - virtual void eof() { _eof = true; } + virtual RPC::Result receive(const Packet & packet) override; + virtual void inSync() override { _inSync = true; } + virtual void eof() override { _eof = true; } PacketMap _packetMap; public: CallBackUpdate() : _inSync(false), _eof(false) { } @@ -174,9 +174,9 @@ RPC::Result CallBackUpdate::receive(const Packet & packet) class CallBackStatsTest : public TransLogClient::Session::Callback { private: - virtual RPC::Result receive(const Packet & packet); - virtual void inSync() { _inSync = true; } - virtual void eof() { _eof = true; } + virtual RPC::Result receive(const Packet & packet) override; + virtual void inSync() override { _inSync = true; } + virtual void eof() override { _eof = true; } public: CallBackStatsTest() : _inSync(false), _eof(false), _count(0), _inOrder(0), diff --git a/searchlib/src/tests/transactionlogstress/translogstress.cpp b/searchlib/src/tests/transactionlogstress/translogstress.cpp index c11aa62cd21..3719c5da1c7 100644 --- a/searchlib/src/tests/transactionlogstress/translogstress.cpp +++ b/searchlib/src/tests/transactionlogstress/translogstress.cpp @@ -208,7 +208,7 @@ public: FeederThread(const std::string & tlsSpec, const std::string & domain, const EntryGenerator & generator, uint32_t feedRate, size_t packetSize); ~FeederThread(); - virtual void doRun(); + virtual void doRun() override; SerialNumRange getRange() const { return SerialNumRange(1, _lastCommited); } }; @@ -306,9 +306,9 @@ public: _tlsSpec(tlsSpec), _domain(domain), _client(tlsSpec), _generator(generator), _name(name), _id(id), _validate(validate) {} virtual ~Agent() {} - virtual RPC::Result receive(const Packet & packet) = 0; - virtual void inSync() {} - virtual void eof() {} + virtual RPC::Result receive(const Packet & packet) override = 0; + virtual void inSync() override {} + virtual void eof() override {} virtual void failed() {} }; @@ -342,7 +342,7 @@ public: return _next; } SerialNumRange getRange() const { return SerialNumRange(_from, _next - 1); } - virtual RPC::Result receive(const Packet & packet); + virtual RPC::Result receive(const Packet & packet) override; }; void @@ -445,8 +445,8 @@ public: } } SerialNum getFrom() { return _from; } - virtual RPC::Result receive(const Packet & packet); - virtual void eof() { + virtual RPC::Result receive(const Packet & packet) override; + virtual void eof() override { LOG(info, "VisitorAgent[%u]: eof", _id); setState(FINISHED); } @@ -555,7 +555,7 @@ public: uint32_t runningVisitors(); std::vector<std::shared_ptr<SubscriberAgent> > & getSubscribers() { return _subscribers; } std::vector<std::shared_ptr<VisitorAgent> > & getVisitors() { return _visitors; } - virtual void doRun(); + virtual void doRun() override; }; @@ -692,7 +692,7 @@ private: void usage(); public: - int Main(); + int Main() override; }; void diff --git a/searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp b/searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp index d5c77fb28e4..3aa3b89b19a 100644 --- a/searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp +++ b/searchlib/src/tests/util/searchable_stats/searchable_stats_test.cpp @@ -9,7 +9,7 @@ using namespace search; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; }; int diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index b6251dfecc6..94c17662a4c 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -302,6 +302,14 @@ public: protected: /** + * Called when a new document has been added, but only for + * multivalue, enumerated, and string attributes. + * Can be overridden by subclasses that need to resize structures as a result of this. + * Should return true if underlying structures were resized. + **/ + virtual bool onAddDoc(DocId) { return false; } + + /** * Returns the number of readers holding a generation guard. * Should be called by the writer thread. */ diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.h b/searchlib/src/vespa/searchlib/attribute/enumattribute.h index 75d9e44b43f..94e5da62967 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.h @@ -61,18 +61,18 @@ protected: virtual EnumType getFromEnum(EnumHandle e) const { return _enumStore.getValue(e); } virtual void fillPostings(LoadedVector & loaded) { (void) loaded; } - virtual void fillEnum(LoadedVector & loaded); + virtual void fillEnum(LoadedVector & loaded) override; virtual void fillEnum0(const void *src, size_t srcLen, - EnumIndexVector &eidxs); + EnumIndexVector &eidxs) override; virtual void - fixupEnumRefCounts(const EnumVector &enumHist); + fixupEnumRefCounts(const EnumVector &enumHist) override; virtual uint64_t - getUniqueValueCount(void) const; + getUniqueValueCount(void) const override; static EnumType getDefaultEnumTypeValue() { return B::defaultValue(); } diff --git a/searchlib/src/vespa/searchlib/attribute/flagattribute.h b/searchlib/src/vespa/searchlib/attribute/flagattribute.h index 43a3647d93f..ea73ecb7c51 100644 --- a/searchlib/src/vespa/searchlib/attribute/flagattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/flagattribute.h @@ -40,13 +40,14 @@ public: void setNewBVValue(DocId doc, typename B::WType::ValueType value); private: - virtual bool onAddDoc(DocId doc); + virtual bool onAddDoc(DocId doc) override; + void onAddDocs(DocId docIdLimit) override; void ensureGuardBit(BitVector & bv); void ensureGuardBit(); void clearGuardBit(DocId doc); void resizeBitVectors(uint32_t neededSize); - void removeOldGenerations(vespalib::GenerationHandler::generation_t firstUsed); + void removeOldGenerations(vespalib::GenerationHandler::generation_t firstUsed) override; uint32_t getOffset(int8_t value) const { return value + 128; } BitVector * getBitVector(typename B::BaseType value) const { return _bitVectors[value + 128]; diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.h b/searchlib/src/vespa/searchlib/attribute/floatbase.h index 66b4125f832..648d9459442 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.h +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.h @@ -65,6 +65,7 @@ public: typedef T LoadedValueType; typedef SequentialReadModifyWriteInterface<LoadedNumericValueT> LoadedVector; virtual uint32_t getRawValues(DocId doc, const multivalue::Value<T> * & values) const; + virtual uint32_t getRawValues(DocId doc, const multivalue::WeightedValue<T> * & values) const; protected: FloatingPointAttributeTemplate(const vespalib::string & name); @@ -72,6 +73,9 @@ protected: ~FloatingPointAttributeTemplate(); static T defaultValue() { return attribute::getUndefined<T>(); } virtual bool findEnum(T v, EnumHandle & e) const = 0; + virtual void fillEnum(LoadedVector&) {} + virtual void fillValues(LoadedVector &) {} + largeint_t getDefaultValue() const override { return static_cast<largeint_t>(-std::numeric_limits<T>::max()); } Change _defaultValue; private: diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp index 316967a425c..caf6f60b902 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp @@ -8,9 +8,13 @@ namespace search { template<typename T> uint32_t -FloatingPointAttributeTemplate<T>::getRawValues(DocId doc, const multivalue::Value<T> * & values) const { - (void) doc; - (void) values; +FloatingPointAttributeTemplate<T>::getRawValues(DocId, const multivalue::Value<T> * &) const { + throw std::runtime_error(getNativeClassName() + "::getRawValues() not implemented."); +} + +template<typename T> +uint32_t +FloatingPointAttributeTemplate<T>::getRawValues(DocId, const multivalue::WeightedValue<T> * &) const { throw std::runtime_error(getNativeClassName() + "::getRawValues() not implemented."); } diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index 401a6d7293c..238b3dd8efd 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -64,6 +64,7 @@ public: typedef T LoadedValueType; typedef SequentialReadModifyWriteInterface<LoadedNumericValueT> LoadedVector; virtual uint32_t getRawValues(DocId doc, const multivalue::Value<T> * & values) const; + virtual uint32_t getRawValues(DocId doc, const multivalue::WeightedValue<T> * & values) const; protected: IntegerAttributeTemplate(const vespalib::string & name) : @@ -88,6 +89,9 @@ protected: } static T defaultValue() { return attribute::getUndefined<T>(); } virtual bool findEnum(T v, EnumHandle & e) const = 0; + virtual void fillEnum(LoadedVector&) {} + virtual void fillValues(LoadedVector &) {} + largeint_t getDefaultValue() const override { return defaultValue(); } bool isUndefined(DocId doc) const override { return get(doc) == defaultValue(); } Change _defaultValue; diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp index dc6df880f49..59d54b2dbcf 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp @@ -15,6 +15,12 @@ IntegerAttributeTemplate<T>::getRawValues(DocId, const multivalue::Value<T> * &) } template<typename T> +uint32_t +IntegerAttributeTemplate<T>::getRawValues(DocId, const multivalue::WeightedValue<T> * &) const { + throw std::runtime_error(getNativeClassName() + "::getRawValues() not implemented."); +} + +template<typename T> bool IntegerAttributeTemplate<T>::findEnum(const char *value, EnumHandle &e) const { vespalib::asciistream iss(value); diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.h b/searchlib/src/vespa/searchlib/attribute/multienumattribute.h index bc684d41faf..d915bfa6f62 100644 --- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.h @@ -58,7 +58,7 @@ protected: this->getEnumStore().freezeTree(); } - virtual void fillValues(LoadedVector & loaded); + virtual void fillValues(LoadedVector & loaded) override; void fillEnumIdx(ReaderBase &attrReader, const EnumIndexVector &eidxs, LoadedEnumAttributeVector &loaded) override; void fillEnumIdx(ReaderBase &attrReader, const EnumIndexVector &eidxs, EnumVector &enumHist) override; virtual void mergeMemoryStats(MemoryUsage & total) { (void) total; } diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h index c007e19351a..6afede8d3b4 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericattribute.h @@ -60,7 +60,7 @@ protected: } public: - virtual uint32_t getRawValues(DocId doc, const WType * & values) const final { + virtual uint32_t getRawValues(DocId doc, const WType * & values) const final override { return get(doc, values); } /* diff --git a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h index 7339b8ce584..12b1098bbb3 100644 --- a/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multivalueattribute.h @@ -21,7 +21,7 @@ protected: typedef typename B::DocId DocId; typedef typename B::Change Change; typedef typename B::ChangeVector ChangeVector; - typedef typename B::ChangeVector::const_iterator ChangeVectorIterator; + typedef typename B::ChangeVector::const_iterator ChangeVectorIterator; using MultiValueType = M; using MultiValueMapping = attribute::MultiValueMapping<MultiValueType>; @@ -48,7 +48,7 @@ protected: * Can be overridden by subclasses that need to resize structures as a result of this. * Should return true if underlying structures were resized. **/ - virtual bool onAddDoc(DocId doc) { (void) doc; return false; } + virtual bool onAddDoc(DocId doc) override { (void) doc; return false; } AddressSpace getMultiValueAddressSpaceUsage() const override; diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h index 1b625b697ed..1843bde4d54 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.h @@ -83,7 +83,7 @@ protected: } virtual void mergeMemoryStats(MemoryUsage & total) { (void) total; } - virtual void fillValues(LoadedVector & loaded); + virtual void fillValues(LoadedVector & loaded) override; void fillEnumIdx(ReaderBase &attrReader, const EnumStoreBase::IndexVector &eidxs, @@ -101,7 +101,7 @@ protected: * * Should return true if underlying structures were resized. **/ - virtual bool onAddDoc(DocId doc); + virtual bool onAddDoc(DocId doc) override; public: SingleValueEnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); diff --git a/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp b/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp index fe2d48d48dc..fd62fd97cfe 100644 --- a/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/sourceselector.cpp @@ -29,7 +29,7 @@ public: { } virtual void - addTags(GenericHeader &header, const vespalib::string &name) const + addTags(GenericHeader &header, const vespalib::string &name) const override { typedef GenericHeader::Tag Tag; _parent.addTags(header, name); diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp index 77f111c2eb4..3c86f0ebd70 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp @@ -471,7 +471,6 @@ StringAttribute::onAddDoc(DocId doc) return false; } - void StringAttribute::fillPostings(LoadedVector & loaded) { (void) loaded; diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.h b/searchlib/src/vespa/searchlib/attribute/stringbase.h index c1ff0134f36..975352cdab9 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.h +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.h @@ -67,7 +67,7 @@ protected: bool onLoadEnumerated(ReaderBase &attrReader); - virtual bool onAddDoc(DocId doc); + virtual bool onAddDoc(DocId doc) override; virtual MemoryUsage getChangeVectorMemoryUsage() const override; private: diff --git a/searchlib/src/vespa/searchlib/bitcompression/posocccompression.cpp b/searchlib/src/vespa/searchlib/bitcompression/posocccompression.cpp index 68b7b7513b0..d209c99946b 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/posocccompression.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/posocccompression.cpp @@ -131,17 +131,17 @@ PosOccFieldParams::setSchemaParams(const Schema &schema, uint32_t fieldId) assert(fieldId < schema.getNumIndexFields()); const Schema::IndexField &field = schema.getIndexField(fieldId); switch (field.getCollectionType()) { - case schema::SINGLE: + case schema::CollectionType::SINGLE: _collectionType = SINGLE; _hasElements = false; _hasElementWeights = false; break; - case schema::ARRAY: + case schema::CollectionType::ARRAY: _collectionType = ARRAY; _hasElements = true; _hasElementWeights = false; break; - case schema::WEIGHTEDSET: + case schema::CollectionType::WEIGHTEDSET: _collectionType = WEIGHTEDSET; _hasElements = true; _hasElementWeights = true; @@ -165,17 +165,17 @@ PosOccFieldParams::readHeader(const vespalib::GenericHeader &header, _name = header.getTag(nameKey).asString(); Schema::CollectionType ct = schema::collectionTypeFromName(header.getTag(collKey).asString()); switch (ct) { - case schema::SINGLE: + case schema::CollectionType::SINGLE: _collectionType = SINGLE; _hasElements = false; _hasElementWeights = false; break; - case schema::ARRAY: + case schema::CollectionType::ARRAY: _collectionType = ARRAY; _hasElements = true; _hasElementWeights = false; break; - case schema::WEIGHTEDSET: + case schema::CollectionType::WEIGHTEDSET: _collectionType = WEIGHTEDSET; _hasElements = true; _hasElementWeights = true; @@ -196,16 +196,16 @@ PosOccFieldParams::writeHeader(vespalib::GenericHeader &header, vespalib::string collKey(prefix + "collectionType"); vespalib::string avgElemLenKey(prefix + "avgElemLen"); header.putTag(GenericHeader::Tag(nameKey, _name)); - Schema::CollectionType ct(schema::SINGLE); + Schema::CollectionType ct(schema::CollectionType::SINGLE); switch (_collectionType) { case SINGLE: - ct = schema::SINGLE; + ct = schema::CollectionType::SINGLE; break; case ARRAY: - ct = schema::ARRAY; + ct = schema::CollectionType::ARRAY; break; case WEIGHTEDSET: - ct = schema::WEIGHTEDSET; + ct = schema::CollectionType::WEIGHTEDSET; break; default: LOG(error, diff --git a/searchlib/src/vespa/searchlib/common/packets.h b/searchlib/src/vespa/searchlib/common/packets.h index 6fffd3efa36..00ebc6a7673 100644 --- a/searchlib/src/vespa/searchlib/common/packets.h +++ b/searchlib/src/vespa/searchlib/common/packets.h @@ -135,10 +135,10 @@ public: FS4PersistentPacketStreamer(FS4PacketFactory::CreatePacket_t cp); bool GetPacketInfo(FNET_DataBuffer *src, uint32_t *plen, - uint32_t *pcode, uint32_t *chid, bool *broken); + uint32_t *pcode, uint32_t *chid, bool *broken) override; FNET_Packet *Decode(FNET_DataBuffer *src, uint32_t plen, - uint32_t pcode, FNET_Context context); - void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst); + uint32_t pcode, FNET_Context context) override; + void Encode(FNET_Packet *packet, uint32_t chid, FNET_DataBuffer *dst) override; void SetConservativeMode(bool cons) { _conservative = cons; } void SetCompressionLimit(unsigned int limit) { _compressionLimit = limit; } diff --git a/searchlib/src/vespa/searchlib/diskindex/fusion.cpp b/searchlib/src/vespa/searchlib/diskindex/fusion.cpp index 2421e46f528..8cae80fb892 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fusion.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fusion.cpp @@ -20,14 +20,15 @@ LOG_SETUP(".diskindex.fusion"); using search::FileKit; -using search::index::PostingListParams; -using search::index::Schema; -using search::index::SchemaUtil; +using search::PostingPriorityQueue; using search::common::FileHeaderContext; using search::diskindex::DocIdMapping; using search::diskindex::WordNumMapping; -using search::PostingPriorityQueue; using search::docsummary::DocumentSummary; +using search::index::PostingListParams; +using search::index::Schema; +using search::index::SchemaUtil; +using search::index::schema::DataType; using vespalib::getLastErrorString; @@ -400,7 +401,7 @@ Fusion::ReadMappingFiles(const SchemaUtil::IndexIterator *index) std::vector<uint32_t> oldIndexes; const Schema &oldSchema = oi.getSchema(); if (!SchemaUtil::getIndexIds(oldSchema, - index::schema::STRING, + DataType::STRING, oldIndexes)) return false; if (oldIndexes.empty()) { diff --git a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp index 888bfcff1e4..20d8a045efb 100644 --- a/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/indexbuilder.cpp @@ -19,12 +19,13 @@ namespace diskindex { namespace { +using common::FileHeaderContext; using index::DocIdAndFeatures; using index::PostingListCounts; using index::Schema; using index::SchemaUtil; using index::WordDocElementFeatures; -using common::FileHeaderContext; +using index::schema::DataType; using vespalib::getLastErrorString; static uint32_t @@ -543,7 +544,7 @@ IndexBuilder::IndexBuilder(const Schema &schema) const Schema::IndexField &iField = schema.getIndexField(i); FieldHandle fh(schema, i, this); // Only know how to handle string index for now. - if (iField.getDataType() == index::schema::STRING) + if (iField.getDataType() == DataType::STRING) fh.setValid(); _fields.push_back(fh); } diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.h b/searchlib/src/vespa/searchlib/features/dotproductfeature.h index d25803a085b..4a30c0ecb1b 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.h +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.h @@ -156,7 +156,7 @@ public: protected: const A * _attribute; private: - virtual size_t getAttributeValues(uint32_t docid, const AT * & count); + virtual size_t getAttributeValues(uint32_t docid, const AT * & count) override; public: DotProductExecutor(const A * attribute, const V & queryVector); ~DotProductExecutor(); diff --git a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp index 5eb1fc24859..ef4ac1b4e56 100644 --- a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp @@ -8,6 +8,9 @@ LOG_SETUP(".features.elementsimilarity"); namespace search { + +using CollectionType = fef::FieldInfo::CollectionType; + namespace features { namespace { @@ -359,7 +362,7 @@ ElementSimilarityBlueprint::visitDumpFeatures(const fef::IIndexEnvironment &env, for (uint32_t i = 0; i < env.getNumFields(); ++i) { const fef::FieldInfo &field = *env.getField(i); if ((field.type() == fef::FieldType::INDEX) && - (field.collection() != fef::CollectionType::SINGLE) && + (field.collection() != CollectionType::SINGLE) && ( ! field.isFilter())) { fef::FeatureNameBuilder fnb; diff --git a/searchlib/src/vespa/searchlib/features/fieldmatchfeature.cpp b/searchlib/src/vespa/searchlib/features/fieldmatchfeature.cpp index a1450d419c3..3fd33589a66 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatchfeature.cpp @@ -16,6 +16,7 @@ LOG_SETUP(".features.fieldmatchfeature"); #include <vespa/vespalib/util/stringfmt.h> using namespace search::fef; +using CollectionType = FieldInfo::CollectionType; namespace search { namespace features { @@ -113,7 +114,7 @@ FieldMatchBlueprint::visitDumpFeatures(const IIndexEnvironment & env, for (uint32_t i = 0; i < env.getNumFields(); ++i) { const search::fef::FieldInfo * field = env.getField(i); if (field->type() == search::fef::FieldType::INDEX && - field->collection() == search::fef::CollectionType::SINGLE) + field->collection() == CollectionType::SINGLE) { FeatureNameBuilder fnb; fnb.baseName(getBaseName()).parameter(field->name()); diff --git a/searchlib/src/vespa/searchlib/features/matchfeature.cpp b/searchlib/src/vespa/searchlib/features/matchfeature.cpp index ca14e55232f..cb006c194d7 100644 --- a/searchlib/src/vespa/searchlib/features/matchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/matchfeature.cpp @@ -13,6 +13,7 @@ LOG_SETUP(".features.matchfeature"); #include "utils.h" using namespace search::fef; +using CollectionType = FieldInfo::CollectionType; namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/raw_score_feature.h b/searchlib/src/vespa/searchlib/features/raw_score_feature.h index 70ef8170def..ddae8848052 100644 --- a/searchlib/src/vespa/searchlib/features/raw_score_feature.h +++ b/searchlib/src/vespa/searchlib/features/raw_score_feature.h @@ -17,7 +17,7 @@ private: virtual void handle_bind_match_data(fef::MatchData &md) override; public: RawScoreExecutor(const search::fef::IQueryEnvironment &env, uint32_t fieldId); - virtual void execute(uint32_t docId); + virtual void execute(uint32_t docId) override; }; //----------------------------------------------------------------------------- @@ -29,15 +29,15 @@ private: public: RawScoreBlueprint() : Blueprint("rawScore"), _field(0) {} virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &, - search::fef::IDumpFeatureVisitor &) const {} - virtual search::fef::Blueprint::UP createInstance() const { + search::fef::IDumpFeatureVisitor &) const override {} + virtual search::fef::Blueprint::UP createInstance() const override { return Blueprint::UP(new RawScoreBlueprint()); } - virtual search::fef::ParameterDescriptions getDescriptions() const { + virtual search::fef::ParameterDescriptions getDescriptions() const override { return search::fef::ParameterDescriptions().desc().field(); } virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms); + const search::fef::ParameterList ¶ms) override; virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; diff --git a/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h b/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h index d05b0b86196..7dad54e65d5 100644 --- a/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h +++ b/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h @@ -33,7 +33,7 @@ public: */ ReverseProximityExecutor(const search::fef::IQueryEnvironment &env, const ReverseProximityConfig &config); - virtual void execute(uint32_t docId); + virtual void execute(uint32_t docId) override; private: const ReverseProximityConfig &_config; // The proximity config. @@ -56,19 +56,19 @@ public: // Inherit doc from Blueprint. virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const; + search::fef::IDumpFeatureVisitor &visitor) const override; // Inherit doc from Blueprint. - virtual search::fef::Blueprint::UP createInstance() const; + virtual search::fef::Blueprint::UP createInstance() const override; // Inherit doc from Blueprint. - virtual search::fef::ParameterDescriptions getDescriptions() const { + virtual search::fef::ParameterDescriptions getDescriptions() const override { return search::fef::ParameterDescriptions().desc().indexField(search::fef::ParameterCollection::ANY).number().number(); } // Inherit doc from Blueprint. virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params); + const search::fef::ParameterList & params) override; // Inherit doc from Blueprint. virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; diff --git a/searchlib/src/vespa/searchlib/features/subqueries_feature.h b/searchlib/src/vespa/searchlib/features/subqueries_feature.h index a62131040a0..217548b3e96 100644 --- a/searchlib/src/vespa/searchlib/features/subqueries_feature.h +++ b/searchlib/src/vespa/searchlib/features/subqueries_feature.h @@ -17,7 +17,7 @@ class SubqueriesExecutor : public search::fef::FeatureExecutor { public: SubqueriesExecutor(const search::fef::IQueryEnvironment &env, uint32_t fieldId); - virtual void execute(uint32_t docId); + virtual void execute(uint32_t docId) override; }; //----------------------------------------------------------------------------- @@ -29,15 +29,15 @@ private: public: SubqueriesBlueprint() : Blueprint("subqueries"), _field(nullptr) {} virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &, - search::fef::IDumpFeatureVisitor &) const {} - virtual search::fef::Blueprint::UP createInstance() const { + search::fef::IDumpFeatureVisitor &) const override {} + virtual search::fef::Blueprint::UP createInstance() const override { return Blueprint::UP(new SubqueriesBlueprint); } - virtual search::fef::ParameterDescriptions getDescriptions() const { + virtual search::fef::ParameterDescriptions getDescriptions() const override { return search::fef::ParameterDescriptions().desc().field(); } virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms); + const search::fef::ParameterList ¶ms) override; virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h index df575c246ea..eba2a9f44ae 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h +++ b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h @@ -34,7 +34,7 @@ public: { _attrBuffer.allocate(_attribute->getMaxValueCount()); } - virtual void execute(uint32_t docId); + virtual void execute(uint32_t docId) override; }; template <typename WeightedBufferType> diff --git a/searchlib/src/vespa/searchlib/features/term_field_md_feature.h b/searchlib/src/vespa/searchlib/features/term_field_md_feature.h index 563fadf98b4..ef3d83de98d 100644 --- a/searchlib/src/vespa/searchlib/features/term_field_md_feature.h +++ b/searchlib/src/vespa/searchlib/features/term_field_md_feature.h @@ -20,7 +20,7 @@ class TermFieldMdExecutor : public fef::FeatureExecutor { std::vector<Element> _terms; const fef::MatchData *_md; - virtual void execute(uint32_t docId); + virtual void execute(uint32_t docId) override; virtual void handle_bind_match_data(fef::MatchData &md) override; public: @@ -39,19 +39,19 @@ public: // Inherit doc from Blueprint. virtual void visitDumpFeatures(const fef::IIndexEnvironment & env, - fef::IDumpFeatureVisitor & visitor) const; + fef::IDumpFeatureVisitor & visitor) const override; // Inherit doc from Blueprint. - virtual fef::Blueprint::UP createInstance() const; + virtual fef::Blueprint::UP createInstance() const override; // Inherit doc from Blueprint. - virtual fef::ParameterDescriptions getDescriptions() const { + virtual fef::ParameterDescriptions getDescriptions() const override { return fef::ParameterDescriptions().desc().field(); } // Inherit doc from Blueprint. virtual bool setup(const fef::IIndexEnvironment & env, - const fef::ParameterList & params); + const fef::ParameterList & params) override; // Inherit doc from Blueprint. virtual fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment & env, vespalib::Stash &stash) const override; diff --git a/searchlib/src/vespa/searchlib/features/termdistancefeature.h b/searchlib/src/vespa/searchlib/features/termdistancefeature.h index 28b9c4478ed..ed79a51c199 100644 --- a/searchlib/src/vespa/searchlib/features/termdistancefeature.h +++ b/searchlib/src/vespa/searchlib/features/termdistancefeature.h @@ -36,7 +36,7 @@ private: public: TermDistanceExecutor(const search::fef::IQueryEnvironment & env, const TermDistanceParams & params); - virtual void execute(uint32_t docId); + virtual void execute(uint32_t docId) override; bool valid() const; }; @@ -53,19 +53,19 @@ public: // Inherit doc from Blueprint. virtual void visitDumpFeatures(const search::fef::IIndexEnvironment & env, - search::fef::IDumpFeatureVisitor & visitor) const; + search::fef::IDumpFeatureVisitor & visitor) const override; // Inherit doc from Blueprint. - virtual search::fef::Blueprint::UP createInstance() const; + virtual search::fef::Blueprint::UP createInstance() const override; // Inherit doc from Blueprint. - virtual search::fef::ParameterDescriptions getDescriptions() const { + virtual search::fef::ParameterDescriptions getDescriptions() const override { return search::fef::ParameterDescriptions().desc().indexField(search::fef::ParameterCollection::ANY).number().number(); } // Inherit doc from Blueprint. virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params); + const search::fef::ParameterList & params) override; // Inherit doc from Blueprint. virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; diff --git a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h index 9cf4678fe15..26faaae4b93 100644 --- a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h +++ b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h @@ -80,7 +80,7 @@ public: * * @param docid local document id to be evaluated */ - virtual void execute(uint32_t docId); + virtual void execute(uint32_t docId) override; private: /** @@ -114,16 +114,16 @@ public: // Inherit doc from Blueprint. virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const; + search::fef::IDumpFeatureVisitor &visitor) const override; // Inherit doc from Blueprint. - virtual search::fef::Blueprint::UP createInstance() const; + virtual search::fef::Blueprint::UP createInstance() const override; // Inherit doc from Blueprint. virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; // Inherit doc from Blueprint. - virtual search::fef::ParameterDescriptions getDescriptions() const { + virtual search::fef::ParameterDescriptions getDescriptions() const override { return search::fef::ParameterDescriptions().desc().indexField(search::fef::ParameterCollection::SINGLE); } @@ -144,7 +144,7 @@ public: * @return Whether or not setup was possible. */ virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params); + const search::fef::ParameterList & params) override; private: TermEditDistanceConfig _config; // The config for this blueprint. diff --git a/searchlib/src/vespa/searchlib/features/termfeature.h b/searchlib/src/vespa/searchlib/features/termfeature.h index 8dcef37d714..cb4b92dfc11 100644 --- a/searchlib/src/vespa/searchlib/features/termfeature.h +++ b/searchlib/src/vespa/searchlib/features/termfeature.h @@ -23,7 +23,7 @@ public: */ TermExecutor(const search::fef::IQueryEnvironment &env, uint32_t termId); - virtual void execute(uint32_t docId); + virtual void execute(uint32_t docId) override; private: const search::fef::ITermData *_termData; @@ -43,19 +43,19 @@ public: // Inherit doc from Blueprint. virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const; + search::fef::IDumpFeatureVisitor &visitor) const override; // Inherit doc from Blueprint. - virtual search::fef::Blueprint::UP createInstance() const; + virtual search::fef::Blueprint::UP createInstance() const override; // Inherit doc from Blueprint. - virtual search::fef::ParameterDescriptions getDescriptions() const { + virtual search::fef::ParameterDescriptions getDescriptions() const override { return search::fef::ParameterDescriptions().desc().number(); } // Inherit doc from Blueprint. virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params); + const search::fef::ParameterList & params) override; // Inherit doc from Blueprint. virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; diff --git a/searchlib/src/vespa/searchlib/features/terminfofeature.h b/searchlib/src/vespa/searchlib/features/terminfofeature.h index 975721d6797..7f1d8b8a6e2 100644 --- a/searchlib/src/vespa/searchlib/features/terminfofeature.h +++ b/searchlib/src/vespa/searchlib/features/terminfofeature.h @@ -18,13 +18,13 @@ private: public: TermInfoBlueprint(); virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &indexEnv, - search::fef::IDumpFeatureVisitor &visitor) const; - virtual search::fef::Blueprint::UP createInstance() const { return search::fef::Blueprint::UP(new TermInfoBlueprint()); } - virtual search::fef::ParameterDescriptions getDescriptions() const { + search::fef::IDumpFeatureVisitor &visitor) const override; + virtual search::fef::Blueprint::UP createInstance() const override { return search::fef::Blueprint::UP(new TermInfoBlueprint()); } + virtual search::fef::ParameterDescriptions getDescriptions() const override { return search::fef::ParameterDescriptions().desc().number(); } virtual bool setup(const search::fef::IIndexEnvironment & env, - const search::fef::ParameterList & params); + const search::fef::ParameterList & params) override; virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &queryEnv, vespalib::Stash &stash) const override; }; diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp index 036aabfca59..8340019cb02 100644 --- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp @@ -6,6 +6,9 @@ LOG_SETUP(".features.textsimilarity"); #include "text_similarity_feature.h" namespace search { + +using CollectionType = fef::FieldInfo::CollectionType; + namespace features { namespace { @@ -181,7 +184,7 @@ TextSimilarityBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment for (uint32_t i = 0; i < env.getNumFields(); ++i) { const search::fef::FieldInfo &field = *env.getField(i); if (field.type() == search::fef::FieldType::INDEX) { - if (!field.isFilter() && field.collection() == fef::CollectionType::SINGLE) { + if (!field.isFilter() && field.collection() == CollectionType::SINGLE) { search::fef::FeatureNameBuilder fnb; fnb.baseName(getBaseName()).parameter(field.name()); visitor.visitDumpFeature(fnb.output(score_output).buildName()); diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.h b/searchlib/src/vespa/searchlib/features/text_similarity_feature.h index 6129e285fe5..084d1dd4b1c 100644 --- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.h +++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.h @@ -41,8 +41,8 @@ private: public: TextSimilarityExecutor(const search::fef::IQueryEnvironment &env, uint32_t field_id); - virtual bool isPure() { return _handles.empty(); } - virtual void execute(uint32_t docId); + virtual bool isPure() override { return _handles.empty(); } + virtual void execute(uint32_t docId) override; }; //----------------------------------------------------------------------------- @@ -61,13 +61,13 @@ private: public: TextSimilarityBlueprint(); virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const; - virtual search::fef::Blueprint::UP createInstance() const; - virtual search::fef::ParameterDescriptions getDescriptions() const { + search::fef::IDumpFeatureVisitor &visitor) const override; + virtual search::fef::Blueprint::UP createInstance() const override; + virtual search::fef::ParameterDescriptions getDescriptions() const override { return search::fef::ParameterDescriptions().desc().indexField(search::fef::ParameterCollection::SINGLE); } virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms); + const search::fef::ParameterList ¶ms) override; virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; diff --git a/searchlib/src/vespa/searchlib/fef/CMakeLists.txt b/searchlib/src/vespa/searchlib/fef/CMakeLists.txt index 971fbd542e7..ec4a9e138dc 100644 --- a/searchlib/src/vespa/searchlib/fef/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/fef/CMakeLists.txt @@ -4,7 +4,6 @@ vespa_add_library(searchlib_fef OBJECT blueprint.cpp blueprintfactory.cpp blueprintresolver.cpp - collection_type.cpp feature_type.cpp featureexecutor.cpp featurenamebuilder.cpp @@ -14,7 +13,6 @@ vespa_add_library(searchlib_fef OBJECT fef.cpp fieldinfo.cpp fieldpositionsiterator.cpp - fieldtype.cpp filetablefactory.cpp functiontablefactory.cpp indexproperties.cpp diff --git a/searchlib/src/vespa/searchlib/fef/collection_type.cpp b/searchlib/src/vespa/searchlib/fef/collection_type.cpp deleted file mode 100644 index c5b31a4bd0c..00000000000 --- a/searchlib/src/vespa/searchlib/fef/collection_type.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/fastos/fastos.h> -#include "collection_type.h" - -namespace search { -namespace fef { - -CollectionType::CollectionType(uint32_t value) - : _value(value) -{ -} - -const CollectionType CollectionType::SINGLE(1); - -const CollectionType CollectionType::ARRAY(2); - -const CollectionType CollectionType::WEIGHTEDSET(3); - -} // namespace fef -} // namespace search diff --git a/searchlib/src/vespa/searchlib/fef/collection_type.h b/searchlib/src/vespa/searchlib/fef/collection_type.h deleted file mode 100644 index 55c9a7a143c..00000000000 --- a/searchlib/src/vespa/searchlib/fef/collection_type.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -namespace search { -namespace fef { - -/** - * Typesafe enum used to indicate the collection type of a field. - **/ -class CollectionType -{ -private: - uint32_t _value; - - CollectionType(uint32_t value); -public: - /** - * Indicating that the field is single-value - **/ - static const CollectionType SINGLE; - - /** - * Indicating that the field is multi-value without element weights - **/ - static const CollectionType ARRAY; - - /** - * Indicating that the field is multi-value with element weights - **/ - static const CollectionType WEIGHTEDSET; - - /** - * Less than operator; needed to be handled as a value by the standard library. - **/ - bool operator<(const CollectionType &rhs) const { return (_value < rhs._value); } - - /** - * Check if two collection types are equal. - **/ - bool operator==(const CollectionType &rhs) const { return (_value == rhs._value); } - - /** - * Check if two collection types are not equal. - **/ - bool operator!=(const CollectionType &rhs) const { return (_value != rhs._value); } -}; - -} // namespace fef -} // namespace search - diff --git a/searchlib/src/vespa/searchlib/fef/fef.h b/searchlib/src/vespa/searchlib/fef/fef.h index 9e6f97d3be4..18e86f319db 100644 --- a/searchlib/src/vespa/searchlib/fef/fef.h +++ b/searchlib/src/vespa/searchlib/fef/fef.h @@ -16,7 +16,6 @@ #include "blueprint.h" #include "blueprintfactory.h" #include "blueprintresolver.h" -#include "collection_type.h" #include "featureexecutor.h" #include "featurenamebuilder.h" #include "featurenameparser.h" diff --git a/searchlib/src/vespa/searchlib/fef/fieldinfo.h b/searchlib/src/vespa/searchlib/fef/fieldinfo.h index ca6796a49d0..19b77f2ab32 100644 --- a/searchlib/src/vespa/searchlib/fef/fieldinfo.h +++ b/searchlib/src/vespa/searchlib/fef/fieldinfo.h @@ -4,7 +4,6 @@ #include <vespa/vespalib/stllike/string.h> #include "fieldtype.h" -#include "collection_type.h" #include <vespa/searchcommon/common/datatype.h> namespace search { @@ -19,6 +18,7 @@ const uint32_t IllegalFieldId = 0xffffffff; class FieldInfo { public: + using CollectionType = search::index::schema::CollectionType; using DataType = search::index::schema::DataType; typedef vespalib::string string; private: diff --git a/searchlib/src/vespa/searchlib/fef/fieldtype.cpp b/searchlib/src/vespa/searchlib/fef/fieldtype.cpp deleted file mode 100644 index 39cb1be7997..00000000000 --- a/searchlib/src/vespa/searchlib/fef/fieldtype.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/fastos/fastos.h> -#include "fieldtype.h" - -namespace search { -namespace fef { - -FieldType::FieldType(uint32_t value) - : _value(value) -{ -} - -const FieldType FieldType::INDEX(1); - -const FieldType FieldType::ATTRIBUTE(2); - -const FieldType FieldType::HIDDEN_ATTRIBUTE(3); - -} // namespace fef -} // namespace search diff --git a/searchlib/src/vespa/searchlib/fef/fieldtype.h b/searchlib/src/vespa/searchlib/fef/fieldtype.h index 8b1b17f9801..ab918baa293 100644 --- a/searchlib/src/vespa/searchlib/fef/fieldtype.h +++ b/searchlib/src/vespa/searchlib/fef/fieldtype.h @@ -6,44 +6,12 @@ namespace search { namespace fef { /** - * Typesafe enum used to indicate the type of a field. + * Scoped and typesafe enum used to indicate the type of a field. **/ -class FieldType -{ -private: - uint32_t _value; - - FieldType(uint32_t value); -public: - /** - * Indicating that the field is indexed - **/ - static const FieldType INDEX; - - /** - * Indicating that the field is kept in an attribute vector - **/ - static const FieldType ATTRIBUTE; - - /** - * Indicating that the field is kept in an attribute vector - **/ - static const FieldType HIDDEN_ATTRIBUTE; - - /** - * Less than operator; needed to be handled as a value by the standard library. - **/ - bool operator<(const FieldType &rhs) const { return (_value < rhs._value); } - - /** - * Check if two field types are equal. - **/ - bool operator==(const FieldType &rhs) const { return (_value == rhs._value); } - - /** - * Check if two field types are not equal. - **/ - bool operator!=(const FieldType &rhs) const { return (_value != rhs._value); } +enum class FieldType { + INDEX = 1, + ATTRIBUTE = 2, + HIDDEN_ATTRIBUTE = 3 }; } // namespace fef diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp index 8f6ea9db453..7e149d4b422 100644 --- a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp +++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp @@ -12,6 +12,8 @@ using vespalib::make_vespa_string; namespace search { namespace fef { +using CollectionType = FieldInfo::CollectionType; + namespace { bool checkCollectionType(ParameterCollection::Enum accept, CollectionType actual) { diff --git a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp index 17e405bef7e..9df22f4c17f 100644 --- a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp @@ -352,7 +352,7 @@ FtTestApp::setupFieldMatch(FtFeatureTest & ft, const vespalib::string & indexNam const fieldmatch::Params * params, uint32_t totalTermWeight, feature_t totalSignificance, uint32_t docId) { - ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, CollectionType::SINGLE, indexName); + ft.getIndexEnv().getBuilder().addField(FieldType::INDEX, FieldInfo::CollectionType::SINGLE, indexName); if (params != NULL) { Properties & p = ft.getIndexEnv().getProperties(); diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp index 4682dbfe00f..dbe3ea52078 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp @@ -14,7 +14,7 @@ IndexEnvironmentBuilder::IndexEnvironmentBuilder(IndexEnvironment &env) : IndexEnvironmentBuilder & IndexEnvironmentBuilder::addField(const FieldType &type, - const CollectionType &coll, + const FieldInfo::CollectionType &coll, const vespalib::string &name) { uint32_t idx = _env.getFields().size(); diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h index 15640eb7bfe..46cccc7eb6f 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.h @@ -27,7 +27,7 @@ public: * @param name The name of the field. */ IndexEnvironmentBuilder &addField(const FieldType &type, - const CollectionType &coll, + const FieldInfo::CollectionType &coll, const vespalib::string &name); /** Returns a reference to the index environment of this. */ diff --git a/searchlib/src/vespa/searchlib/index/docbuilder.cpp b/searchlib/src/vespa/searchlib/index/docbuilder.cpp index 805dbba6c02..d06b867c00d 100644 --- a/searchlib/src/vespa/searchlib/index/docbuilder.cpp +++ b/searchlib/src/vespa/searchlib/index/docbuilder.cpp @@ -15,6 +15,8 @@ using namespace document; using namespace search::index; + +using search::index::schema::CollectionType; using vespalib::Utf8Reader; using vespalib::Utf8Writer; using vespalib::geo::ZCurve; @@ -24,8 +26,8 @@ namespace { void insertStr(const Schema::Field & sfield, document::FieldValue * fvalue, const vespalib::string & val) { - if (sfield.getDataType() == schema::STRING || - sfield.getDataType() == schema::RAW) + if (sfield.getDataType() == schema::DataType::STRING || + sfield.getDataType() == schema::DataType::RAW) { (dynamic_cast<LiteralFieldValueB *>(fvalue))->setValue(val); } else { @@ -36,13 +38,13 @@ insertStr(const Schema::Field & sfield, document::FieldValue * fvalue, const ves void insertInt(const Schema::Field & sfield, document::FieldValue * fvalue, int64_t val) { - if (sfield.getDataType() == schema::INT8) { + if (sfield.getDataType() == schema::DataType::INT8) { (dynamic_cast<ByteFieldValue *>(fvalue))->setValue((uint8_t)val); - } else if (sfield.getDataType() == schema::INT16) { + } else if (sfield.getDataType() == schema::DataType::INT16) { (dynamic_cast<ShortFieldValue *>(fvalue))->setValue((int16_t)val); - } else if (sfield.getDataType() == schema::INT32) { + } else if (sfield.getDataType() == schema::DataType::INT32) { (dynamic_cast<IntFieldValue *>(fvalue))->setValue((int32_t)val); - } else if (sfield.getDataType() == schema::INT64) { + } else if (sfield.getDataType() == schema::DataType::INT64) { (dynamic_cast<LongFieldValue *>(fvalue))->setValue(val); } else { throw DocBuilder::Error(vespalib::make_string("Field '%s' not compatible", sfield.getName().c_str())); @@ -52,9 +54,9 @@ insertInt(const Schema::Field & sfield, document::FieldValue * fvalue, int64_t v void insertFloat(const Schema::Field & sfield, document::FieldValue * fvalue, double val) { - if (sfield.getDataType() == schema::FLOAT) { + if (sfield.getDataType() == schema::DataType::FLOAT) { (dynamic_cast<FloatFieldValue *>(fvalue))->setValue((float)val); - } else if (sfield.getDataType() == schema::DOUBLE) { + } else if (sfield.getDataType() == schema::DataType::DOUBLE) { (dynamic_cast<DoubleFieldValue *>(fvalue))->setValue(val); } else { throw DocBuilder::Error(vespalib::make_string("Field '%s' not compatible", sfield.getName().c_str())); @@ -64,7 +66,7 @@ insertFloat(const Schema::Field & sfield, document::FieldValue * fvalue, double void insertPredicate(const Schema::Field &sfield, document::FieldValue *fvalue, std::unique_ptr<vespalib::Slime> val) { - if (sfield.getDataType() == schema::BOOLEANTREE) { + if (sfield.getDataType() == schema::DataType::BOOLEANTREE) { *(dynamic_cast<PredicateFieldValue *>(fvalue)) = PredicateFieldValue(std::move(val)); } else { @@ -77,7 +79,7 @@ void insertPredicate(const Schema::Field &sfield, void insertTensor(const Schema::Field &schemaField, document::FieldValue *fvalue, std::unique_ptr<vespalib::tensor::Tensor> val) { - if (schemaField.getDataType() == schema::TENSOR) { + if (schemaField.getDataType() == schema::DataType::TENSOR) { *(dynamic_cast<TensorFieldValue *>(fvalue)) = std::move(val); } else { throw DocBuilder::Error(vespalib::make_string( @@ -91,7 +93,7 @@ insertPosition(const Schema::Field & sfield, document::FieldValue * fvalue, int32_t xpos, int32_t ypos) { assert(*fvalue->getDataType() == *DataType::LONG); - assert(sfield.getDataType() == schema::INT64); + assert(sfield.getDataType() == schema::DataType::INT64); (void) sfield; int64_t zpos = ZCurve::encode(xpos, ypos); document::LongFieldValue *zvalue = @@ -105,7 +107,7 @@ insertRaw(const Schema::Field & sfield, document::FieldValue *fvalue, const void *buf, size_t len) { assert(*fvalue->getDataType() == *DataType::RAW); - assert(sfield.getDataType() == schema::RAW); + assert(sfield.getDataType() == schema::DataType::RAW); (void) sfield; document::RawFieldValue *rfvalue = dynamic_cast<RawFieldValue *>(fvalue); @@ -197,11 +199,11 @@ DocBuilder::CollectionFieldHandle::startElement(int32_t weight) void DocBuilder::CollectionFieldHandle::endElement() { - if (_sfield.getCollectionType() == schema::ARRAY) { + if (_sfield.getCollectionType() == CollectionType::ARRAY) { onEndElement(); ArrayFieldValue * value = dynamic_cast<ArrayFieldValue *>(_value.get()); value->add(*_element); - } else if (_sfield.getCollectionType() == schema::WEIGHTEDSET) { + } else if (_sfield.getCollectionType() == CollectionType::WEIGHTEDSET) { onEndElement(); WeightedSetFieldValue * value = dynamic_cast<WeightedSetFieldValue *>(_value.get()); value->add(*_element, _elementWeight); @@ -229,7 +231,7 @@ DocBuilder::IndexFieldHandle::IndexFieldHandle(const FixedTypeRepo & repo, const { _str.reserve(1023); - if (_sfield.getCollectionType() == schema::SINGLE) { + if (_sfield.getCollectionType() == CollectionType::SINGLE) { if (*_value->getDataType() == document::UrlDataType::getInstance()) _uriField = true; } else { @@ -412,7 +414,7 @@ DocBuilder::IndexFieldHandle::onEndElement(void) if (_uriField) return; StringFieldValue * value; - if (_sfield.getCollectionType() != schema::SINGLE) { + if (_sfield.getCollectionType() != CollectionType::SINGLE) { value = dynamic_cast<StringFieldValue *>(_element.get()); } else { value = dynamic_cast<StringFieldValue *>(_value.get()); @@ -439,7 +441,7 @@ DocBuilder::IndexFieldHandle::onEndElement(void) void DocBuilder::IndexFieldHandle::onEndField(void) { - if (_sfield.getCollectionType() == schema::SINGLE) + if (_sfield.getCollectionType() == CollectionType::SINGLE) onEndElement(); } @@ -483,7 +485,7 @@ DocBuilder::IndexFieldHandle::endSubField(void) assert(!_subField.empty()); assert(_uriField); StructuredFieldValue *sValue; - if (_sfield.getCollectionType() != schema::SINGLE) { + if (_sfield.getCollectionType() != CollectionType::SINGLE) { sValue = dynamic_cast<StructFieldValue *>(_element.get()); } else { sValue = dynamic_cast<StructFieldValue *>(_value.get()); diff --git a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp index 8b37645a306..cedc0372cd9 100644 --- a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp +++ b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp @@ -13,28 +13,28 @@ namespace { const DataType *convert(Schema::DataType type) { switch (type) { - case schema::UINT1: - case schema::UINT2: - case schema::UINT4: - case schema::INT8: + case schema::DataType::UINT1: + case schema::DataType::UINT2: + case schema::DataType::UINT4: + case schema::DataType::INT8: return DataType::BYTE; - case schema::INT16: + case schema::DataType::INT16: return DataType::SHORT; - case schema::INT32: + case schema::DataType::INT32: return DataType::INT; - case schema::INT64: + case schema::DataType::INT64: return DataType::LONG; - case schema::FLOAT: + case schema::DataType::FLOAT: return DataType::FLOAT; - case schema::DOUBLE: + case schema::DataType::DOUBLE: return DataType::DOUBLE; - case schema::STRING: + case schema::DataType::STRING: return DataType::STRING; - case schema::RAW: + case schema::DataType::RAW: return DataType::RAW; - case schema::BOOLEANTREE: + case schema::DataType::BOOLEANTREE: return DataType::PREDICATE; - case schema::TENSOR: + case schema::DataType::TENSOR: return DataType::TENSOR; default: break; @@ -88,7 +88,7 @@ DocTypeBuilder::UriField::valid(const Schema &schema, if (fieldId == Schema::UNKNOWN_FIELD_ID) return false; const Schema::IndexField &field = schema.getIndexField(fieldId); - if (field.getDataType() != schema::STRING) + if (field.getDataType() != schema::DataType::STRING) return false; if (field.getCollectionType() != collectionType) return false; @@ -209,7 +209,7 @@ DocTypeBuilder::SchemaIndexFields::setup(const Schema &schema) continue; const Schema::IndexField &field = schema.getIndexField(fieldId); switch (field.getDataType()) { - case schema::STRING: + case schema::DataType::STRING: _textFields.push_back(fieldId); break; default: @@ -230,9 +230,9 @@ using namespace document::config_builder; TypeOrId makeCollection(TypeOrId datatype, Schema::CollectionType collection_type) { switch (collection_type) { - case schema::ARRAY: + case schema::CollectionType::ARRAY: return Array(datatype); - case schema::WEIGHTEDSET: + case schema::CollectionType::WEIGHTEDSET: // TODO: consider using array of struct<primitive,int32> to keep order return Wset(datatype); default: @@ -241,11 +241,11 @@ TypeOrId makeCollection(TypeOrId datatype, } struct TypeCache { - std::map<std::pair<int, int>, TypeOrId> types; + std::map<std::pair<int, Schema::CollectionType>, TypeOrId> types; TypeOrId getType(TypeOrId datatype, Schema::CollectionType c_type) { TypeOrId type = makeCollection(datatype, c_type); - std::pair<int, int> key = std::make_pair(datatype.id, c_type); + std::pair<int, Schema::CollectionType> key = std::make_pair(datatype.id, c_type); if (types.find(key) == types.end()) { types.insert(std::make_pair(key, type)); } @@ -270,7 +270,7 @@ document::DocumenttypesConfig DocTypeBuilder::makeConfig() const { _schema.getIndexField(_iFields._textFields[i]); // only handles string fields for now - assert(field.getDataType() == schema::STRING); + assert(field.getDataType() == schema::DataType::STRING); header_struct.addField(field.getName(), type_cache.getType( DataType::T_STRING, field.getCollectionType())); header_struct.sstruct.field.back().id = field_id++; @@ -283,7 +283,7 @@ document::DocumenttypesConfig DocTypeBuilder::makeConfig() const { _schema.getIndexField(_iFields._uriFields[i]._all); // only handles string fields for now - assert(field.getDataType() == schema::STRING); + assert(field.getDataType() == schema::DataType::STRING); header_struct.addField(field.getName(), type_cache.getType( uri_type, field.getCollectionType())); header_struct.sstruct.field.back().id = field_id++; diff --git a/searchlib/src/vespa/searchlib/index/schemautil.cpp b/searchlib/src/vespa/searchlib/index/schemautil.cpp index 414ebe227d6..52c5a1caee4 100644 --- a/searchlib/src/vespa/searchlib/index/schemautil.cpp +++ b/searchlib/src/vespa/searchlib/index/schemautil.cpp @@ -11,12 +11,14 @@ namespace search { namespace index { +using schema::DataType; + SchemaUtil::IndexSettings SchemaUtil::getIndexSettings(const Schema &schema, const uint32_t index) { IndexSettings ret; - Schema::DataType indexDataType(schema::STRING); + Schema::DataType indexDataType(DataType::STRING); bool error = false; bool somePrefixes = false; bool someNotPrefixes = false; @@ -39,14 +41,9 @@ SchemaUtil::getIndexSettings(const Schema &schema, else someNotPositions = true; indexDataType = iField.getDataType(); - switch (indexDataType) { - case schema::STRING: - break; - default: + if (indexDataType != DataType::STRING) { error = true; - LOG(error, - "Field %s has bad data type", - iField.getName().c_str()); + LOG(error, "Field %s has bad data type", iField.getName().c_str()); } return IndexSettings(indexDataType, error, @@ -113,7 +110,7 @@ SchemaUtil::validateIndexField(const Schema::IndexField &field) field.getName().c_str()); ok = false; } - if (field.getDataType() != schema::STRING) { + if (field.getDataType() != DataType::STRING) { if (field.hasPrefix()) { LOG(error, "Field %s is non-string but has prefix", diff --git a/searchlib/src/vespa/searchlib/index/schemautil.h b/searchlib/src/vespa/searchlib/index/schemautil.h index d54e2c3e0f1..7c03886800e 100644 --- a/searchlib/src/vespa/searchlib/index/schemautil.h +++ b/searchlib/src/vespa/searchlib/index/schemautil.h @@ -31,7 +31,7 @@ public: bool hasPositions() const { return _positions; } IndexSettings() - : _dataType(schema::STRING), + : _dataType(schema::DataType::STRING), _error(false), _prefix(false), _phrases(false), @@ -151,8 +151,8 @@ public: static bool validateIndexFieldType(schema::DataType dataType) { switch (dataType) { - case schema::STRING: - case schema::INT32: + case schema::DataType::STRING: + case schema::DataType::INT32: return true; default: ; diff --git a/searchlib/src/vespa/searchlib/memoryindex/fieldinverter.cpp b/searchlib/src/vespa/searchlib/memoryindex/fieldinverter.cpp index 29a7c1ac274..859aff99c0a 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/fieldinverter.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/fieldinverter.cpp @@ -22,29 +22,30 @@ namespace search { namespace memoryindex { -using document::Field; -using document::FieldValue; -using document::Document; +using document::AlternateSpanList; +using document::Annotation; +using document::AnnotationType; using document::ArrayFieldValue; -using document::WeightedSetFieldValue; -using document::StringFieldValue; -using document::IntFieldValue; -using document::StructFieldValue; using document::DataType; +using document::Document; using document::DocumentType; -using document::Annotation; -using document::AnnotationType; -using document::AlternateSpanList; +using document::Field; +using document::FieldValue; +using document::IntFieldValue; +using document::SimpleSpanList; using document::Span; using document::SpanList; -using document::SimpleSpanList; using document::SpanNode; using document::SpanTree; using document::SpanTreeVisitor; +using document::StringFieldValue; +using document::StructFieldValue; +using document::WeightedSetFieldValue; using index::DocIdAndPosOccFeatures; using index::Schema; -using vespalib::make_string; +using search::index::schema::CollectionType; using search::util::URL; +using vespalib::make_string; namespace documentinverterkludge { @@ -427,14 +428,14 @@ FieldInverter::invertNormalDocTextField(const FieldValue &val) const vespalib::Identifiable::RuntimeClass & cInfo(val.getClass()); const Schema::IndexField &field = _schema.getIndexField(_fieldId); switch (field.getCollectionType()) { - case index::schema::SINGLE: + case CollectionType::SINGLE: if (cInfo.id() == StringFieldValue::classId) { processNormalDocTextField(static_cast<const StringFieldValue &>(val)); } else { throw std::runtime_error(make_string("Expected DataType::STRING, got '%s'", val.getDataType()->getName().c_str())); } break; - case index::schema::WEIGHTEDSET: + case CollectionType::WEIGHTEDSET: if (cInfo.id() == WeightedSetFieldValue::classId) { const WeightedSetFieldValue &wset = static_cast<const WeightedSetFieldValue &>(val); if (wset.getNestedType() == *DataType::STRING) { @@ -446,7 +447,7 @@ FieldInverter::invertNormalDocTextField(const FieldValue &val) throw std::runtime_error(make_string("Expected weighted set, got '%s'", cInfo.name())); } break; - case index::schema::ARRAY: + case CollectionType::ARRAY: if (cInfo.id() == ArrayFieldValue::classId) { const ArrayFieldValue &arr = static_cast<const ArrayFieldValue&>(val); if (arr.getNestedType() == *DataType::STRING) { diff --git a/searchlib/src/vespa/searchlib/memoryindex/urlfieldinverter.cpp b/searchlib/src/vespa/searchlib/memoryindex/urlfieldinverter.cpp index 5629302804e..ab59718d064 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/urlfieldinverter.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/urlfieldinverter.cpp @@ -56,6 +56,7 @@ using document::StructFieldValue; using document::UrlDataType; using document::WeightedSetFieldValue; using search::index::Schema; +using search::index::schema::CollectionType; using search::util::URL; using vespalib::make_string; @@ -304,7 +305,7 @@ UrlFieldInverter::invertUrlField(const FieldValue &val) { const vespalib::Identifiable::RuntimeClass & cInfo(val.getClass()); switch (_collectionType) { - case index::schema::SINGLE: + case CollectionType::SINGLE: if (isUriType(*val.getDataType())) { startElement(1); processUrlField(val); @@ -313,7 +314,7 @@ UrlFieldInverter::invertUrlField(const FieldValue &val) throw std::runtime_error(make_string("Expected URI struct, got '%s'", val.getDataType()->getName().c_str())); } break; - case index::schema::WEIGHTEDSET: + case CollectionType::WEIGHTEDSET: if (cInfo.id() == WeightedSetFieldValue::classId) { const WeightedSetFieldValue &wset = static_cast<const WeightedSetFieldValue &>(val); if (isUriType(wset.getNestedType())) { @@ -325,7 +326,7 @@ UrlFieldInverter::invertUrlField(const FieldValue &val) throw std::runtime_error(make_string("Expected weighted set, got '%s'", cInfo.name())); } break; - case index::schema::ARRAY: + case CollectionType::ARRAY: if (cInfo.id() == ArrayFieldValue::classId) { const ArrayFieldValue &arr = static_cast<const ArrayFieldValue&>(val); if (isUriType(arr.getNestedType())) { diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h index a79f1f104be..8130c35dc2c 100644 --- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h +++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h @@ -113,30 +113,30 @@ public: void illegalVisit() {} - virtual void visit(search::query::And &) { illegalVisit(); } - virtual void visit(search::query::AndNot &) { illegalVisit(); } - virtual void visit(search::query::Equiv &) { illegalVisit(); } - virtual void visit(search::query::Near &) { illegalVisit(); } - virtual void visit(search::query::ONear &) { illegalVisit(); } - virtual void visit(search::query::Or &) { illegalVisit(); } - virtual void visit(search::query::Rank &) { illegalVisit(); } - virtual void visit(search::query::WeakAnd &) { illegalVisit(); } - - virtual void visit(search::query::Phrase &n) { + virtual void visit(search::query::And &) override { illegalVisit(); } + virtual void visit(search::query::AndNot &) override { illegalVisit(); } + virtual void visit(search::query::Equiv &) override { illegalVisit(); } + virtual void visit(search::query::Near &) override { illegalVisit(); } + virtual void visit(search::query::ONear &) override { illegalVisit(); } + virtual void visit(search::query::Or &) override { illegalVisit(); } + virtual void visit(search::query::Rank &) override { illegalVisit(); } + virtual void visit(search::query::WeakAnd &) override { illegalVisit(); } + + virtual void visit(search::query::Phrase &n) override { visitPhrase(n); } - virtual void visit(search::query::WeightedSetTerm &n) { visitWeightedSetTerm(n); } - virtual void visit(search::query::DotProduct &n) { visitDotProduct(n); } - virtual void visit(search::query::WandTerm &n) { visitWandTerm(n); } - - virtual void visit(search::query::NumberTerm &n) = 0; - virtual void visit(search::query::LocationTerm &n) = 0; - virtual void visit(search::query::PrefixTerm &n) = 0; - virtual void visit(search::query::RangeTerm &n) = 0; - virtual void visit(search::query::StringTerm &n) = 0; - virtual void visit(search::query::SubstringTerm &n) = 0; - virtual void visit(search::query::SuffixTerm &n) = 0; - virtual void visit(search::query::RegExpTerm &n) = 0; + virtual void visit(search::query::WeightedSetTerm &n) override { visitWeightedSetTerm(n); } + virtual void visit(search::query::DotProduct &n) override { visitDotProduct(n); } + virtual void visit(search::query::WandTerm &n) override { visitWandTerm(n); } + + virtual void visit(search::query::NumberTerm &n) override = 0; + virtual void visit(search::query::LocationTerm &n) override = 0; + virtual void visit(search::query::PrefixTerm &n) override = 0; + virtual void visit(search::query::RangeTerm &n) override = 0; + virtual void visit(search::query::StringTerm &n) override = 0; + virtual void visit(search::query::SubstringTerm &n) override = 0; + virtual void visit(search::query::SuffixTerm &n) override = 0; + virtual void visit(search::query::RegExpTerm &n) override = 0; }; } // namespace search::queryeval diff --git a/searchlib/src/vespa/searchlib/queryeval/equivsearch.cpp b/searchlib/src/vespa/searchlib/queryeval/equivsearch.cpp index 841466d3e67..6732f37482d 100644 --- a/searchlib/src/vespa/searchlib/queryeval/equivsearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/equivsearch.cpp @@ -17,7 +17,7 @@ private: bool _valid; protected: - virtual void doUnpack(uint32_t docid); + virtual void doUnpack(uint32_t docid) override; public: /** diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_search.h b/searchlib/src/vespa/searchlib/queryeval/fake_search.h index b360cdd76e7..3ba3d2cf439 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/fake_search.h @@ -34,10 +34,10 @@ public: { assert(_tfmda.size() == 1); } - virtual void doSeek(uint32_t docid); - virtual void doUnpack(uint32_t docid); - virtual const PostingInfo *getPostingInfo() const { return _result.postingInfo(); } - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + virtual void doSeek(uint32_t docid) override; + virtual void doUnpack(uint32_t docid) override; + virtual const PostingInfo *getPostingInfo() const override { return _result.postingInfo(); } + virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; }; } // namespace queryeval diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp index 283c15fd970..9e7e7ed6c9a 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp @@ -54,15 +54,15 @@ public: template <class TermNode> void visitTerm(TermNode &n); - virtual void visit(NumberTerm &n) { visitTerm(n); } - virtual void visit(LocationTerm &n) { visitTerm(n); } - virtual void visit(PrefixTerm &n) { visitTerm(n); } - virtual void visit(RangeTerm &n) { visitTerm(n); } - virtual void visit(StringTerm &n) { visitTerm(n); } - virtual void visit(SubstringTerm &n) { visitTerm(n); } - virtual void visit(SuffixTerm &n) { visitTerm(n); } - virtual void visit(PredicateQuery &n) { visitTerm(n); } - virtual void visit(RegExpTerm &n) { visitTerm(n); } + virtual void visit(NumberTerm &n) override { visitTerm(n); } + virtual void visit(LocationTerm &n) override { visitTerm(n); } + virtual void visit(PrefixTerm &n) override { visitTerm(n); } + virtual void visit(RangeTerm &n) override { visitTerm(n); } + virtual void visit(StringTerm &n) override { visitTerm(n); } + virtual void visit(SubstringTerm &n) override { visitTerm(n); } + virtual void visit(SuffixTerm &n) override { visitTerm(n); } + virtual void visit(PredicateQuery &n) override { visitTerm(n); } + virtual void visit(RegExpTerm &n) override { visitTerm(n); } }; template <class Map> diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h index 26a8258713d..34b6e250797 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h +++ b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.h @@ -59,7 +59,7 @@ public: using Searchable::createBlueprint; virtual Blueprint::UP createBlueprint(const IRequestContext & requestContext, const FieldSpec &field, - const search::query::Node &term); + const search::query::Node &term) override; virtual ~FakeSearchable(); }; diff --git a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp index 544240daeff..9a91bf6e2b8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/get_weight_from_node.cpp @@ -31,7 +31,7 @@ struct WeightExtractor : public TemplateTermVisitor<WeightExtractor, } // Treat Equiv nodes as terms. - virtual void visit(search::query::Equiv &n) { visitTerm(n); } + virtual void visit(search::query::Equiv &n) override { visitTerm(n); } }; } // namespace search::queryeval::<unnamed> diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp index 8e221b33add..64776b99f16 100644 --- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp @@ -542,7 +542,7 @@ class FindSource : public Blueprint::IPredicate { public: FindSource(uint32_t sourceId) : _sourceId(sourceId) { } - virtual bool check(const Blueprint & bp) const { return bp.getSourceId() == _sourceId; } + virtual bool check(const Blueprint & bp) const override { return bp.getSourceId() == _sourceId; } private: uint32_t _sourceId; }; diff --git a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h index 436062383b4..d910499b463 100644 --- a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h +++ b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h @@ -82,14 +82,14 @@ public: vespalib::string toString() const { return _str; } // Overrides ObjectVisitor - virtual void openStruct(const vespalib::string &name, const vespalib::string &type); - virtual void closeStruct(); - virtual void visitBool(const vespalib::string &name, bool value); - virtual void visitInt(const vespalib::string &name, int64_t value); - virtual void visitFloat(const vespalib::string &name, double value); - virtual void visitString(const vespalib::string &name, const vespalib::string &value); - virtual void visitNull(const vespalib::string &name); - virtual void visitNotImplemented(); + virtual void openStruct(const vespalib::string &name, const vespalib::string &type) override; + virtual void closeStruct() override; + virtual void visitBool(const vespalib::string &name, bool value) override; + virtual void visitInt(const vespalib::string &name, int64_t value) override; + virtual void visitFloat(const vespalib::string &name, double value) override; + virtual void visitString(const vespalib::string &name, const vespalib::string &value) override; + virtual void visitNull(const vespalib::string &name) override; + virtual void visitNotImplemented() override; }; typedef std::unique_ptr<MonitoringSearchIterator> UP; @@ -115,7 +115,7 @@ public: SearchIterator::initRange(_search->getDocId()+1, _search->getEndId()); } Trinary is_strict() const override { return _search->is_strict(); } - virtual const PostingInfo *getPostingInfo() const; + virtual const PostingInfo *getPostingInfo() const override; void visitMembers(vespalib::ObjectVisitor &visitor) const override; const SearchIterator &getIterator() const { return *_search; } diff --git a/searchlib/src/vespa/searchlib/queryeval/nearsearch.h b/searchlib/src/vespa/searchlib/queryeval/nearsearch.h index 2cf737d41b0..6ba631abb16 100644 --- a/searchlib/src/vespa/searchlib/queryeval/nearsearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/nearsearch.h @@ -77,10 +77,10 @@ public: uint32_t window, bool strict); - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; // Inherit doc from SearchIterator. - virtual void doSeek(uint32_t docId); + virtual void doSeek(uint32_t docId) override; }; /** @@ -99,7 +99,7 @@ private: std::vector<Matcher> _matchers; // Inherit doc from NearSearchBase. - virtual bool match(uint32_t docId); + virtual bool match(uint32_t docId) override; public: /** @@ -133,7 +133,7 @@ private: std::vector<Matcher> _matchers; // Inherit doc from NearSearchBase. - virtual bool match(uint32_t docId); + virtual bool match(uint32_t docId) override; public: /** diff --git a/searchlib/src/vespa/searchlib/queryeval/orlikesearch.h b/searchlib/src/vespa/searchlib/queryeval/orlikesearch.h index 356519ea5e8..5a62cc5dedb 100644 --- a/searchlib/src/vespa/searchlib/queryeval/orlikesearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/orlikesearch.h @@ -52,16 +52,16 @@ public: _unpacker(unpacker) { } private: - virtual void onRemove(size_t index) { + virtual void onRemove(size_t index) override { _unpacker.onRemove(index); } - virtual void onInsert(size_t index) { + virtual void onInsert(size_t index) override { _unpacker.onInsert(index); } - virtual void doUnpack(uint32_t docid) { + virtual void doUnpack(uint32_t docid) override { _unpacker.unpack(docid, *this); } - virtual bool needUnpack(size_t index) const { + virtual bool needUnpack(size_t index) const override { return _unpacker.needUnpack(index); } Unpack _unpacker; diff --git a/searchlib/src/vespa/searchlib/queryeval/orsearch.h b/searchlib/src/vespa/searchlib/queryeval/orsearch.h index 3452ae1ab96..e75776d7161 100644 --- a/searchlib/src/vespa/searchlib/queryeval/orsearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/orsearch.h @@ -27,7 +27,7 @@ public: protected: OrSearch(const Children & children) : MultiSearch(children) { } private: - virtual bool isOr() const { return true; } + virtual bool isOr() const override { return true; } }; } // namespace queryeval diff --git a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h index 5d8e7d592fe..2d1f09da9c8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/simple_phrase_search.h @@ -49,9 +49,9 @@ public: std::vector<uint32_t> eval_order, fef::TermFieldMatchData &tmd, bool strict); - virtual void doSeek(uint32_t doc_id); - virtual void doUnpack(uint32_t doc_id); - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + virtual void doSeek(uint32_t doc_id) override; + virtual void doUnpack(uint32_t doc_id) override; + virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; SimplePhraseSearch & setDoom(const vespalib::Doom * doom) { _doom = doom; return *this; } }; diff --git a/searchlib/src/vespa/searchlib/queryeval/simplesearch.h b/searchlib/src/vespa/searchlib/queryeval/simplesearch.h index 523d4f9dedc..50553541e98 100644 --- a/searchlib/src/vespa/searchlib/queryeval/simplesearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/simplesearch.h @@ -23,8 +23,8 @@ private: SimpleSearch &operator=(const SimpleSearch &); protected: - virtual void doSeek(uint32_t docid); - virtual void doUnpack(uint32_t docid); + virtual void doSeek(uint32_t docid) override; + virtual void doUnpack(uint32_t docid) override; public: SimpleSearch(const SimpleResult &result); @@ -32,7 +32,7 @@ public: _tag = t; return *this; } - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; virtual ~SimpleSearch(); }; diff --git a/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp b/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp index e614b1990ef..07a7763d626 100644 --- a/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/termasstring.cpp @@ -78,29 +78,29 @@ struct TermAsStringVisitor : public QueryVisitor { isSet = false; } - virtual void visit(And &) { illegalVisit(); } - virtual void visit(AndNot &) { illegalVisit(); } - virtual void visit(Equiv &) { illegalVisit(); } - virtual void visit(Near &) { illegalVisit(); } - virtual void visit(ONear &) { illegalVisit(); } - virtual void visit(Or &) { illegalVisit(); } - virtual void visit(Phrase &) { illegalVisit(); } - virtual void visit(Rank &) { illegalVisit(); } - virtual void visit(WeakAnd &) { illegalVisit(); } - virtual void visit(WeightedSetTerm &) { illegalVisit(); } - virtual void visit(DotProduct &) { illegalVisit(); } - virtual void visit(WandTerm &) { illegalVisit(); } - - virtual void visit(NumberTerm &n) { visitTerm(n); } - virtual void visit(LocationTerm &n) { visitTerm(n); } - virtual void visit(PrefixTerm &n) { visitTerm(n); } - virtual void visit(RangeTerm &n) { visitTerm(n); } - virtual void visit(StringTerm &n) { visitTerm(n); } - virtual void visit(SubstringTerm &n) { visitTerm(n); } - virtual void visit(SuffixTerm &n) { visitTerm(n); } - virtual void visit(RegExpTerm &n) { visitTerm(n); } - - virtual void visit(PredicateQuery &) { illegalVisit(); } + virtual void visit(And &) override { illegalVisit(); } + virtual void visit(AndNot &) override { illegalVisit(); } + virtual void visit(Equiv &) override { illegalVisit(); } + virtual void visit(Near &) override { illegalVisit(); } + virtual void visit(ONear &) override { illegalVisit(); } + virtual void visit(Or &) override { illegalVisit(); } + virtual void visit(Phrase &) override { illegalVisit(); } + virtual void visit(Rank &) override { illegalVisit(); } + virtual void visit(WeakAnd &) override { illegalVisit(); } + virtual void visit(WeightedSetTerm &) override { illegalVisit(); } + virtual void visit(DotProduct &) override { illegalVisit(); } + virtual void visit(WandTerm &) override { illegalVisit(); } + + virtual void visit(NumberTerm &n) override { visitTerm(n); } + virtual void visit(LocationTerm &n) override { visitTerm(n); } + virtual void visit(PrefixTerm &n) override { visitTerm(n); } + virtual void visit(RangeTerm &n) override { visitTerm(n); } + virtual void visit(StringTerm &n) override { visitTerm(n); } + virtual void visit(SubstringTerm &n) override { visitTerm(n); } + virtual void visit(SuffixTerm &n) override { visitTerm(n); } + virtual void visit(RegExpTerm &n) override { visitTerm(n); } + + virtual void visit(PredicateQuery &) override { illegalVisit(); } }; } // namespace diff --git a/searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp b/searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp index 84051bd9ef2..dd497abc77d 100644 --- a/searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp @@ -38,7 +38,7 @@ struct TermwiseSearch : public SearchIterator { } } void doUnpack(uint32_t) override {} - void visitMembers(vespalib::ObjectVisitor &visitor) const { + void visitMembers(vespalib::ObjectVisitor &visitor) const override { visit(visitor, "search", *search); visit(visitor, "strict", IS_STRICT); } diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.cpp index fd07bcfef40..2fe27f8504b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.cpp @@ -59,8 +59,8 @@ public: virtual size_t get_num_terms() const override { return _terms.size(); } virtual int32_t get_term_weight(size_t idx) const override { return _terms.weight(idx); } virtual score_t get_max_score(size_t idx) const override { return _terms.maxScore(idx); } - const Terms &getTerms() const { return _terms.input_terms(); } - uint32_t getN() const { return _n; } + const Terms &getTerms() const override { return _terms.input_terms(); } + uint32_t getN() const override { return _n; } void doSeek(uint32_t docid) override { if (IS_STRICT) { seek_strict(docid); diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.h b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.h index 814e84c2d79..1c3059913e8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.h +++ b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_search.h @@ -15,7 +15,7 @@ struct WeakAndSearch : SearchIterator { virtual wand::score_t get_max_score(size_t idx) const = 0; virtual const Terms &getTerms() const = 0; virtual uint32_t getN() const = 0; - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + virtual void visitMembers(vespalib::ObjectVisitor &visitor) const override; static SearchIterator *createArrayWand(const Terms &terms, uint32_t n, bool strict); static SearchIterator *createHeapWand(const Terms &terms, uint32_t n, bool strict); static SearchIterator *create(const Terms &terms, uint32_t n, bool strict); diff --git a/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp b/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp index 7b7a2fd8e61..006f7ee8207 100644 --- a/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp +++ b/searchlib/src/vespa/searchlib/test/diskindex/testdiskindex.cpp @@ -7,9 +7,10 @@ namespace search { -using index::Schema; using index::DummyFileHeaderContext; +using index::Schema; using index::WordDocElementWordPosFeatures; +using index::schema::DataType; namespace diskindex { @@ -56,8 +57,8 @@ struct Builder void TestDiskIndex::buildSchema(void) { - _schema.addIndexField(Schema::IndexField("f1", index::schema::STRING)); - _schema.addIndexField(Schema::IndexField("f2", index::schema::STRING)); + _schema.addIndexField(Schema::IndexField("f1", DataType::STRING)); + _schema.addIndexField(Schema::IndexField("f2", DataType::STRING)); _schema.addFieldSet(Schema::FieldSet("c2"). addField("f1"). addField("f2")); diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp index dd1190f0945..c1f9baedb17 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.cpp @@ -792,7 +792,7 @@ public: ~FakeEGCompr64SkipFilterOcc(void); virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const; + createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; @@ -884,7 +884,7 @@ public: void doL2SkipSeek(uint32_t docid); void doL1SkipSeek(uint32_t docId); - void doUnpack(uint32_t docId); + void doUnpack(uint32_t docId) override; void doSeek(uint32_t docId) override; void initRange(uint32_t begin, uint32_t end) override; Trinary is_strict() const override { return Trinary::True; } diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.h index 333f029cd08..fb49bd22cda 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakeegcompr64filterocc.h @@ -37,8 +37,7 @@ protected: bool _bigEndian; private: - void - setup(const FakeWord &fw); + void setup(const FakeWord &fw); template <bool bigEndian> void @@ -59,60 +58,49 @@ public: /* * Size of posting list, in bits. */ - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; /* * Size of posting skip list, in bits. */ - size_t - skipBitSize(void) const; - - size_t - l1SkipBitSize(void) const; - - size_t - l2SkipBitSize(void) const; - - size_t - l3SkipBitSize(void) const; - - size_t - l4SkipBitSize(void) const; + size_t skipBitSize(void) const override; + size_t l1SkipBitSize(void) const override; + size_t l2SkipBitSize(void) const override; + size_t l3SkipBitSize(void) const override; + size_t l4SkipBitSize(void) const override; /* * Single posting list performance, without feature unpack. */ virtual int - lowLevelSinglePostingScan(void) const; + lowLevelSinglePostingScan(void) const override; /* * Single posting list performance, with feature unpack. */ virtual int - lowLevelSinglePostingScanUnpack(void) const; + lowLevelSinglePostingScanUnpack(void) const override; /* * Two posting lists performance (same format) without feature unpack. */ virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const; + lowLevelAndPairPostingScan(const FakePosting &rhs) const override; /* * Two posting lists performance (same format) with feature unpack. */ virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const; + lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; /* * Iterator factory, for current query evaluation framework. */ virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const; + createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.h index b0d18b94eac..427110383fd 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakefilterocc.h @@ -30,42 +30,40 @@ public: /* * Size of posting list, in bits. */ - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; /* * Single posting list performance, without feature unpack. */ virtual int - lowLevelSinglePostingScan(void) const; + lowLevelSinglePostingScan(void) const override; /* * Single posting list performance, with feature unpack. */ virtual int - lowLevelSinglePostingScanUnpack(void) const; + lowLevelSinglePostingScanUnpack(void) const override; /* * Two posting lists performance (same format) without feature unpack. */ virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const; + lowLevelAndPairPostingScan(const FakePosting &rhs) const override; /* * Two posting lists performance (same format) with feature unpack. */ virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const; + lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; /* * Iterator factory, for current query evaluation framework. */ virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const; + createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h index dfe1b41abde..c4f3e27c4ac 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakememtreeocc.h @@ -145,10 +145,10 @@ public: sync(void); virtual void - add(uint32_t wordIdx, index::DocIdAndFeatures &features); + add(uint32_t wordIdx, index::DocIdAndFeatures &features) override; virtual void - remove(uint32_t wordIdx, uint32_t docId); + remove(uint32_t wordIdx, uint32_t docId) override; void sortUnflushed(void); @@ -179,10 +179,10 @@ public: ~FakeMemTreeOccFactory(void); virtual FakePosting::SP - make(const FakeWord &fw); + make(const FakeWord &fw) override; virtual void - setup(const std::vector<const FakeWord *> &fws); + setup(const std::vector<const FakeWord *> &fws) override; }; class FakeMemTreeOcc2Factory : public FakeMemTreeOccFactory @@ -194,10 +194,10 @@ public: ~FakeMemTreeOcc2Factory(void); virtual FakePosting::SP - make(const FakeWord &fw); + make(const FakeWord &fw) override; virtual void - setup(const std::vector<const FakeWord *> &fws); + setup(const std::vector<const FakeWord *> &fws) override; }; @@ -243,42 +243,40 @@ public: /* * Size of posting list, in bits. */ - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; /* * Single posting list performance, without feature unpack. */ virtual int - lowLevelSinglePostingScan(void) const; + lowLevelSinglePostingScan(void) const override; /* * Single posting list performance, with feature unpack. */ virtual int - lowLevelSinglePostingScanUnpack(void) const; + lowLevelSinglePostingScanUnpack(void) const override; /* * Two posting lists performance (same format) without feature unpack. */ virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const; + lowLevelAndPairPostingScan(const FakePosting &rhs) const override; /* * Two posting lists performance (same format) with feature unpack. */ virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const; + lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; /* * Iterator factory, for current query evaluation framework. */ virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const; + createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp index b6a8b541344..8172fc68a43 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakewordset.cpp @@ -13,6 +13,8 @@ namespace fakedata { using index::PostingListParams; using index::SchemaUtil; +using index::schema::CollectionType; +using index::schema::DataType; static void clearFakeWordVector(std::vector<FakeWord *> &v) @@ -63,14 +65,15 @@ FakeWordSet::setupParams(bool hasElements, _schema.clear(); assert(hasElements || !hasElementWeights); - Schema::CollectionType collectionType(index::schema::SINGLE); + Schema::CollectionType collectionType(CollectionType::SINGLE); if (hasElements) { - if (hasElementWeights) - collectionType = index::schema::WEIGHTEDSET; - else - collectionType = index::schema::ARRAY; + if (hasElementWeights) { + collectionType = CollectionType::WEIGHTEDSET; + } else { + collectionType = CollectionType::ARRAY; + } } - Schema::IndexField indexField("field0", index::schema::STRING, collectionType); + Schema::IndexField indexField("field0", DataType::STRING, collectionType); indexField.setAvgElemLen(512u); _schema.addIndexField(indexField); _fieldsParams.resize(_schema.getNumIndexFields()); diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.h index c9d183af80e..5e146b5705a 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakezcbfilterocc.h @@ -31,42 +31,40 @@ public: /* * Size of posting list, in bits. */ - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; /* * Single posting list performance, without feature unpack. */ virtual int - lowLevelSinglePostingScan(void) const; + lowLevelSinglePostingScan(void) const override; /* * Single posting list performance, with feature unpack. */ virtual int - lowLevelSinglePostingScanUnpack(void) const; + lowLevelSinglePostingScanUnpack(void) const override; /* * Two posting lists performance (same format) without feature unpack. */ virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const; + lowLevelAndPairPostingScan(const FakePosting &rhs) const override; /* * Two posting lists performance (same format) with feature unpack. */ virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const; + lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; /* * Iterator factory, for current query evaluation framework. */ virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const; + createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp index 2fc379c8a71..dfd47889513 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.cpp @@ -772,7 +772,7 @@ public: ~FakeZcSkipFilterOcc(void); virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const; + createIterator(const TermFieldMatchDataArray &matchData) const override; }; static FPFactoryInit @@ -1387,17 +1387,14 @@ public: ~FakeEGCompr64PosOcc(void); - void - setup(const FakeWord &fw); + void setup(const FakeWord &fw); - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const; + createIterator(const TermFieldMatchDataArray &matchData) const override; }; @@ -1523,17 +1520,14 @@ public: ~FakeEG2Compr64PosOcc(void); - void - setup(const FakeWord &fw); + void setup(const FakeWord &fw); - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; virtual SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const; + createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; @@ -1659,14 +1653,12 @@ public: ~FakeZcSkipPosOcc(void); - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const; + createIterator(const TermFieldMatchDataArray &matchData) const override; }; @@ -1725,14 +1717,12 @@ public: ~FakeZc2SkipPosOcc(void); - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; virtual SearchIterator * - createIterator(const TermFieldMatchDataArray &matchData) const; + createIterator(const TermFieldMatchDataArray &matchData) const override; }; diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.h b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.h index 0e1bcba7680..65ac3ead5d1 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fakezcfilterocc.h @@ -35,8 +35,7 @@ protected: const search::bitcompression::PosOccFieldsParams &_fieldsParams; bool _bigEndian; protected: - void - setup(const FakeWord &fw, bool doFeatures, bool dynamicK); + void setup(const FakeWord &fw, bool doFeatures, bool dynamicK); template <bool bigEndian> void @@ -57,60 +56,49 @@ public: /* * Size of posting list, in bits. */ - size_t - bitSize(void) const; + size_t bitSize(void) const override; - virtual bool - hasWordPositions(void) const; + virtual bool hasWordPositions(void) const override; /* * Size of posting skip list, in bits. */ - size_t - skipBitSize(void) const; - - size_t - l1SkipBitSize(void) const; - - size_t - l2SkipBitSize(void) const; - - size_t - l3SkipBitSize(void) const; - - size_t - l4SkipBitSize(void) const; + size_t skipBitSize(void) const override; + size_t l1SkipBitSize(void) const override; + size_t l2SkipBitSize(void) const override; + size_t l3SkipBitSize(void) const override; + size_t l4SkipBitSize(void) const override; /* * Single posting list performance, without feature unpack. */ virtual int - lowLevelSinglePostingScan(void) const; + lowLevelSinglePostingScan(void) const override; /* * Single posting list performance, with feature unpack. */ virtual int - lowLevelSinglePostingScanUnpack(void) const; + lowLevelSinglePostingScanUnpack(void) const override; /* * Two posting lists performance (same format) without feature unpack. */ virtual int - lowLevelAndPairPostingScan(const FakePosting &rhs) const; + lowLevelAndPairPostingScan(const FakePosting &rhs) const override; /* * Two posting lists performance (same format) with feature unpack. */ virtual int - lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const; + lowLevelAndPairPostingScanUnpack(const FakePosting &rhs) const override; /* * Iterator factory, for current query evaluation framework. */ virtual search::queryeval::SearchIterator * - createIterator(const fef::TermFieldMatchDataArray &matchData) const; + createIterator(const fef::TermFieldMatchDataArray &matchData) const override; }; } // namespace fakedata diff --git a/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h b/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h index fe09e653e26..bf02e815da8 100644 --- a/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h +++ b/searchlib/src/vespa/searchlib/test/fakedata/fpfactory.h @@ -42,7 +42,7 @@ public: } virtual FakePosting::SP - make(const FakeWord &fw) + make(const FakeWord &fw) override { return FakePosting::SP(new P(fw)); } diff --git a/searchlib/src/vespa/searchlib/test/initrange.cpp b/searchlib/src/vespa/searchlib/test/initrange.cpp index c3623aa7364..3c226469eb7 100644 --- a/searchlib/src/vespa/searchlib/test/initrange.cpp +++ b/searchlib/src/vespa/searchlib/test/initrange.cpp @@ -40,7 +40,7 @@ public: } } - void doUnpack(uint32_t docid) { (void) docid; } + void doUnpack(uint32_t docid) override { (void) docid; } vespalib::Trinary is_strict() const override { return _strict ? vespalib::Trinary::True : vespalib::Trinary::False; diff --git a/searchlib/src/vespa/searchlib/test/searchiteratorverifier.cpp b/searchlib/src/vespa/searchlib/test/searchiteratorverifier.cpp index b146c3be55a..0ea34964b65 100644 --- a/searchlib/src/vespa/searchlib/test/searchiteratorverifier.cpp +++ b/searchlib/src/vespa/searchlib/test/searchiteratorverifier.cpp @@ -49,7 +49,7 @@ public: } } - void doUnpack(uint32_t docid) { (void) docid; } + void doUnpack(uint32_t docid) override { (void) docid; } vespalib::Trinary is_strict() const override { return _strict ? vespalib::Trinary::True : vespalib::Trinary::False; diff --git a/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h b/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h index 0c8faba2979..a41b6c27c5d 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h +++ b/searchlib/src/vespa/searchlib/transactionlog/nosyncproxy.h @@ -18,7 +18,7 @@ public: ~NoSyncProxy(void); virtual void - sync(SerialNum syncTo); + sync(SerialNum syncTo) override; }; } diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h index 702a7cd260f..e219f5cffbc 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogclient.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogclient.h @@ -67,9 +67,9 @@ public: Subscriber(const vespalib::string & domain, TransLogClient & tlc, Callback & callBack); bool subscribe(const SerialNum & from); virtual ~Subscriber(); - virtual RPC::Result visit(const Packet & packet) { return _callback.receive(packet); } - virtual void inSync() { _callback.inSync(); } - virtual void eof() { _callback.eof(); } + virtual RPC::Result visit(const Packet & packet) override { return _callback.receive(packet); } + virtual void inSync() override { _callback.inSync(); } + virtual void eof() override { _callback.eof(); } private: Callback & _callback; }; diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h index 98a24393814..8e64b17ecb4 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h @@ -41,7 +41,7 @@ public: uint64_t setDomainPartSize(); DomainStats getDomainStats() const; - virtual void commit(const vespalib::string & domainName, const Packet & packet); + virtual void commit(const vespalib::string & domainName, const Packet & packet) override; class Session @@ -56,8 +56,8 @@ public: }; private: - virtual bool onStop(); - virtual void run(); + virtual bool onStop() override; + virtual void run() override; void exportRPC(FRT_Supervisor & supervisor); void relayToThreadRPC(FRT_RPCRequest *req); diff --git a/searchsummary/src/tests/docsumformat/docsum-pack.cpp b/searchsummary/src/tests/docsumformat/docsum-pack.cpp index bb01027d116..36ef5706355 100644 --- a/searchsummary/src/tests/docsumformat/docsum-pack.cpp +++ b/searchsummary/src/tests/docsumformat/docsum-pack.cpp @@ -63,7 +63,7 @@ public: void TestBasicInplace(); void TestCompressInplace(); - int Main(); + int Main() override; }; MyApp::MyApp() diff --git a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp index 1892fa96179..8f900700d5d 100644 --- a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp +++ b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp @@ -33,7 +33,7 @@ class Test : public vespalib::TestApp { void requireThat2DPositionFieldIsWritten(); public: - int Main(); + int Main() override; }; int @@ -51,21 +51,21 @@ struct MyEnvironment : IDocsumEnvironment { MyEnvironment() : attribute_man(0) {} - virtual IAttributeManager *getAttributeManager() { return attribute_man; } - virtual string lookupIndex(const string &s) const { return s; } - virtual juniper::Juniper *getJuniper() { return 0; } + virtual IAttributeManager *getAttributeManager() override { return attribute_man; } + virtual string lookupIndex(const string &s) const override { return s; } + virtual juniper::Juniper *getJuniper() override { return 0; } }; class MyAttributeContext : public IAttributeContext { const IAttributeVector &_attr; public: MyAttributeContext(const IAttributeVector &attr) : _attr(attr) {} - virtual const IAttributeVector *getAttribute(const string &) const { + virtual const IAttributeVector *getAttribute(const string &) const override { return &_attr; } - virtual const IAttributeVector *getAttributeStableEnum( - const string &) const { abort(); } - virtual void getAttributeList(vector<const IAttributeVector *> &) const + virtual const IAttributeVector * + getAttributeStableEnum(const string &) const override { abort(); } + virtual void getAttributeList(vector<const IAttributeVector *> &) const override { abort(); } }; @@ -74,24 +74,24 @@ class MyAttributeManager : public IAttributeManager { public: MyAttributeManager(const IAttributeVector &attr) : _attr(attr) {} - virtual AttributeGuard::UP getAttribute(const string &) const { + virtual AttributeGuard::UP getAttribute(const string &) const override { abort(); } - virtual AttributeGuard::UP getAttributeStableEnum(const string &) const { + virtual AttributeGuard::UP getAttributeStableEnum(const string &) const override { abort(); } - virtual void getAttributeList(vector<AttributeGuard> &) const { + virtual void getAttributeList(vector<AttributeGuard> &) const override { abort(); } - virtual IAttributeContext::UP createContext() const { + virtual IAttributeContext::UP createContext() const override { return IAttributeContext::UP(new MyAttributeContext(_attr)); } }; struct MyGetDocsumsStateCallback : GetDocsumsStateCallback { - virtual void FillSummaryFeatures(GetDocsumsState *, IDocsumEnvironment *) {} - virtual void FillRankFeatures(GetDocsumsState *, IDocsumEnvironment *) {} - virtual void ParseLocation(GetDocsumsState *) {} + virtual void FillSummaryFeatures(GetDocsumsState *, IDocsumEnvironment *) override {} + virtual void FillRankFeatures(GetDocsumsState *, IDocsumEnvironment *) override {} + virtual void ParseLocation(GetDocsumsState *) override {} }; template <typename AttrType> diff --git a/searchsummary/src/tests/extractkeywords/extractkeywordstest.h b/searchsummary/src/tests/extractkeywords/extractkeywordstest.h index 9e9ba3ac09c..2b24ce39136 100644 --- a/searchsummary/src/tests/extractkeywords/extractkeywordstest.h +++ b/searchsummary/src/tests/extractkeywords/extractkeywordstest.h @@ -19,7 +19,7 @@ private: search::docsummary::KeywordExtractor *_extractor; - int Main(); + int Main() override; void Usage(char *progname); bool ShowResult(int testNo, const char *actual, const char *correct); bool RunTest(int i, bool verify); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp index 869cffb7661..5a140c6790f 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.cpp @@ -82,8 +82,8 @@ public: GeneralResult *gres, GetDocsumsState *state, ResType type, - vespalib::slime::Inserter &target); - virtual bool isDefaultValue(uint32_t docid, const GetDocsumsState * state) const; + vespalib::slime::Inserter &target) override; + virtual bool isDefaultValue(uint32_t docid, const GetDocsumsState * state) const override; }; bool SingleAttrDFW::isDefaultValue(uint32_t docid, const GetDocsumsState * state) const @@ -181,7 +181,7 @@ public: GeneralResult *gres, GetDocsumsState *state, ResType type, - vespalib::slime::Inserter &target); + vespalib::slime::Inserter &target) override; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.h b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.h index 77f524740b5..92908038d68 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/attributedfw.h @@ -14,10 +14,10 @@ private: vespalib::string _attrName; protected: const attribute::IAttributeVector & vec(const GetDocsumsState & s) const; - virtual const vespalib::string & getAttributeName() const { return _attrName; } + virtual const vespalib::string & getAttributeName() const override { return _attrName; } public: AttrDFW(const vespalib::string & attrName); - virtual bool IsGenerated() const { return true; } + virtual bool IsGenerated() const override { return true; } }; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumfieldwriter.h b/searchsummary/src/vespa/searchsummary/docsummary/docsumfieldwriter.h index 2f86e8ef5f1..00fb63144ce 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumfieldwriter.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumfieldwriter.h @@ -55,12 +55,12 @@ public: EmptyDFW(); virtual ~EmptyDFW(); - virtual bool IsGenerated() const { return true; } + virtual bool IsGenerated() const override { return true; } virtual void insertField(uint32_t docid, GeneralResult *gres, GetDocsumsState *state, ResType type, - vespalib::slime::Inserter &target); + vespalib::slime::Inserter &target) override; }; //-------------------------------------------------------------------------- @@ -76,12 +76,12 @@ public: bool Init(const ResultConfig & config, const char *inputField); - virtual bool IsGenerated() const { return false; } + virtual bool IsGenerated() const override { return false; } virtual void insertField(uint32_t docid, GeneralResult *gres, GetDocsumsState *state, ResType type, - vespalib::slime::Inserter &target); + vespalib::slime::Inserter &target) override; }; //-------------------------------------------------------------------------- diff --git a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp index c903c7cbb78..8760a12fb82 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp @@ -71,7 +71,7 @@ public: TermVisitor(juniper::IQueryVisitor *visitor) : _visitor(visitor), _item() {} - virtual void visitProperty(const Property::Value &key, const Property &values); + virtual void visitProperty(const Property::Value &key, const Property &values) override; }; @@ -142,9 +142,9 @@ public: return true; } - virtual bool Traverse(juniper::IQueryVisitor *v) const; + virtual bool Traverse(juniper::IQueryVisitor *v) const override; - virtual int Weight(const juniper::QueryItem* item) const + virtual int Weight(const juniper::QueryItem* item) const override { if (item->_si != NULL) { return item->_si->GetWeight().percent(); @@ -152,7 +152,7 @@ public: return item->_data->_weight; } } - virtual juniper::ItemCreator Creator(const juniper::QueryItem* item) const + virtual juniper::ItemCreator Creator(const juniper::QueryItem* item) const override { // cast master: Knut Omang if (item->_si != NULL) { @@ -161,7 +161,7 @@ public: return juniper::CREA_ORIG; } } - virtual const char *Index(const juniper::QueryItem* item, size_t *len) const + virtual const char *Index(const juniper::QueryItem* item, size_t *len) const override { if (item->_si != NULL) { *len = item->_si->getIndexName().size(); @@ -172,7 +172,7 @@ public: } } - virtual bool UsefulIndex(const juniper::QueryItem* item) const + virtual bool UsefulIndex(const juniper::QueryItem* item) const override { vespalib::stringref index; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h index 981885754bd..582ba90747d 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h @@ -29,7 +29,7 @@ protected: uint32_t _langFieldEnumValue; juniper::Juniper *_juniper; private: - virtual bool IsGenerated() const { return false; } + virtual bool IsGenerated() const override { return false; } JuniperDFW(const JuniperDFW &); JuniperDFW & operator=(const JuniperDFW &); }; @@ -42,7 +42,7 @@ public: const char *fieldName, const char *langFieldName, const ResultConfig & config, - const char *inputField); + const char *inputField) override; protected: JuniperTeaserDFW(juniper::Juniper * juniper) : JuniperDFW(juniper) { } }; @@ -61,7 +61,7 @@ public: GeneralResult *gres, GetDocsumsState *state, ResType type, - vespalib::slime::Inserter &target); + vespalib::slime::Inserter &target) override; }; } // namespace docsummary diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h index 5e9cdce48c7..c743ad48637 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h @@ -53,7 +53,7 @@ public: void configure(const vespa::config::search::summary::JuniperrcConfig &cfg); // Inherit doc from IJuniperProperties. - const char *GetProperty(const char *name, const char *def = NULL); + const char *GetProperty(const char *name, const char *def = NULL) override; /** * Sets the value of a given named property. If the property already exists, it is overwritten. If it does not diff --git a/searchsummary/src/vespa/searchsummary/docsummary/rankfeaturesdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/rankfeaturesdfw.h index 3c1382c1eda..7dceb311b7f 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/rankfeaturesdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/rankfeaturesdfw.h @@ -21,12 +21,12 @@ public: RankFeaturesDFW(); virtual ~RankFeaturesDFW(); void init(IDocsumEnvironment * env); - virtual bool IsGenerated() const { return true; } + virtual bool IsGenerated() const override { return true; } virtual void insertField(uint32_t docid, GeneralResult *gres, GetDocsumsState *state, ResType type, - vespalib::slime::Inserter &target); + vespalib::slime::Inserter &target) override; }; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h index 7da574fe1fd..48fddb64148 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h @@ -30,12 +30,12 @@ public: SummaryFeaturesDFW(); virtual ~SummaryFeaturesDFW(); void init(IDocsumEnvironment * env); - virtual bool IsGenerated() const { return true; } + virtual bool IsGenerated() const override { return true; } virtual void insertField(uint32_t docid, GeneralResult *gres, GetDocsumsState *state, ResType type, - vespalib::slime::Inserter &target); + vespalib::slime::Inserter &target) override; static uint32_t writeString(const vespalib::stringref & str, ResType type, search::RawBuf * target); }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp b/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp index 0fa34cf2e16..cff0c45ac59 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp @@ -240,7 +240,7 @@ class SummaryFieldValueConverter : protected ConstFieldValueVisitor FieldValue::UP _field_value; FieldValueConverter &_structuredFieldConverter; - virtual void visit(const ArrayFieldValue &value) { + virtual void visit(const ArrayFieldValue &value) override { _field_value = _structuredFieldConverter.convert(value); } @@ -248,17 +248,17 @@ class SummaryFieldValueConverter : protected ConstFieldValueVisitor void visitPrimitive(const T &t) { _field_value.reset(t.clone()); } - virtual void visit(const IntFieldValue &value) { visitPrimitive(value); } - virtual void visit(const LongFieldValue &value) { visitPrimitive(value); } - virtual void visit(const ShortFieldValue &value) { visitPrimitive(value); } - virtual void visit(const ByteFieldValue &value) { + virtual void visit(const IntFieldValue &value) override { visitPrimitive(value); } + virtual void visit(const LongFieldValue &value) override { visitPrimitive(value); } + virtual void visit(const ShortFieldValue &value) override { visitPrimitive(value); } + virtual void visit(const ByteFieldValue &value) override { int8_t signedValue = value.getAsByte(); _field_value.reset(new ShortFieldValue(signedValue)); } - virtual void visit(const DoubleFieldValue &value) { visitPrimitive(value); } - virtual void visit(const FloatFieldValue &value) { visitPrimitive(value); } + virtual void visit(const DoubleFieldValue &value) override { visitPrimitive(value); } + virtual void visit(const FloatFieldValue &value) override { visitPrimitive(value); } - virtual void visit(const StringFieldValue &value) { + virtual void visit(const StringFieldValue &value) override { if (_tokenize) { SummaryHandler handler(value.getValue(), _str); handleIndexingTerms(handler, value); @@ -267,30 +267,30 @@ class SummaryFieldValueConverter : protected ConstFieldValueVisitor } } - virtual void visit(const AnnotationReferenceFieldValue & v ) { + virtual void visit(const AnnotationReferenceFieldValue & v ) override { _field_value = _structuredFieldConverter.convert(v); } - virtual void visit(const Document & v) { + virtual void visit(const Document & v) override { _field_value = _structuredFieldConverter.convert(v); } virtual void - visit(const PredicateFieldValue &value) + visit(const PredicateFieldValue &value) override { _str << value.toString(); } virtual void - visit(const RawFieldValue &value) + visit(const RawFieldValue &value) override { visitPrimitive(value); } - virtual void visit(const MapFieldValue & v) { + virtual void visit(const MapFieldValue & v) override { _field_value = _structuredFieldConverter.convert(v); } - virtual void visit(const StructFieldValue &value) { + virtual void visit(const StructFieldValue &value) override { if (*value.getDataType() == *SearchDataType::URI) { FieldValue::UP uriAllValue = value.getValue("all"); if (uriAllValue.get() != NULL && @@ -303,7 +303,7 @@ class SummaryFieldValueConverter : protected ConstFieldValueVisitor _field_value = _structuredFieldConverter.convert(value); } - virtual void visit(const WeightedSetFieldValue &value) { + virtual void visit(const WeightedSetFieldValue &value) override { _field_value = _structuredFieldConverter.convert(value); } @@ -342,14 +342,14 @@ class SlimeFiller : public ConstFieldValueVisitor { Inserter &_inserter; bool _tokenize; - virtual void visit(const AnnotationReferenceFieldValue & v ) { + virtual void visit(const AnnotationReferenceFieldValue & v ) override { (void)v; Cursor &c = _inserter.insertObject(); Memory key("error"); Memory val("cannot convert from annotation reference field"); c.setString(key, val); } - virtual void visit(const Document & v) { + virtual void visit(const Document & v) override { (void)v; Cursor &c = _inserter.insertObject(); Memory key("error"); @@ -357,7 +357,7 @@ class SlimeFiller : public ConstFieldValueVisitor { c.setString(key, val); } - virtual void visit(const MapFieldValue & v) { + virtual void visit(const MapFieldValue & v) override { Cursor &a = _inserter.insertArray(); Symbol keysym = a.resolve("key"); Symbol valsym = a.resolve("value"); @@ -375,7 +375,7 @@ class SlimeFiller : public ConstFieldValueVisitor { } } - virtual void visit(const ArrayFieldValue &value) { + virtual void visit(const ArrayFieldValue &value) override { Cursor &a = _inserter.insertArray(); if (value.size() > 0) { ArrayInserter ai(a); @@ -386,7 +386,7 @@ class SlimeFiller : public ConstFieldValueVisitor { } } - virtual void visit(const StringFieldValue &value) { + virtual void visit(const StringFieldValue &value) override { if (_tokenize) { asciistream tmp; SummaryHandler handler(value.getValue(), tmp); @@ -397,45 +397,45 @@ class SlimeFiller : public ConstFieldValueVisitor { } } - virtual void visit(const IntFieldValue &value) { + virtual void visit(const IntFieldValue &value) override { int32_t v = value.getValue(); _inserter.insertLong(v); } - virtual void visit(const LongFieldValue &value) { + virtual void visit(const LongFieldValue &value) override { int64_t v = value.getValue(); _inserter.insertLong(v); } - virtual void visit(const ShortFieldValue &value) { + virtual void visit(const ShortFieldValue &value) override { int16_t v = value.getValue(); _inserter.insertLong(v); } - virtual void visit(const ByteFieldValue &value) { + virtual void visit(const ByteFieldValue &value) override { int8_t v = value.getAsByte(); _inserter.insertLong(v); } - virtual void visit(const DoubleFieldValue &value) { + virtual void visit(const DoubleFieldValue &value) override { double v = value.getValue(); _inserter.insertDouble(v); } - virtual void visit(const FloatFieldValue &value) { + virtual void visit(const FloatFieldValue &value) override { float v = value.getValue(); _inserter.insertDouble(v); } virtual void - visit(const PredicateFieldValue &value) + visit(const PredicateFieldValue &value) override { vespalib::slime::inject(value.getSlime().get(), _inserter); } virtual void - visit(const RawFieldValue &value) + visit(const RawFieldValue &value) override { std::pair<const char *, size_t> buf = value.getAsRaw(); _inserter.insertData(Memory(buf.first, buf.second)); } - virtual void visit(const StructFieldValue &value) { + virtual void visit(const StructFieldValue &value) override { if (*value.getDataType() == *SearchDataType::URI) { FieldValue::UP uriAllValue = value.getValue("all"); if (uriAllValue.get() != NULL && @@ -455,7 +455,7 @@ class SlimeFiller : public ConstFieldValueVisitor { } } - virtual void visit(const WeightedSetFieldValue &value) { + virtual void visit(const WeightedSetFieldValue &value) override { Cursor &a = _inserter.insertArray(); if (value.size() > 0) { Symbol isym = a.resolve("item"); @@ -498,7 +498,7 @@ public: : _tokenize(tokenize) {} - FieldValue::UP convert(const FieldValue &input) { + FieldValue::UP convert(const FieldValue &input) override { vespalib::Slime slime; SlimeInserter inserter(slime); SlimeFiller visitor(inserter, _tokenize); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/textextractordfw.h b/searchsummary/src/vespa/searchsummary/docsummary/textextractordfw.h index a12455e61a3..709eac15c07 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/textextractordfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/textextractordfw.h @@ -23,13 +23,13 @@ public: virtual ~TextExtractorDFW() {} bool init(const vespalib::string & fieldName, const vespalib::string & inputField, const ResultConfig & config); // Inherit doc - virtual bool IsGenerated() const { return false; } + virtual bool IsGenerated() const override { return false; } // Inherit doc virtual void insertField(uint32_t docid, GeneralResult *gres, GetDocsumsState *state, ResType type, - vespalib::slime::Inserter &target); + vespalib::slime::Inserter &target) override; }; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/tokenizer.h b/searchsummary/src/vespa/searchsummary/docsummary/tokenizer.h index efd07e16b68..15adff6fa0e 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/tokenizer.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/tokenizer.h @@ -36,10 +36,10 @@ public: Tokenizer(const char * buf, size_t len); // Inherit doc - virtual void reset(const char * buf, size_t len); - virtual size_t getBufferSize() const { return _end - _begin; } - virtual bool hasMoreTokens(); - virtual Token getNextToken(); + virtual void reset(const char * buf, size_t len) override; + virtual size_t getBufferSize() const override { return _end - _begin; } + virtual bool hasMoreTokens() override; + virtual Token getNextToken() override; }; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/urlresult.h b/searchsummary/src/vespa/searchsummary/docsummary/urlresult.h index e882a5a9ed8..907ef1207e8 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/urlresult.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/urlresult.h @@ -36,7 +36,7 @@ public: badurlresult(uint32_t partition, uint32_t docid, HitRank metric); virtual ~badurlresult(); - virtual int unpack(const char *buf, const size_t buflen); + virtual int unpack(const char *buf, const size_t buflen) override; }; @@ -72,8 +72,8 @@ public: ResEntry *GetEntry(uint32_t idx); ResEntry *GetEntry(const char *name); ResEntry *GetEntryFromEnumValue(uint32_t val); - virtual bool IsGeneral() const { return true; } - virtual int unpack(const char *buf, const size_t buflen); + virtual bool IsGeneral() const override { return true; } + virtual int unpack(const char *buf, const size_t buflen) override; bool inplaceUnpack(const DocsumStoreValue &value) { if (value.valid()) { diff --git a/slobrok/src/apps/check_slobrok/check_slobrok.cpp b/slobrok/src/apps/check_slobrok/check_slobrok.cpp index 294cbe844c7..8e2a91c100d 100644 --- a/slobrok/src/apps/check_slobrok/check_slobrok.cpp +++ b/slobrok/src/apps/check_slobrok/check_slobrok.cpp @@ -25,7 +25,7 @@ public: int usage(); void initRPC(const char *spec); void finiRPC(); - virtual int Main(); + virtual int Main() override; }; diff --git a/slobrok/src/apps/sbcmd/sbcmd.cpp b/slobrok/src/apps/sbcmd/sbcmd.cpp index 3ba4182de98..60a3dfc779b 100644 --- a/slobrok/src/apps/sbcmd/sbcmd.cpp +++ b/slobrok/src/apps/sbcmd/sbcmd.cpp @@ -25,7 +25,7 @@ public: int usage(); void initRPC(const char *spec); void finiRPC(); - virtual int Main(); + virtual int Main() override; }; diff --git a/slobrok/src/apps/slobrok/slobrok.cpp b/slobrok/src/apps/slobrok/slobrok.cpp index b87b0e96127..fb785a55562 100644 --- a/slobrok/src/apps/slobrok/slobrok.cpp +++ b/slobrok/src/apps/slobrok/slobrok.cpp @@ -15,7 +15,7 @@ namespace slobrok { class App : public FastOS_Application { public: - int Main(); + int Main() override; }; static std::unique_ptr<SBEnv> mainobj; diff --git a/slobrok/src/tests/mirrorapi/match_test.cpp b/slobrok/src/tests/mirrorapi/match_test.cpp index 571748dfd28..d9ebcfd6f29 100644 --- a/slobrok/src/tests/mirrorapi/match_test.cpp +++ b/slobrok/src/tests/mirrorapi/match_test.cpp @@ -9,7 +9,7 @@ class MatchTester : public slobrok::api::IMirrorAPI } virtual uint32_t updates() const override { return 0; } - virtual bool ready() const { return true; } + virtual bool ready() const override { return true; } const std::string name; diff --git a/slobrok/src/tests/oldapi/mirror.h b/slobrok/src/tests/oldapi/mirror.h index 4bd100f5b5b..1f0db564cae 100644 --- a/slobrok/src/tests/oldapi/mirror.h +++ b/slobrok/src/tests/oldapi/mirror.h @@ -87,10 +87,10 @@ public: ~MirrorOld(); // Inherit doc from IMirrorOld. - SpecList lookup(const std::string & pattern) const; + SpecList lookup(const std::string & pattern) const override; // Inherit doc from IMirrorOld. - uint32_t updates() const { return _updates.getAsInt(); } + uint32_t updates() const override { return _updates.getAsInt(); } /** * @brief Ask if the MirrorOld has got any useful information from @@ -111,10 +111,10 @@ private: MirrorOld &operator=(const MirrorOld &); /** from FNET_Task, polls slobrok **/ - void PerformTask(); + void PerformTask() override; /** from FRT_IRequestWait **/ - void RequestDone(FRT_RPCRequest *req); + void RequestDone(FRT_RPCRequest *req) override; FRT_Supervisor &_orb; mutable FastOS_Mutex _lock; diff --git a/slobrok/src/tests/startsome/rpc_info.cpp b/slobrok/src/tests/startsome/rpc_info.cpp index 09bc6727a2d..76b578d4f88 100644 --- a/slobrok/src/tests/startsome/rpc_info.cpp +++ b/slobrok/src/tests/startsome/rpc_info.cpp @@ -65,7 +65,7 @@ public: } - int Main() + int Main() override { if (_argc < 2) { printf("usage : rpc_info <connectspec> [verbose]\n"); diff --git a/slobrok/src/tests/startsome/tstdst.cpp b/slobrok/src/tests/startsome/tstdst.cpp index 7e5b21dfc8f..e2f6ae070b3 100644 --- a/slobrok/src/tests/startsome/tstdst.cpp +++ b/slobrok/src/tests/startsome/tstdst.cpp @@ -43,7 +43,7 @@ public: int MainLoop(); void shutdown() { getTransport()->ShutDown(false); } - void RequestDone(FRT_RPCRequest* req) { + void RequestDone(FRT_RPCRequest* req) override { if (req->IsError()) { LOG(error, "registration failed: %s", req->GetErrorMessage()); } else { @@ -182,7 +182,7 @@ TstEnv::MainLoop() class App : public FastOS_Application { public: - int Main() { + int Main() override { int sbport = 2773; int myport = 2774; const char *rpcsrvname = "testrpcsrv/17"; diff --git a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp index bb23c7183b2..ce21c918219 100644 --- a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp @@ -16,7 +16,7 @@ public: private: void benchmarkTree(size_t count); void benchmarkTreeInArray(size_t count); - int Main(); + int Main() override; }; template <typename T> diff --git a/staging_vespalib/src/tests/array/allocinarray_test.cpp b/staging_vespalib/src/tests/array/allocinarray_test.cpp index de6e5792b35..059fff91cec 100644 --- a/staging_vespalib/src/tests/array/allocinarray_test.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_test.cpp @@ -14,7 +14,7 @@ using namespace vespalib; class Test : public TestApp { public: - int Main(); + int Main() override; private: template <typename T, typename V> void testAllocInArray(); diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp index 525eb4d3427..9e2b286e864 100644 --- a/staging_vespalib/src/tests/array/sort_benchmark.cpp +++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp @@ -18,7 +18,7 @@ private: void sortDirect(size_t count); template<typename T> void sortInDirect(size_t count); - int Main(); + int Main() override; }; template<size_t N> diff --git a/staging_vespalib/src/tests/benchmark/testbase.h b/staging_vespalib/src/tests/benchmark/testbase.h index 45b0e30019e..02f11e21cac 100644 --- a/staging_vespalib/src/tests/benchmark/testbase.h +++ b/staging_vespalib/src/tests/benchmark/testbase.h @@ -45,7 +45,7 @@ public: private: typedef std::vector<int> Vector; size_t callByReference(const Vector & values) const __attribute__((noinline)); - virtual size_t onRun(); + virtual size_t onRun() override; }; class ParamByValueVectorInt : public Benchmark @@ -55,7 +55,7 @@ public: private: typedef std::vector<int> Vector; size_t callByValue(Vector values) const __attribute__((noinline)); - virtual size_t onRun(); + virtual size_t onRun() override; }; class ParamByReferenceVectorString : public Benchmark @@ -65,7 +65,7 @@ public: private: typedef std::vector<std::string> Vector; size_t callByReference(const Vector & values) const __attribute__((noinline)); - virtual size_t onRun(); + virtual size_t onRun() override; }; class ParamByValueVectorString : public Benchmark @@ -75,7 +75,7 @@ public: private: typedef std::vector<std::string> Vector; size_t callByValue(Vector values) const __attribute__((noinline)); - virtual size_t onRun(); + virtual size_t onRun() override; }; class ReturnByReferenceVectorString : public Benchmark @@ -85,7 +85,7 @@ public: private: typedef std::vector<std::string> Vector; const Vector & returnByReference(Vector & values) const __attribute__((noinline)); - virtual size_t onRun(); + virtual size_t onRun() override; }; class ReturnByValueVectorString : public Benchmark @@ -95,7 +95,7 @@ public: private: typedef std::vector<std::string> Vector; Vector returnByValue() const __attribute__((noinline)); - virtual size_t onRun(); + virtual size_t onRun() override; }; class ReturnByValueMultiVectorString : public Benchmark @@ -105,7 +105,7 @@ public: private: typedef std::vector<std::string> Vector; Vector returnByValue() const __attribute__((noinline)); - virtual size_t onRun(); + virtual size_t onRun() override; }; class CreateVespalibString : public Benchmark @@ -113,7 +113,7 @@ class CreateVespalibString : public Benchmark public: DECLARE_BENCHMARK(CreateVespalibString); private: - virtual size_t onRun(); + virtual size_t onRun() override; }; class ClockSystem : public Benchmark @@ -121,7 +121,7 @@ class ClockSystem : public Benchmark public: DECLARE_BENCHMARK(ClockSystem); private: - virtual size_t onRun(); + virtual size_t onRun() override; }; class ClockREALTIME : public Benchmark @@ -129,7 +129,7 @@ class ClockREALTIME : public Benchmark public: DECLARE_BENCHMARK(ClockREALTIME); private: - virtual size_t onRun(); + virtual size_t onRun() override; }; class ClockMONOTONIC : public Benchmark @@ -137,7 +137,7 @@ class ClockMONOTONIC : public Benchmark public: DECLARE_BENCHMARK(ClockMONOTONIC); private: - virtual size_t onRun(); + virtual size_t onRun() override; }; class ClockMONOTONIC_RAW : public Benchmark @@ -146,7 +146,7 @@ public: DECLARE_BENCHMARK(ClockMONOTONIC_RAW); ClockMONOTONIC_RAW(); private: - virtual size_t onRun(); + virtual size_t onRun() override; }; class ClockPROCESS_CPUTIME_ID : public Benchmark @@ -154,7 +154,7 @@ class ClockPROCESS_CPUTIME_ID : public Benchmark public: DECLARE_BENCHMARK(ClockPROCESS_CPUTIME_ID); private: - virtual size_t onRun(); + virtual size_t onRun() override; }; class ClockTHREAD_CPUTIME_ID : public Benchmark @@ -162,7 +162,7 @@ class ClockTHREAD_CPUTIME_ID : public Benchmark public: DECLARE_BENCHMARK(ClockTHREAD_CPUTIME_ID); private: - virtual size_t onRun(); + virtual size_t onRun() override; }; } diff --git a/staging_vespalib/src/tests/bits/bits_test.cpp b/staging_vespalib/src/tests/bits/bits_test.cpp index 83e60f0f214..f7b3ef1bf84 100644 --- a/staging_vespalib/src/tests/bits/bits_test.cpp +++ b/staging_vespalib/src/tests/bits/bits_test.cpp @@ -11,7 +11,7 @@ using namespace vespalib; class Test : public TestApp { public: - int Main(); + int Main() override; template <typename T> void testFixed(const T * v, size_t sz); void testBuffer(); diff --git a/staging_vespalib/src/tests/clock/clock_test.cpp b/staging_vespalib/src/tests/clock/clock_test.cpp index f7f15dd3d24..025d8766a29 100644 --- a/staging_vespalib/src/tests/clock/clock_test.cpp +++ b/staging_vespalib/src/tests/clock/clock_test.cpp @@ -11,7 +11,7 @@ using fastos::TimeStamp; class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; }; diff --git a/staging_vespalib/src/tests/crc/crc_test.cpp b/staging_vespalib/src/tests/crc/crc_test.cpp index 6c028cc09ce..6a5a0779d8b 100644 --- a/staging_vespalib/src/tests/crc/crc_test.cpp +++ b/staging_vespalib/src/tests/crc/crc_test.cpp @@ -12,7 +12,7 @@ using namespace vespalib; class Test : public TestApp { public: - int Main(); + int Main() override; void testCorrectNess(); void testBenchmark(bool our, size_t bufSz, size_t numRep); }; diff --git a/staging_vespalib/src/tests/databuffer/databuffer_test.cpp b/staging_vespalib/src/tests/databuffer/databuffer_test.cpp index 3793af27aa7..7ec83e58b5c 100644 --- a/staging_vespalib/src/tests/databuffer/databuffer_test.cpp +++ b/staging_vespalib/src/tests/databuffer/databuffer_test.cpp @@ -13,7 +13,7 @@ class Test : public vespalib::TestApp { private: void testBasic(); public: - int Main() { + int Main() override { TEST_INIT("databuffer_test"); testBasic(); TEST_FLUSH(); diff --git a/staging_vespalib/src/tests/fileheader/fileheader_test.cpp b/staging_vespalib/src/tests/fileheader/fileheader_test.cpp index 2d47739100c..f2a6c8402ee 100644 --- a/staging_vespalib/src/tests/fileheader/fileheader_test.cpp +++ b/staging_vespalib/src/tests/fileheader/fileheader_test.cpp @@ -40,7 +40,7 @@ private: bool mapped); public: - int Main() { + int Main() override { TEST_INIT("fileheader_test"); testTag(); TEST_FLUSH(); diff --git a/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp b/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp index 41eed2f7dc9..98b6804ac8e 100644 --- a/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp +++ b/staging_vespalib/src/tests/floatingpointtype/floatingpointtypetest.cpp @@ -9,7 +9,7 @@ class Test : public vespalib::TestApp { public: void testFloatingPoint(); - int Main(); + int Main() override; }; void diff --git a/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp b/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp index 121f8d2e011..aaf3f383c33 100644 --- a/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp +++ b/staging_vespalib/src/tests/growablebytebuffer/growablebytebuffer_test.cpp @@ -11,7 +11,7 @@ class Test : public TestApp { public: void testGrowing(); - int Main(); + int Main() override; }; void diff --git a/staging_vespalib/src/tests/json/json.cpp b/staging_vespalib/src/tests/json/json.cpp index b01406d8a10..a64bb421fb9 100644 --- a/staging_vespalib/src/tests/json/json.cpp +++ b/staging_vespalib/src/tests/json/json.cpp @@ -19,7 +19,7 @@ private: void testJsonStreamStateReporting(); public: - int Main(); + int Main() override; }; void diff --git a/staging_vespalib/src/tests/librarypool/librarypool_test.cpp b/staging_vespalib/src/tests/librarypool/librarypool_test.cpp index 5808d1c91e5..665dbca8a86 100644 --- a/staging_vespalib/src/tests/librarypool/librarypool_test.cpp +++ b/staging_vespalib/src/tests/librarypool/librarypool_test.cpp @@ -11,7 +11,7 @@ using namespace vespalib; class Test : public TestApp { public: - int Main(); + int Main() override; }; int diff --git a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp b/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp index 34bf061bb32..5430e8c1465 100644 --- a/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp +++ b/staging_vespalib/src/tests/memorydatastore/memorydatastore.cpp @@ -15,7 +15,7 @@ private: void testMemoryDataStore(); void testVariableSizeVector(); public: - int Main(); + int Main() override; }; void diff --git a/staging_vespalib/src/tests/objectdump/objectdump.cpp b/staging_vespalib/src/tests/objectdump/objectdump.cpp index 1488397911e..671e89b5011 100644 --- a/staging_vespalib/src/tests/objectdump/objectdump.cpp +++ b/staging_vespalib/src/tests/objectdump/objectdump.cpp @@ -22,7 +22,7 @@ IMPLEMENT_IDENTIFIABLE(Base, vespalib::Identifiable); struct Baz : public Base { DECLARE_IDENTIFIABLE(Baz); - virtual Baz *clone() const { return new Baz(*this); } + virtual Baz *clone() const override { return new Baz(*this); } }; IMPLEMENT_IDENTIFIABLE(Baz, Base); @@ -45,9 +45,9 @@ struct Bar : public Base _int32(-4), _uint32(4), _int64(-8), _uint64(8), _float(2.5), _double(2.75), _string("bla bla") {} - virtual Bar *clone() const { return new Bar(*this); } + virtual Bar *clone() const override { return new Bar(*this); } - virtual void visitMembers(ObjectVisitor &v) const { + virtual void visitMembers(ObjectVisitor &v) const override { visit(v, "_bool", _bool); visit(v, "_int8", _int8); visit(v, "_uint8", _uint8); diff --git a/staging_vespalib/src/tests/objects/identifiable_test.cpp b/staging_vespalib/src/tests/objects/identifiable_test.cpp index ca6f40542aa..c60f33b9b55 100644 --- a/staging_vespalib/src/tests/objects/identifiable_test.cpp +++ b/staging_vespalib/src/tests/objects/identifiable_test.cpp @@ -19,7 +19,7 @@ class IdentifiableTest : public TestApp { template <typename T> void testSerializer(const T & a); public: - int Main(); + int Main() override; }; #define CID_Abstract 0x700000 @@ -40,7 +40,7 @@ class A : public Abstract public: DECLARE_IDENTIFIABLE(A); A() { } - virtual void someAbstractVirtualMethod() { }; + virtual void someAbstractVirtualMethod() override { } }; class B : public A diff --git a/staging_vespalib/src/tests/objectselection/objectselection.cpp b/staging_vespalib/src/tests/objectselection/objectselection.cpp index 5b51ea5ae59..27ecb068231 100644 --- a/staging_vespalib/src/tests/objectselection/objectselection.cpp +++ b/staging_vespalib/src/tests/objectselection/objectselection.cpp @@ -17,7 +17,7 @@ struct Foo : public Identifiable DECLARE_IDENTIFIABLE(Foo); virtual Foo *clone() const { return new Foo(*this); } - virtual void selectMembers(const ObjectPredicate &p, ObjectOperation &o) { + virtual void selectMembers(const ObjectPredicate &p, ObjectOperation &o) override { for (uint32_t i = 0; i < nodes.size(); ++i) { nodes[i]->select(p, o); } @@ -32,7 +32,7 @@ struct Bar : public Foo DECLARE_IDENTIFIABLE(Bar); Bar() : value(0) {} Bar(int v) { value = v; } - virtual Bar *clone() const { return new Bar(*this); } + virtual Bar *clone() const override { return new Bar(*this); } }; IMPLEMENT_IDENTIFIABLE(Bar, Identifiable); @@ -40,7 +40,7 @@ struct ObjectType : public ObjectPredicate { uint32_t cid; ObjectType(uint32_t id) : cid(id) {} - virtual bool check(const Identifiable &obj) const { + virtual bool check(const Identifiable &obj) const override { return (obj.getClass().id() == cid); } }; @@ -48,7 +48,7 @@ struct ObjectType : public ObjectPredicate struct ObjectCollect : public ObjectOperation { std::vector<Identifiable*> nodes; - virtual void execute(Identifiable &obj) { + virtual void execute(Identifiable &obj) override { nodes.push_back(&obj); } }; diff --git a/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp b/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp index 9d549d3cc34..affb7287674 100644 --- a/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp +++ b/staging_vespalib/src/tests/polymorphicarray/polymorphicarray_test.cpp @@ -111,8 +111,8 @@ TEST("require that primitive arrays conforms") { class Factory : public ComplexArrayT<A>::Factory { public: - A * create() { return new Complex(); } - virtual Factory * clone() const { return new Factory(*this); } + A * create() override { return new Complex(); } + virtual Factory * clone() const override { return new Factory(*this); } }; TEST("require that complex arrays conforms") { diff --git a/staging_vespalib/src/tests/programoptions/programoptions_test.cpp b/staging_vespalib/src/tests/programoptions/programoptions_test.cpp index cabff89f9bb..881954bfa3f 100644 --- a/staging_vespalib/src/tests/programoptions/programoptions_test.cpp +++ b/staging_vespalib/src/tests/programoptions/programoptions_test.cpp @@ -21,7 +21,7 @@ public: void testVectorArgument(); void testAllHiddenOption(); void testOptionsAfterArguments(); - int Main(); + int Main() override; }; int diff --git a/staging_vespalib/src/tests/rusage/rusage_test.cpp b/staging_vespalib/src/tests/rusage/rusage_test.cpp index 3da7f1d0b54..0367ab8c374 100644 --- a/staging_vespalib/src/tests/rusage/rusage_test.cpp +++ b/staging_vespalib/src/tests/rusage/rusage_test.cpp @@ -11,7 +11,7 @@ using namespace vespalib; class Test : public TestApp { public: - int Main(); + int Main() override; void testRUsage(); }; diff --git a/staging_vespalib/src/tests/state_server/state_server_test.cpp b/staging_vespalib/src/tests/state_server/state_server_test.cpp index a5df5778368..f572dbcd8e1 100644 --- a/staging_vespalib/src/tests/state_server/state_server_test.cpp +++ b/staging_vespalib/src/tests/state_server/state_server_test.cpp @@ -54,7 +54,8 @@ struct DummyHandler : JsonGetHandler { DummyHandler(const vespalib::string &result_in) : result(result_in) {} virtual vespalib::string get(const vespalib::string &, const vespalib::string &, - const std::map<vespalib::string,vespalib::string> &) const + const std::map<vespalib::string,vespalib::string> &) + const override { return result; } @@ -114,7 +115,8 @@ TEST_FFFF("require that handler is selected based on longest matching url prefix struct EchoHost : JsonGetHandler { virtual vespalib::string get(const vespalib::string &host, const vespalib::string &, - const std::map<vespalib::string,vespalib::string> &) const + const std::map<vespalib::string,vespalib::string> &) + const override { return "[\"" + host + "\"]"; } @@ -314,10 +316,10 @@ TEST_FFFFF("require that custom handlers can be added to the state server", } struct EchoConsumer : MetricsProducer { - virtual vespalib::string getMetrics(const vespalib::string &consumer) { + virtual vespalib::string getMetrics(const vespalib::string &consumer) override { return "[\"" + consumer + "\"]"; } - virtual vespalib::string getTotalMetrics(const vespalib::string &consumer) { + virtual vespalib::string getTotalMetrics(const vespalib::string &consumer) override { return "[\"" + consumer + "\"]"; } }; diff --git a/staging_vespalib/src/tests/stllike/cache_test.cpp b/staging_vespalib/src/tests/stllike/cache_test.cpp index 892c9bc81c7..2a070fa8ab2 100644 --- a/staging_vespalib/src/tests/stllike/cache_test.cpp +++ b/staging_vespalib/src/tests/stllike/cache_test.cpp @@ -31,7 +31,7 @@ public: class Test : public TestApp { public: - int Main(); + int Main() override; private: typedef LruParam<uint32_t, string> P; typedef Map<uint32_t, string> B; diff --git a/staging_vespalib/src/tests/timer/timer_test.cpp b/staging_vespalib/src/tests/timer/timer_test.cpp index de2f081f48a..ad782f4089f 100644 --- a/staging_vespalib/src/tests/timer/timer_test.cpp +++ b/staging_vespalib/src/tests/timer/timer_test.cpp @@ -13,7 +13,7 @@ typedef Executor::Task Task; class Test : public TestApp { public: - int Main(); + int Main() override; void testScheduling(); void testReset(); }; @@ -23,7 +23,7 @@ private: vespalib::CountDownLatch &_latch; public: TestTask(vespalib::CountDownLatch & latch) : _latch(latch) { } - void run() { _latch.countDown(); } + void run() override { _latch.countDown(); } }; int diff --git a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp index a44802735eb..1035c021f68 100644 --- a/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp +++ b/staging_vespalib/src/tests/xmlserializable/xmlserializabletest.cpp @@ -15,7 +15,7 @@ public: void testNesting(); void testIndent(); - int Main(); + int Main() override; }; int @@ -93,7 +93,7 @@ namespace { LookAndFeel() {} - void printXml(XmlOutputStream& out) const { + void printXml(XmlOutputStream& out) const override { using namespace vespalib::xml; out << XmlAttribute("color", "blue") << XmlTag("other") diff --git a/staging_vespalib/src/vespa/vespalib/util/programoptions.h b/staging_vespalib/src/vespa/vespalib/util/programoptions.h index d809a44e26f..58d1d133d04 100644 --- a/staging_vespalib/src/vespa/vespalib/util/programoptions.h +++ b/staging_vespalib/src/vespa/vespalib/util/programoptions.h @@ -237,9 +237,9 @@ struct ProgramOptions::OptionParser { struct ProgramOptions::OptionHeader : public OptionParser { OptionHeader(const std::string& desc) : OptionParser("", 0, desc) {} - virtual void set(const std::vector<std::string>&) {} - virtual void setDefault() {} - virtual bool isHeader() const { return true; } + virtual void set(const std::vector<std::string>&) override {} + virtual void setDefault() override {} + virtual bool isHeader() const override { return true; } }; template<typename Number> @@ -265,11 +265,11 @@ struct ProgramOptions::NumberOptionParser : public OptionParser { { } - virtual void set(const std::vector<std::string>& arguments); + virtual void set(const std::vector<std::string>& arguments) override; - virtual void setDefault() { _number = _defaultValue; } + virtual void setDefault() override { _number = _defaultValue; } - virtual std::string getArgType(uint32_t /* index */) const + virtual std::string getArgType(uint32_t /* index */) const override { return getTypeName<Number>(); } }; @@ -281,9 +281,9 @@ struct ProgramOptions::BoolOptionParser : public OptionParser { BoolOptionParser(const std::string& nameList, bool& value, const std::string& description); - virtual void set(const std::vector<std::string>&) { _value = true; } + virtual void set(const std::vector<std::string>&) override { _value = true; } - virtual void setDefault() { _value = false; } + virtual void setDefault() override { _value = false; } }; struct ProgramOptions::FlagOptionParser : public OptionParser { @@ -295,9 +295,9 @@ struct ProgramOptions::FlagOptionParser : public OptionParser { FlagOptionParser(const std::string& nameList, bool& value, const bool& unsetValue, const std::string& description); - virtual void set(const std::vector<std::string>&) { _value = !_unsetValue; } + virtual void set(const std::vector<std::string>&) override { _value = !_unsetValue; } - virtual void setDefault() { _value = _unsetValue; } + virtual void setDefault() override { _value = _unsetValue; } }; struct ProgramOptions::StringOptionParser : public OptionParser { @@ -310,12 +310,12 @@ struct ProgramOptions::StringOptionParser : public OptionParser { StringOptionParser(const std::string& nameList, std::string& value, const std::string& defVal, const std::string& desc); - virtual void set(const std::vector<std::string>& arguments) + virtual void set(const std::vector<std::string>& arguments) override { _value = arguments[0]; } - virtual void setDefault() { _value = _defaultValue; } + virtual void setDefault() override { _value = _defaultValue; } - virtual std::string getArgType(uint32_t /* index */) const + virtual std::string getArgType(uint32_t /* index */) const override { return "string"; } }; @@ -327,14 +327,14 @@ struct ProgramOptions::MapOptionParser : public OptionParser { std::map<std::string, std::string>& value, const std::string& description); - virtual void set(const std::vector<std::string>& arguments) + virtual void set(const std::vector<std::string>& arguments) override { _value[arguments[0]] = arguments[1]; } - virtual std::string getArgType(uint32_t /* index */) const + virtual std::string getArgType(uint32_t /* index */) const override { return "string"; } // Default of map is just an empty map. - virtual void setDefault() { _value.clear(); } + virtual void setDefault() override { _value.clear(); } }; template<typename T> @@ -357,8 +357,8 @@ struct ProgramOptions::ListOptionParser : public OptionParser { _entryParser = std::move(entryParser); } - virtual bool isRequired() const { return false; } - virtual void set(const std::vector<std::string>& arguments) { + virtual bool isRequired() const override { return false; } + virtual void set(const std::vector<std::string>& arguments) override { for (uint32_t i=0; i<arguments.size(); ++i) { std::vector<std::string> v; v.push_back(arguments[i]); @@ -366,10 +366,10 @@ struct ProgramOptions::ListOptionParser : public OptionParser { _value.push_back(_singleValue); } } - virtual void setDefault() { + virtual void setDefault() override { _value.clear(); } - virtual std::string getArgType(uint32_t index) const { + virtual std::string getArgType(uint32_t index) const override { return _entryParser->getArgType(index) + "[]"; } }; diff --git a/storage/src/tests/bucketdb/bucketmanagertest.cpp b/storage/src/tests/bucketdb/bucketmanagertest.cpp index 9277429eedd..f9ae4f57fa5 100644 --- a/storage/src/tests/bucketdb/bucketmanagertest.cpp +++ b/storage/src/tests/bucketdb/bucketmanagertest.cpp @@ -153,11 +153,11 @@ public: static constexpr uint32_t MESSAGE_WAIT_TIME = 60*2; - void setUp() { + void setUp() override { _emptyBuckets = 0; } - void tearDown() { + void tearDown() override { } friend class ConcurrentOperationFixture; diff --git a/storage/src/tests/bucketdb/initializertest.cpp b/storage/src/tests/bucketdb/initializertest.cpp index 05e00184ce3..9aa7da92e36 100644 --- a/storage/src/tests/bucketdb/initializertest.cpp +++ b/storage/src/tests/bucketdb/initializertest.cpp @@ -423,7 +423,7 @@ struct FakePersistenceLayer : public StorageLink { } return 0; } - virtual bool onDown(const api::StorageMessage::SP& msg) { + virtual bool onDown(const api::StorageMessage::SP& msg) override { fatalError = ""; if (messageCallback) { messageCallback->onMessage(*msg); @@ -795,7 +795,7 @@ struct DatabaseInsertCallback : MessageCallback _expectedReadBucketPriority(255) {} - void onMessage(const api::StorageMessage& msg) + void onMessage(const api::StorageMessage& msg) override { // Always make sure we're not set as initialized while we're still // processing messages! Also ensure progress never goes down. diff --git a/storage/src/tests/bucketdb/lockablemaptest.cpp b/storage/src/tests/bucketdb/lockablemaptest.cpp index f18e0edc02a..91f273928d6 100644 --- a/storage/src/tests/bucketdb/lockablemaptest.cpp +++ b/storage/src/tests/bucketdb/lockablemaptest.cpp @@ -354,7 +354,7 @@ namespace { struct InsertEraseLoadGiver : public LoadGiver { InsertEraseLoadGiver(Map& map) : LoadGiver(map) {} - void run() { + void run() override { // Screws up order of buckets by xor'ing with 12345. // Only operate on last 32k super buckets. while (running()) { @@ -375,7 +375,7 @@ namespace { struct GetLoadGiver : public LoadGiver { GetLoadGiver(Map& map) : LoadGiver(map) {} - void run() { + void run() override { // It's legal to keep entries as long as you only request higher // buckets. So, to test this, keep entries until you request one // that is smaller than those stored. @@ -395,7 +395,7 @@ namespace { struct AllLoadGiver : public LoadGiver { AllLoadGiver(Map& map) : LoadGiver(map) {} - void run() { + void run() override { while (running()) { _map.all(*this, "foo"); ++_counter; @@ -413,7 +413,7 @@ namespace { struct EachLoadGiver : public LoadGiver { EachLoadGiver(Map& map) : LoadGiver(map) {} - void run() { + void run() override { while (running()) { _map.each(*this, "foo"); ++_counter; @@ -431,7 +431,7 @@ namespace { struct RandomRangeLoadGiver : public LoadGiver { RandomRangeLoadGiver(Map& map) : LoadGiver(map) {} - void run() { + void run() override { while (running()) { uint32_t min = (_counter ^ 23426) % 0x10000; uint32_t max = (_counter ^ 40612) % 0x10000; @@ -460,7 +460,7 @@ namespace { struct GetNextLoadGiver : public LoadGiver { GetNextLoadGiver(Map& map) : LoadGiver(map) {} - void run() { + void run() override { while (running()) { uint32_t bucket = (_counter ^ 60417) % 0xffff; if (_counter % 7 < 5) { diff --git a/storage/src/tests/bucketmover/bucketmovertest.cpp b/storage/src/tests/bucketmover/bucketmovertest.cpp index 2720e6bac2a..3a844b6d1d8 100644 --- a/storage/src/tests/bucketmover/bucketmovertest.cpp +++ b/storage/src/tests/bucketmover/bucketmovertest.cpp @@ -16,8 +16,8 @@ namespace bucketmover { struct BucketMoverTest : public CppUnit::TestFixture { public: - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testNormalUsage(); void testMaxPending(); diff --git a/storage/src/tests/common/dummystoragelink.h b/storage/src/tests/common/dummystoragelink.h index 072d961cbc0..34206e3d271 100644 --- a/storage/src/tests/common/dummystoragelink.h +++ b/storage/src/tests/common/dummystoragelink.h @@ -33,14 +33,14 @@ public: DummyStorageLink(); ~DummyStorageLink(); - bool onDown(const api::StorageMessage::SP&); - bool onUp(const api::StorageMessage::SP&); + bool onDown(const api::StorageMessage::SP&) override; + bool onUp(const api::StorageMessage::SP&) override; void addOnTopOfChain(StorageLink& link) { link.addTestLinkOnTop(this); } - void print(std::ostream& ost, bool verbose, const std::string& indent) const + void print(std::ostream& ost, bool verbose, const std::string& indent) const override { (void) verbose; ost << indent << "DummyStorageLink(" diff --git a/storage/src/tests/common/metricstest.cpp b/storage/src/tests/common/metricstest.cpp index 5ee7d4633ad..8dea2fad94f 100644 --- a/storage/src/tests/common/metricstest.cpp +++ b/storage/src/tests/common/metricstest.cpp @@ -40,8 +40,8 @@ struct MetricsTest : public CppUnit::TestFixture { MetricsTest(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void runLoad(uint32_t count = 1); void createFakeLoad(); @@ -67,9 +67,9 @@ namespace { { framework::Clock& _clock; MetricClock(framework::Clock& c) : _clock(c) {} - virtual time_t getTime() const + virtual time_t getTime() const override { return _clock.getTimeInSeconds().getTime(); } - virtual time_t getTimeInMilliSecs() const + virtual time_t getTimeInMilliSecs() const override { return _clock.getTimeInMillis().getTime(); } }; } diff --git a/storage/src/tests/distributor/blockingoperationstartertest.cpp b/storage/src/tests/distributor/blockingoperationstartertest.cpp index ee0058643d9..2ae8a819d7e 100644 --- a/storage/src/tests/distributor/blockingoperationstartertest.cpp +++ b/storage/src/tests/distributor/blockingoperationstartertest.cpp @@ -40,7 +40,7 @@ public: void testOperationNotBlockedWhenNoMessagesPending(); void testOperationBlockedWhenMessagesPending(); - void setUp(); + void setUp() override; }; CPPUNIT_TEST_SUITE_REGISTRATION(BlockingOperationStarterTest); diff --git a/storage/src/tests/distributor/bucketdatabasetest.cpp b/storage/src/tests/distributor/bucketdatabasetest.cpp index 011b02c8f89..13a8aff239c 100644 --- a/storage/src/tests/distributor/bucketdatabasetest.cpp +++ b/storage/src/tests/distributor/bucketdatabasetest.cpp @@ -73,7 +73,7 @@ namespace { struct ModifyProcessor : public BucketDatabase::MutableEntryProcessor { - bool process(BucketDatabase::Entry& e) { + bool process(BucketDatabase::Entry& e) override { if (e.getBucketId() == document::BucketId(16, 0x0b)) { e.getBucketInfo() = BI(7); } else if (e.getBucketId() == document::BucketId(16, 0x2a)) { @@ -90,7 +90,7 @@ struct ListAllProcessor : public BucketDatabase::EntryProcessor { std::ostringstream ost; - bool process(const BucketDatabase::Entry& e) { + bool process(const BucketDatabase::Entry& e) override { ost << e << "\n"; return true; } @@ -100,7 +100,7 @@ struct DummyProcessor : public BucketDatabase::EntryProcessor { std::ostringstream ost; - bool process(const BucketDatabase::Entry&) { + bool process(const BucketDatabase::Entry&) override { return true; } }; @@ -110,7 +110,7 @@ struct StoppingProcessor : public BucketDatabase::EntryProcessor { std::ostringstream ost; - bool process(const BucketDatabase::Entry& e) { + bool process(const BucketDatabase::Entry& e) override { ost << e << "\n"; if (e.getBucketId() == document::BucketId(16, 0x2a)) { diff --git a/storage/src/tests/distributor/bucketdbupdatertest.cpp b/storage/src/tests/distributor/bucketdbupdatertest.cpp index e0c0a76f3e7..d89ce2a03d0 100644 --- a/storage/src/tests/distributor/bucketdbupdatertest.cpp +++ b/storage/src/tests/distributor/bucketdbupdatertest.cpp @@ -141,11 +141,11 @@ protected: } public: - void setUp() { + void setUp() override { createLinks(); }; - void tearDown() { + void tearDown() override { close(); } @@ -1746,7 +1746,7 @@ struct BucketDumper : public BucketDatabase::EntryProcessor { } - bool process(const BucketDatabase::Entry& e) { + bool process(const BucketDatabase::Entry& e) override { document::BucketId bucketId(e.getBucketId()); ost << (uint32_t)bucketId.getRawId() << ":"; diff --git a/storage/src/tests/distributor/bucketstateoperationtest.cpp b/storage/src/tests/distributor/bucketstateoperationtest.cpp index 67346626ad0..74a31de1541 100644 --- a/storage/src/tests/distributor/bucketstateoperationtest.cpp +++ b/storage/src/tests/distributor/bucketstateoperationtest.cpp @@ -28,12 +28,12 @@ private: void testBucketDbNotUpdatedOnFailure(); public: - void setUp() + void setUp() override { createLinks(); } - void tearDown() + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp index c1b5487717e..e7078f08d0a 100644 --- a/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp +++ b/storage/src/tests/distributor/distributor_host_info_reporter_test.cpp @@ -58,7 +58,7 @@ struct MockedLatencyStatisticsProvider : LatencyStatisticsProvider { NodeStatsSnapshot returnedSnapshot; - NodeStatsSnapshot doGetLatencyStatistics() const { + NodeStatsSnapshot doGetLatencyStatistics() const override { return returnedSnapshot; } }; diff --git a/storage/src/tests/distributor/distributortest.cpp b/storage/src/tests/distributor/distributortest.cpp index 40359ef460f..fc09dc17c1f 100644 --- a/storage/src/tests/distributor/distributortest.cpp +++ b/storage/src/tests/distributor/distributortest.cpp @@ -75,11 +75,11 @@ protected: void configured_safe_time_point_rejection_works_end_to_end(); public: - void setUp() { + void setUp() override { createLinks(); }; - void tearDown() { + void tearDown() override { close(); } @@ -375,7 +375,7 @@ public: StatusRequestThread(StatusReporterDelegate& reporter) : _reporter(reporter) {} - void run(framework::ThreadHandle&) { + void run(framework::ThreadHandle&) override { framework::HttpUrlPath path("/distributor?page=buckets"); std::ostringstream stream; _reporter.reportStatus(stream, path); diff --git a/storage/src/tests/distributor/garbagecollectiontest.cpp b/storage/src/tests/distributor/garbagecollectiontest.cpp index 73d872d3331..7f9098778cf 100644 --- a/storage/src/tests/distributor/garbagecollectiontest.cpp +++ b/storage/src/tests/distributor/garbagecollectiontest.cpp @@ -20,11 +20,11 @@ protected: void testSimple(); public: - void setUp() { + void setUp() override { createLinks(); }; - void tearDown() { + void tearDown() override { close(); } }; diff --git a/storage/src/tests/distributor/getoperationtest.cpp b/storage/src/tests/distributor/getoperationtest.cpp index 15e87e4747b..f50ac81c0ad 100644 --- a/storage/src/tests/distributor/getoperationtest.cpp +++ b/storage/src/tests/distributor/getoperationtest.cpp @@ -52,7 +52,7 @@ public: document::BucketId bucketId; std::unique_ptr<Operation> op; - void setUp() { + void setUp() override { _repo.reset( new document::DocumentTypeRepo(*ConfigGetter<DocumenttypesConfig>:: getConfig("config-doctypes", @@ -63,7 +63,7 @@ public: bucketId = getExternalOperationHandler().getBucketId(docId); }; - void tearDown() { + void tearDown() override { close(); op.reset(); } diff --git a/storage/src/tests/distributor/idealstatemanagertest.cpp b/storage/src/tests/distributor/idealstatemanagertest.cpp index 0522f0d4bc2..2b861d23c5e 100644 --- a/storage/src/tests/distributor/idealstatemanagertest.cpp +++ b/storage/src/tests/distributor/idealstatemanagertest.cpp @@ -20,11 +20,11 @@ class IdealStateManagerTest : public CppUnit::TestFixture, { public: IdealStateManagerTest() {} - void setUp() { + void setUp() override { createLinks(); }; - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/joinbuckettest.cpp b/storage/src/tests/distributor/joinbuckettest.cpp index 2e80605cc47..d817c7f14e0 100644 --- a/storage/src/tests/distributor/joinbuckettest.cpp +++ b/storage/src/tests/distributor/joinbuckettest.cpp @@ -25,11 +25,11 @@ protected: void sendSparseJoinsToNodesWithoutBothSourceBuckets(); public: - void setUp() { + void setUp() override { createLinks(); }; - void tearDown() { + void tearDown() override { close(); } }; diff --git a/storage/src/tests/distributor/maintenanceschedulertest.cpp b/storage/src/tests/distributor/maintenanceschedulertest.cpp index dfc81c1110c..52ae9f6c8a6 100644 --- a/storage/src/tests/distributor/maintenanceschedulertest.cpp +++ b/storage/src/tests/distributor/maintenanceschedulertest.cpp @@ -39,7 +39,7 @@ public: void testSuppressLowPrioritiesInEmergencyMode(); void testPriorityNotClearedIfOperationNotStarted(); - void setUp(); + void setUp() override; }; CPPUNIT_TEST_SUITE_REGISTRATION(MaintenanceSchedulerTest); diff --git a/storage/src/tests/distributor/mapbucketdatabasetest.cpp b/storage/src/tests/distributor/mapbucketdatabasetest.cpp index fbc13d5a8a2..6892f522bba 100644 --- a/storage/src/tests/distributor/mapbucketdatabasetest.cpp +++ b/storage/src/tests/distributor/mapbucketdatabasetest.cpp @@ -13,7 +13,7 @@ namespace distributor { struct MapBucketDatabaseTest : public BucketDatabaseTest { MapBucketDatabase _db; - virtual BucketDatabase& db() { return _db; }; + virtual BucketDatabase& db() override { return _db; } CPPUNIT_TEST_SUITE(MapBucketDatabaseTest); SETUP_DATABASE_TESTS(); diff --git a/storage/src/tests/distributor/mergeoperationtest.cpp b/storage/src/tests/distributor/mergeoperationtest.cpp index bd71b69673a..875d16a42ed 100644 --- a/storage/src/tests/distributor/mergeoperationtest.cpp +++ b/storage/src/tests/distributor/mergeoperationtest.cpp @@ -41,13 +41,13 @@ protected: void onlyMarkRedundantRetiredReplicasAsSourceOnly(); public: - void setUp() { + void setUp() override { createLinks(); _pendingTracker.reset(new PendingMessageTracker(getComponentRegister())); _sender.setPendingMessageTracker(*_pendingTracker); } - void tearDown() { + void tearDown() override { close(); } }; diff --git a/storage/src/tests/distributor/operationtargetresolvertest.cpp b/storage/src/tests/distributor/operationtargetresolvertest.cpp index 36dc849d964..26144ac950e 100644 --- a/storage/src/tests/distributor/operationtargetresolvertest.cpp +++ b/storage/src/tests/distributor/operationtargetresolvertest.cpp @@ -44,7 +44,7 @@ struct OperationTargetResolverTest : public CppUnit::TestFixture, BucketInstanceList getInstances(const BucketId& bid, bool stripToRedundancy); - void setUp() { + void setUp() override { _repo.reset(new document::DocumentTypeRepo( *config::ConfigGetter<document::DocumenttypesConfig>::getConfig( "config-doctypes", @@ -53,7 +53,7 @@ struct OperationTargetResolverTest : public CppUnit::TestFixture, createLinks(); }; - void tearDown() { + void tearDown() override { close(); } @@ -84,7 +84,7 @@ namespace { { \ struct MyAsserter : public Asserter { \ void assertEqualMsg(std::string t1, OperationTargetList t2, \ - OperationTargetList t3) { \ + OperationTargetList t3) override { \ CPPUNIT_ASSERT_EQUAL_MSG(t1, t2, t3); \ } \ }; \ diff --git a/storage/src/tests/distributor/pendingmessagetrackertest.cpp b/storage/src/tests/distributor/pendingmessagetrackertest.cpp index c83fbbe143b..6f4539d426e 100644 --- a/storage/src/tests/distributor/pendingmessagetrackertest.cpp +++ b/storage/src/tests/distributor/pendingmessagetrackertest.cpp @@ -412,7 +412,7 @@ public: TestChecker() : pri(UINT8_MAX) {} - bool check(uint32_t msgType, uint16_t node, uint8_t p) { + bool check(uint32_t msgType, uint16_t node, uint8_t p) override { (void) node; if (msgType == api::MessageType::REMOVE_ID) { pri = p; diff --git a/storage/src/tests/distributor/putoperationtest.cpp b/storage/src/tests/distributor/putoperationtest.cpp index 5c156411e11..83b99460f2c 100644 --- a/storage/src/tests/distributor/putoperationtest.cpp +++ b/storage/src/tests/distributor/putoperationtest.cpp @@ -90,7 +90,7 @@ protected: void doTestCreationWithBucketActivationDisabled(bool disabled); public: - void setUp() { + void setUp() override { _repo.reset( new DocumentTypeRepo(*ConfigGetter<DocumenttypesConfig> ::getConfig("config-doctypes", @@ -99,7 +99,7 @@ public: createLinks(); }; - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/removebucketoperationtest.cpp b/storage/src/tests/distributor/removebucketoperationtest.cpp index 7cf63a3146f..177f66eaec5 100644 --- a/storage/src/tests/distributor/removebucketoperationtest.cpp +++ b/storage/src/tests/distributor/removebucketoperationtest.cpp @@ -26,11 +26,11 @@ protected: void testFailWithInvalidBucketInfo(); public: - void setUp() { + void setUp() override { createLinks(); }; - void tearDown() { + void tearDown() override { close(); } }; diff --git a/storage/src/tests/distributor/removelocationtest.cpp b/storage/src/tests/distributor/removelocationtest.cpp index 954bfb6210b..876a01e4a6f 100644 --- a/storage/src/tests/distributor/removelocationtest.cpp +++ b/storage/src/tests/distributor/removelocationtest.cpp @@ -24,11 +24,11 @@ protected: public: std::unique_ptr<RemoveLocationOperation> op; - void setUp() { + void setUp() override { createLinks(); }; - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/removeoperationtest.cpp b/storage/src/tests/distributor/removeoperationtest.cpp index 9d0849962e4..a8f635b19e2 100644 --- a/storage/src/tests/distributor/removeoperationtest.cpp +++ b/storage/src/tests/distributor/removeoperationtest.cpp @@ -38,7 +38,7 @@ public: document::BucketId bucketId; std::unique_ptr<RemoveOperation> op; - void setUp() { + void setUp() override { createLinks(); docId = document::DocumentId(document::DocIdString("test", "uri")); @@ -46,7 +46,7 @@ public: _distributor->enableClusterState(lib::ClusterState("distributor:1 storage:4")); }; - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/simplemaintenancescannertest.cpp b/storage/src/tests/distributor/simplemaintenancescannertest.cpp index 3486f41149b..100d5582006 100644 --- a/storage/src/tests/distributor/simplemaintenancescannertest.cpp +++ b/storage/src/tests/distributor/simplemaintenancescannertest.cpp @@ -51,7 +51,7 @@ public: void perNodeMaintenanceStatsAreTracked(); void testReset(); - void setUp(); + void setUp() override; }; CPPUNIT_TEST_SUITE_REGISTRATION(SimpleMaintenanceScannerTest); diff --git a/storage/src/tests/distributor/splitbuckettest.cpp b/storage/src/tests/distributor/splitbuckettest.cpp index c69af0e038c..de99884b52b 100644 --- a/storage/src/tests/distributor/splitbuckettest.cpp +++ b/storage/src/tests/distributor/splitbuckettest.cpp @@ -42,14 +42,14 @@ protected: public: SplitOperationTest(); - void setUp() { + void setUp() override { createLinks(); getConfig().setSplitCount(splitCount); getConfig().setSplitSize(splitByteSize); } - void tearDown() { + void tearDown() override { close(); } }; diff --git a/storage/src/tests/distributor/statecheckerstest.cpp b/storage/src/tests/distributor/statecheckerstest.cpp index f09c93622de..c9ab8a0aa78 100644 --- a/storage/src/tests/distributor/statecheckerstest.cpp +++ b/storage/src/tests/distributor/statecheckerstest.cpp @@ -31,11 +31,11 @@ struct StateCheckersTest : public CppUnit::TestFixture, { StateCheckersTest() {} - void setUp() { + void setUp() override { createLinks(); } - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/statoperationtest.cpp b/storage/src/tests/distributor/statoperationtest.cpp index f35869cf680..3526e789c96 100644 --- a/storage/src/tests/distributor/statoperationtest.cpp +++ b/storage/src/tests/distributor/statoperationtest.cpp @@ -14,11 +14,11 @@ namespace distributor { struct StatOperationTest : public CppUnit::TestFixture, public DistributorTestUtil { - void setUp() { + void setUp() override { createLinks(); }; - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/statusreporterdelegatetest.cpp b/storage/src/tests/distributor/statusreporterdelegatetest.cpp index f05eebed0ce..f136b00244a 100644 --- a/storage/src/tests/distributor/statusreporterdelegatetest.cpp +++ b/storage/src/tests/distributor/statusreporterdelegatetest.cpp @@ -26,7 +26,7 @@ namespace { class MockDelegator : public StatusDelegator { mutable std::ostringstream _calls; - bool handleStatusRequest(const DelegatedStatusRequest& request) const { + bool handleStatusRequest(const DelegatedStatusRequest& request) const override { _calls << "Request(" << request.path << ")"; return request.reporter.reportStatus(request.outputStream, request.path); } @@ -43,13 +43,13 @@ public: : framework::StatusReporter("foo", "Bar") {} vespalib::string getReportContentType( - const framework::HttpUrlPath&) const + const framework::HttpUrlPath&) const override { return "foo/bar"; } bool reportStatus(std::ostream& os, - const framework::HttpUrlPath& path) const + const framework::HttpUrlPath& path) const override { os << "reportStatus with " << path; return true; diff --git a/storage/src/tests/distributor/throttlingoperationstartertest.cpp b/storage/src/tests/distributor/throttlingoperationstartertest.cpp index 5c4ba99563c..8e7d98005c1 100644 --- a/storage/src/tests/distributor/throttlingoperationstartertest.cpp +++ b/storage/src/tests/distributor/throttlingoperationstartertest.cpp @@ -38,8 +38,8 @@ public: void testStartingOperationsFillsUpPendingWindow(); void testFinishingOperationsAllowsMoreToStart(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; }; CPPUNIT_TEST_SUITE_REGISTRATION(ThrottlingOperationStarterTest); diff --git a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp index 8556f5b5229..fb65e57928e 100644 --- a/storage/src/tests/distributor/twophaseupdateoperationtest.cpp +++ b/storage/src/tests/distributor/twophaseupdateoperationtest.cpp @@ -104,7 +104,7 @@ protected: std::string getUpdatedValueFromLastPut(MessageSenderStub&); public: - void setUp() { + void setUp() override { _repo = _testRepo.getTypeRepoSp(); _doc_type = _repo->getDocumentType("testdoctype1"); createLinks(); @@ -112,7 +112,7 @@ public: getClock().setAbsoluteTimeInSeconds(200); } - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/updateoperationtest.cpp b/storage/src/tests/distributor/updateoperationtest.cpp index 1c47e0a8f05..9c4d1f87fe4 100644 --- a/storage/src/tests/distributor/updateoperationtest.cpp +++ b/storage/src/tests/distributor/updateoperationtest.cpp @@ -43,7 +43,7 @@ protected: void testMultiNodeInconsistentTimestamp(); public: - void setUp() { + void setUp() override { _repo.reset( new DocumentTypeRepo(*ConfigGetter<DocumenttypesConfig>:: getConfig("config-doctypes", @@ -52,7 +52,7 @@ public: createLinks(); } - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/distributor/visitoroperationtest.cpp b/storage/src/tests/distributor/visitoroperationtest.cpp index caf326a8720..331a3435485 100644 --- a/storage/src/tests/distributor/visitoroperationtest.cpp +++ b/storage/src/tests/distributor/visitoroperationtest.cpp @@ -120,13 +120,13 @@ public: 100) {} - void setUp() { + void setUp() override { createLinks(); nullId = document::BucketId(0, 0); doneId = document::BucketId(INT_MAX); }; - void tearDown() { + void tearDown() override { close(); } diff --git a/storage/src/tests/frameworkimpl/memory/memorystatusviewertest.cpp b/storage/src/tests/frameworkimpl/memory/memorystatusviewertest.cpp index 7a03d1c017a..c1e7660323c 100644 --- a/storage/src/tests/frameworkimpl/memory/memorystatusviewertest.cpp +++ b/storage/src/tests/frameworkimpl/memory/memorystatusviewertest.cpp @@ -17,7 +17,7 @@ struct MemoryStatusViewerTest : public CppUnit::TestFixture std::unique_ptr<TestServiceLayerApp> _node; std::unique_ptr<framework::defaultimplementation::MemoryManager> _memMan; - void setUp(); + void setUp() override; void testEmptyState(); void testSnapshots(); diff --git a/storage/src/tests/frameworkimpl/status/statustest.cpp b/storage/src/tests/frameworkimpl/status/statustest.cpp index 0fc10e411cb..567f9192d34 100644 --- a/storage/src/tests/frameworkimpl/status/statustest.cpp +++ b/storage/src/tests/frameworkimpl/status/statustest.cpp @@ -17,7 +17,7 @@ namespace storage { struct StatusTest : public CppUnit::TestFixture { std::unique_ptr<TestServiceLayerApp> _node; - void setUp(); + void setUp() override; void testIndexStatusPage(); void testHtmlStatus(); @@ -51,13 +51,13 @@ namespace { } virtual void reportHtmlHeaderAdditions( - std::ostream& out, const framework::HttpUrlPath&) const + std::ostream& out, const framework::HttpUrlPath&) const override { out << _headerAddition; } virtual void reportHtmlStatus( - std::ostream& out, const framework::HttpUrlPath&) const + std::ostream& out, const framework::HttpUrlPath&) const override { out << _content; } @@ -68,7 +68,7 @@ namespace { : framework::XmlStatusReporter(id, name) {} virtual vespalib::string reportXmlStatus( vespalib::xml::XmlOutputStream& xos, - const framework::HttpUrlPath&) const + const framework::HttpUrlPath&) const override { xos << vespalib::xml::XmlTag("mytag") << vespalib::xml::XmlAttribute("foo", "bar") diff --git a/storage/src/tests/persistence/bucketownershipnotifiertest.cpp b/storage/src/tests/persistence/bucketownershipnotifiertest.cpp index ae54e629473..8553795db71 100644 --- a/storage/src/tests/persistence/bucketownershipnotifiertest.cpp +++ b/storage/src/tests/persistence/bucketownershipnotifiertest.cpp @@ -19,7 +19,7 @@ public: _clusterState("distributor:2 storage:1") {} - void setUp(); + void setUp() override; CPPUNIT_TEST_SUITE(BucketOwnershipNotifierTest); CPPUNIT_TEST(testSendNotifyBucketChangeIfOwningDistributorChanged); diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index bf7528c2242..e21d367370b 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -77,8 +77,8 @@ struct FileStorManagerTest : public CppUnit::TestFixture { FileStorManagerTest() : _node(), _waitTime(LONG_WAITTIME) {} - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testPut(); void testHeaderOnlyPut(); @@ -686,7 +686,7 @@ public: MessagePusherThread(FileStorHandler& handler, Document::SP doc); ~MessagePusherThread(); - void run() { + void run() override { while (!_done) { document::BucketIdFactory factory; document::BucketId bucket(16, factory.getBucketId( @@ -720,7 +720,7 @@ public: : _handler(handler), _config(0), _fetchedCount(0), _done(false), _failed(false), _threadDone(false) {} - void run() { + void run() override { while (!_done) { FileStorHandler::LockedMessage msg = _handler.getNextMessage(0, 255); if (msg.second.get()) { @@ -1160,7 +1160,7 @@ public: PausedThread(FileStorHandler& handler) : _handler(handler), pause(false), done(false), gotoperation(false) {} - void run() { + void run() override { FileStorHandler::LockedMessage msg = _handler.getNextMessage(0, 255); gotoperation = true; @@ -2364,10 +2364,10 @@ namespace { closeNextLink(); } - virtual void print(std::ostream& out, bool, const std::string&) const + virtual void print(std::ostream& out, bool, const std::string&) const override { out << "MidLink"; } - virtual bool onUp(const std::shared_ptr<api::StorageMessage> & msg) { + virtual bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { if (!StorageLinkTest::callOnUp(_up, msg)) _up.sendUp(msg); return true; } @@ -2395,10 +2395,10 @@ namespace { _leftAddr(leftAddr), _rightAddr(rightAddr) {} - virtual void print(std::ostream& out, bool, const std::string&) const + virtual void print(std::ostream& out, bool, const std::string&) const override { out << "BinaryStorageLink"; } - virtual bool onDown(const std::shared_ptr<api::StorageMessage> & msg) { + virtual bool onDown(const std::shared_ptr<api::StorageMessage> & msg) override { // LOG(debug, "onDown Received msg: ->%s, %s %llu\n", msg->getAddress() ? msg->getAddress()->toString().c_str() : "(null)", msg->toString().c_str(), msg->getMsgId()); vespalib::LockGuard lock(_lock); @@ -2432,7 +2432,8 @@ namespace { return true; } - virtual bool onUp(const std::shared_ptr<api::StorageMessage> & msg) { // LOG(debug, "onUp Received msg: ->%s, %s %llu\n", msg->getAddress() ? msg->getAddress()->toString().c_str() : "(null)", msg->toString().c_str(), msg->getMsgId()); + virtual bool onUp(const std::shared_ptr<api::StorageMessage> & msg) override { + // LOG(debug, "onUp Received msg: ->%s, %s %llu\n", msg->getAddress() ? msg->getAddress()->toString().c_str() : "(null)", msg->toString().c_str(), msg->getMsgId()); vespalib::LockGuard lock(_lock); std::set<api::StorageMessage::Id>::iterator it @@ -2455,17 +2456,17 @@ namespace { } } - void onFlush(bool downwards) { + void onFlush(bool downwards) override { if (downwards) { _left.flush(); _right.flush(); } } - void onOpen() { + void onOpen() override { _left.open(); _right.open(); } - void onClose() { + void onClose() override { _left.close(); _right.close(); } diff --git a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp index 8d6a8fb8e03..d608bef3307 100644 --- a/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormodifiedbucketstest.cpp @@ -45,7 +45,7 @@ struct BucketCheckerInjector : FileStorTestFixture::StorageLinkInjector : _node(node), _fixture(fixture) {} - void inject(DummyStorageLink& link) const { + void inject(DummyStorageLink& link) const override { link.push_back(std::unique_ptr<ModifiedBucketChecker>( new ModifiedBucketChecker(_node.getComponentRegister(), _node.getPersistenceProvider(), diff --git a/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp b/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp index 848799fde95..2dc60594c45 100644 --- a/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp +++ b/storage/src/tests/persistence/filestorage/modifiedbucketcheckertest.cpp @@ -19,8 +19,8 @@ public: MESSAGE_WAIT_TIME = 60*2 }; - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testModifiedBucketThreadSendsRecheckBucketCommands(); void testDoNotCheckModifiedBucketsIfAlreadyPending(); diff --git a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp index 6dce437033d..a661c5c445e 100644 --- a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp +++ b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp @@ -275,7 +275,7 @@ public: _downLink(downLink) {} - void run() { + void run() override { // Best-effort synchronized starting _queueBarrier.await(); _downLink.sendDown(_abortCmd); diff --git a/storage/src/tests/persistence/legacyoperationhandlertest.cpp b/storage/src/tests/persistence/legacyoperationhandlertest.cpp index ca496f4a260..df262501299 100644 --- a/storage/src/tests/persistence/legacyoperationhandlertest.cpp +++ b/storage/src/tests/persistence/legacyoperationhandlertest.cpp @@ -27,7 +27,7 @@ class LegacyOperationHandlerTest : public SingleDiskPersistenceTestUtils CPPUNIT_TEST_SUITE_END(); public: - void setUp() { + void setUp() override { SingleDiskPersistenceTestUtils::setUp(); createBucket(document::BucketId(16, 4)); spi::Context context(spi::LoadType(0, "default"), spi::Priority(0), diff --git a/storage/src/tests/persistence/mergehandlertest.cpp b/storage/src/tests/persistence/mergehandlertest.cpp index 87db1f09bd3..8147992a516 100644 --- a/storage/src/tests/persistence/mergehandlertest.cpp +++ b/storage/src/tests/persistence/mergehandlertest.cpp @@ -28,7 +28,7 @@ struct MergeHandlerTest : public SingleDiskPersistenceTestUtils template <typename T> std::shared_ptr<T> fetchSingleMessage(); - void setUp(); + void setUp() override; enum ChainPos { FRONT, MIDDLE, BACK }; void setUpChain(ChainPos); @@ -129,7 +129,7 @@ private: : public HandlerInvoker { public: - std::string afterInvoke(MergeHandlerTest&, MergeHandler&); + std::string afterInvoke(MergeHandlerTest&, MergeHandler&) override; }; template <typename ExpectedMessage> @@ -139,21 +139,21 @@ private: : public NoReplyHandlerInvoker { public: - void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&); + void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&) override; }; class HandleMergeBucketReplyInvoker : public NoReplyHandlerInvoker { public: - void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&); + void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&) override; }; class HandleGetBucketDiffInvoker : public NoReplyHandlerInvoker { public: - void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&); + void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&) override; }; class MultiPositionHandlerInvoker @@ -176,9 +176,9 @@ private: public: HandleGetBucketDiffReplyInvoker(); ~HandleGetBucketDiffReplyInvoker(); - void beforeInvoke(MergeHandlerTest&, MergeHandler&, spi::Context&); - void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&); - std::string afterInvoke(MergeHandlerTest&, MergeHandler&); + void beforeInvoke(MergeHandlerTest&, MergeHandler&, spi::Context&) override; + void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&) override; + std::string afterInvoke(MergeHandlerTest&, MergeHandler&) override; private: MessageSenderStub _stub; std::shared_ptr<api::GetBucketDiffCommand> _diffCmd; @@ -189,7 +189,7 @@ private: { public: HandleApplyBucketDiffInvoker() : _counter(0) {} - void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&); + void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&) override; private: int _counter; }; @@ -200,9 +200,9 @@ private: public: HandleApplyBucketDiffReplyInvoker(); ~HandleApplyBucketDiffReplyInvoker(); - void beforeInvoke(MergeHandlerTest&, MergeHandler&, spi::Context&); - void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&); - std::string afterInvoke(MergeHandlerTest&, MergeHandler&); + void beforeInvoke(MergeHandlerTest&, MergeHandler&, spi::Context&) override; + void invoke(MergeHandlerTest&, MergeHandler&, spi::Context&) override; + std::string afterInvoke(MergeHandlerTest&, MergeHandler&) override; private: int _counter; MessageSenderStub _stub; diff --git a/storage/src/tests/persistence/providershutdownwrappertest.cpp b/storage/src/tests/persistence/providershutdownwrappertest.cpp index 1d2bf08e0c4..8b1ef88aa2c 100644 --- a/storage/src/tests/persistence/providershutdownwrappertest.cpp +++ b/storage/src/tests/persistence/providershutdownwrappertest.cpp @@ -28,7 +28,7 @@ class TestShutdownListener public: TestShutdownListener() : _reason() {} - void requestShutdown(vespalib::stringref reason) { + void requestShutdown(vespalib::stringref reason) override { _reason = reason; } diff --git a/storage/src/tests/storageserver/bouncertest.cpp b/storage/src/tests/storageserver/bouncertest.cpp index f00e4b19c31..e5b9a3e6092 100644 --- a/storage/src/tests/storageserver/bouncertest.cpp +++ b/storage/src/tests/storageserver/bouncertest.cpp @@ -25,8 +25,8 @@ struct BouncerTest : public CppUnit::TestFixture { BouncerTest(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testFutureTimestamp(); void testAllowNotifyBucketChangeEvenWhenDistributorDown(); diff --git a/storage/src/tests/storageserver/bucketintegritycheckertest.cpp b/storage/src/tests/storageserver/bucketintegritycheckertest.cpp index 88a5546b174..d9a175f3b04 100644 --- a/storage/src/tests/storageserver/bucketintegritycheckertest.cpp +++ b/storage/src/tests/storageserver/bucketintegritycheckertest.cpp @@ -25,7 +25,7 @@ struct BucketIntegrityCheckerTest : public CppUnit::TestFixture { std::unique_ptr<TestServiceLayerApp> _node; int _timeout; // Timeout in seconds before aborting - void setUp() { + void setUp() override { _timeout = 60*2; _config.reset(new vdstestlib::DirConfig(getStandardConfig(true))); _node.reset(new TestServiceLayerApp(DiskCount(256), @@ -33,7 +33,7 @@ struct BucketIntegrityCheckerTest : public CppUnit::TestFixture { _config->getConfigId())); } - void tearDown() { + void tearDown() override { LOG(info, "Finished test"); } diff --git a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp index 3b83d71d8f3..8eb6b74a840 100644 --- a/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp +++ b/storage/src/tests/storageserver/changedbucketownershiphandlertest.cpp @@ -119,7 +119,7 @@ public: void testExternalLoadOpAbortUpdatesMetric(); void testExternalLoadOpAbortsAreConfigurable(); - void setUp(); + void setUp() override; }; CPPUNIT_TEST_SUITE_REGISTRATION(ChangedBucketOwnershipHandlerTest); diff --git a/storage/src/tests/storageserver/documentapiconvertertest.cpp b/storage/src/tests/storageserver/documentapiconvertertest.cpp index 5c5c5627feb..1f1198efc3c 100644 --- a/storage/src/tests/storageserver/documentapiconvertertest.cpp +++ b/storage/src/tests/storageserver/documentapiconvertertest.cpp @@ -34,7 +34,7 @@ struct DocumentApiConverterTest : public CppUnit::TestFixture { } - void setUp() { + void setUp() override { _converter.reset(new DocumentApiConverter("raw:")); }; diff --git a/storage/src/tests/storageserver/mergethrottlertest.cpp b/storage/src/tests/storageserver/mergethrottlertest.cpp index a5e637146fc..8a01acd6a68 100644 --- a/storage/src/tests/storageserver/mergethrottlertest.cpp +++ b/storage/src/tests/storageserver/mergethrottlertest.cpp @@ -135,8 +135,8 @@ class MergeThrottlerTest : public CppUnit::TestFixture CPPUNIT_TEST(testNewClusterStateAbortsAllOutdatedActiveMerges); CPPUNIT_TEST_SUITE_END(); public: - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testMergesConfig(); void testChain(); diff --git a/storage/src/tests/storageserver/priorityconvertertest.cpp b/storage/src/tests/storageserver/priorityconvertertest.cpp index ecbdcfb6b91..ecbbd25b8b1 100644 --- a/storage/src/tests/storageserver/priorityconvertertest.cpp +++ b/storage/src/tests/storageserver/priorityconvertertest.cpp @@ -11,7 +11,7 @@ struct PriorityConverterTest : public CppUnit::TestFixture { std::unique_ptr<PriorityConverter> _converter; - void setUp() { + void setUp() override { vdstestlib::DirConfig config(getStandardConfig(true)); _converter.reset(new PriorityConverter(config.getConfigId())); }; diff --git a/storage/src/tests/storageserver/statemanagertest.cpp b/storage/src/tests/storageserver/statemanagertest.cpp index 83fad3a7484..4244ce0c4ce 100644 --- a/storage/src/tests/storageserver/statemanagertest.cpp +++ b/storage/src/tests/storageserver/statemanagertest.cpp @@ -31,8 +31,8 @@ struct StateManagerTest : public CppUnit::TestFixture { StateManagerTest(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testSystemState(); void testReportedNodeState(); @@ -138,7 +138,7 @@ namespace { MyStateListener(const NodeStateUpdater& upd) : updater(upd), current(*updater.getReportedNodeState()) {} - void handleNewState() + void handleNewState() override { ost << current << " -> "; current = *updater.getReportedNodeState(); diff --git a/storage/src/tests/storageserver/statereportertest.cpp b/storage/src/tests/storageserver/statereportertest.cpp index 87686f06d6c..265b9e95d83 100644 --- a/storage/src/tests/storageserver/statereportertest.cpp +++ b/storage/src/tests/storageserver/statereportertest.cpp @@ -18,8 +18,8 @@ namespace storage { class DummyApplicationGenerationFether : public ApplicationGenerationFetcher { public: - virtual int64_t getGeneration() const { return 1; } - virtual std::string getComponentName() const { return "component"; } + virtual int64_t getGeneration() const override { return 1; } + virtual std::string getComponentName() const override { return "component"; } }; struct StateReporterTest : public CppUnit::TestFixture { @@ -36,8 +36,8 @@ struct StateReporterTest : public CppUnit::TestFixture { StateReporterTest(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void runLoad(uint32_t count = 1); void testReportConfigGeneration(); @@ -58,9 +58,9 @@ namespace { { framework::Clock& _clock; MetricClock(framework::Clock& c) : _clock(c) {} - virtual time_t getTime() const + virtual time_t getTime() const override { return _clock.getTimeInSeconds().getTime(); } - virtual time_t getTimeInMilliSecs() const + virtual time_t getTimeInMilliSecs() const override { return _clock.getTimeInMillis().getTime(); } }; } diff --git a/storage/src/tests/storageutil/charttest.cpp b/storage/src/tests/storageutil/charttest.cpp index d9ce3d6f1b4..4f83a9f26f4 100644 --- a/storage/src/tests/storageutil/charttest.cpp +++ b/storage/src/tests/storageutil/charttest.cpp @@ -10,8 +10,8 @@ namespace storage { struct PieChartTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testWriteHtmlFile(); diff --git a/storage/src/tests/storageutil/palettetest.cpp b/storage/src/tests/storageutil/palettetest.cpp index ffc2dd091ee..e5a4e73d58a 100644 --- a/storage/src/tests/storageutil/palettetest.cpp +++ b/storage/src/tests/storageutil/palettetest.cpp @@ -7,8 +7,8 @@ namespace storage { struct PaletteTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testNormalUsage(); diff --git a/storage/src/tests/visiting/visitormanagertest.cpp b/storage/src/tests/visiting/visitormanagertest.cpp index f83ac825aa4..8aa57b982db 100644 --- a/storage/src/tests/visiting/visitormanagertest.cpp +++ b/storage/src/tests/visiting/visitormanagertest.cpp @@ -70,7 +70,7 @@ public: // Not using setUp since can't throw exception out of it. void initializeTest(); void addSomeRemoves(bool removeAll = false); - void tearDown(); + void tearDown() override; TestVisitorMessageSession& getSession(uint32_t n); uint64_t verifyCreateVisitorReply( api::ReturnCode::Result expectedResult, diff --git a/storage/src/tests/visiting/visitortest.cpp b/storage/src/tests/visiting/visitortest.cpp index 1e2eda75cc8..e6a3542cbf2 100644 --- a/storage/src/tests/visiting/visitortest.cpp +++ b/storage/src/tests/visiting/visitortest.cpp @@ -127,7 +127,7 @@ public: std::shared_ptr<api::CreateVisitorCommand> makeCreateVisitor( const VisitorOptions& options = VisitorOptions()); - void tearDown(); + void tearDown() override; bool waitUntilNoActiveVisitors(); TestVisitorMessageSession& getSession(uint32_t n); uint64_t verifyCreateVisitorReply( diff --git a/storage/src/vespa/storage/bucketdb/bucketdatabase.cpp b/storage/src/vespa/storage/bucketdb/bucketdatabase.cpp index 2c229052fc5..596d6cee31e 100644 --- a/storage/src/vespa/storage/bucketdb/bucketdatabase.cpp +++ b/storage/src/vespa/storage/bucketdb/bucketdatabase.cpp @@ -8,7 +8,7 @@ namespace { struct GetNextEntryProcessor : public BucketDatabase::EntryProcessor { BucketDatabase::Entry _entry; - bool process(const BucketDatabase::Entry& e) { + bool process(const BucketDatabase::Entry& e) override { _entry = e; return false; } diff --git a/storage/src/vespa/storage/bucketdb/bucketmanager.h b/storage/src/vespa/storage/bucketdb/bucketmanager.h index c9ae4be8069..64498386466 100644 --- a/storage/src/vespa/storage/bucketdb/bucketmanager.h +++ b/storage/src/vespa/storage/bucketdb/bucketmanager.h @@ -103,8 +103,7 @@ public: void startWorkerThread(); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Dump the whole database to the given output. Use for debugging. */ void dump(std::ostream& out) const; @@ -115,25 +114,23 @@ public: private: friend class BucketManagerTest; - void run(framework::ThreadHandle&); + void run(framework::ThreadHandle&) override; // Status::Reporter implementation - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const; - bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const; + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; /** Event saying node is up and running. We can start to build cache. */ - virtual void onOpen(); - virtual void onDoneInit() { _doneInitialized = true; } - virtual void onClose(); - virtual void onFlush(bool downwards); + virtual void onOpen() override; + virtual void onDoneInit() override { _doneInitialized = true; } + virtual void onClose() override; + virtual void onFlush(bool downwards) override; void updateMetrics(bool updateDocCount); void updateMetrics(const MetricLockGuard &) override { updateMetrics(true); } void updateMinUsedBits(); - bool onRequestBucketInfo( - const std::shared_ptr<api::RequestBucketInfoCommand>&); + bool onRequestBucketInfo(const std::shared_ptr<api::RequestBucketInfoCommand>&) override; bool processRequestBucketInfoCommands(BIList&); /** diff --git a/storage/src/vespa/storage/bucketdb/judyarray.h b/storage/src/vespa/storage/bucketdb/judyarray.h index 1c68e84084c..b5d8a50cb16 100644 --- a/storage/src/vespa/storage/bucketdb/judyarray.h +++ b/storage/src/vespa/storage/bucketdb/judyarray.h @@ -83,8 +83,7 @@ public: data_type& operator[](key_type key); size_type getMemoryUsage() const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; class ConstIterator : public vespalib::Printable { @@ -102,8 +101,7 @@ public: key_type key() const { return _key; } data_type value() const { return *_data; } - virtual void print(std::ostream& out, - bool verbose, const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; protected: // For creating end() iterator diff --git a/storage/src/vespa/storage/bucketdb/lockablemap.h b/storage/src/vespa/storage/bucketdb/lockablemap.h index 2670683f7e3..93dfb23c4db 100644 --- a/storage/src/vespa/storage/bucketdb/lockablemap.h +++ b/storage/src/vespa/storage/bucketdb/lockablemap.h @@ -168,8 +168,7 @@ public: const char* clientId, uint32_t chunkSize = DEFAULT_CHUNK_SIZE); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * Returns all buckets in the bucket database that can contain the given diff --git a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp index 243deac5034..a271803714a 100644 --- a/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp +++ b/storage/src/vespa/storage/bucketdb/mapbucketdatabase.cpp @@ -465,7 +465,7 @@ namespace { struct Writer : public BucketDatabase::EntryProcessor { std::ostream& _ost; Writer(std::ostream& ost) : _ost(ost) {} - virtual bool process(const BucketDatabase::Entry& e) { + virtual bool process(const BucketDatabase::Entry& e) override { _ost << e.toString() << "\n"; return true; } diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h index 94afc5b2e1a..6e9bef38672 100644 --- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h +++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h @@ -138,23 +138,22 @@ public: ServiceLayerComponentRegister&); ~StorageBucketDBInitializer(); - virtual void print(std::ostream& out, - bool verbose, const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual void onOpen(); - virtual void onClose(); + virtual void onOpen() override; + virtual void onClose() override; - virtual void run(framework::ThreadHandle&); + virtual void run(framework::ThreadHandle&) override; - bool onDown(const std::shared_ptr<api::StorageMessage>&); - bool onInternalReply(const std::shared_ptr<api::InternalReply>&); + bool onDown(const std::shared_ptr<api::StorageMessage>&) override; + bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; void handleReadBucketListReply(ReadBucketListReply&); void handleReadBucketInfoReply(ReadBucketInfoReply&); void handleInternalBucketJoinReply(InternalBucketJoinReply&); /** Status implementation. */ - void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const; + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; // The below functions should only be called by the class itself, but they // are left public for easability of access for unit tests and anonymous diff --git a/storage/src/vespa/storage/bucketmover/run.h b/storage/src/vespa/storage/bucketmover/run.h index 292b18f63a5..a626960eec7 100644 --- a/storage/src/vespa/storage/bucketmover/run.h +++ b/storage/src/vespa/storage/bucketmover/run.h @@ -92,8 +92,7 @@ public: RunStatistics& getStatistics() { return _statistics; } const RunStatistics& getStatistics() const { return _statistics; } - virtual void print(std::ostream&, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream&, bool verbose, const std::string& indent) const override; private: void removePending(Move&); void finalize(); diff --git a/storage/src/vespa/storage/common/bucketmessages.h b/storage/src/vespa/storage/common/bucketmessages.h index a690b42804f..6c0fbbf4ea2 100644 --- a/storage/src/vespa/storage/common/bucketmessages.h +++ b/storage/src/vespa/storage/common/bucketmessages.h @@ -27,7 +27,7 @@ public: ~ReadBucketList(); spi::PartitionId getPartition() const { return _partition; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; @@ -78,10 +78,10 @@ public: ReadBucketInfo(const document::BucketId& bucketId); ~ReadBucketInfo(); - document::BucketId getBucketId() const { return _bucketId; } + document::BucketId getBucketId() const override { return _bucketId; } bool hasSingleBucketId() const override { return true; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; private: @@ -102,7 +102,7 @@ public: ReadBucketInfoReply(const ReadBucketInfo& cmd); ~ReadBucketInfoReply(); - document::BucketId getBucketId() const { return _bucketId; } + document::BucketId getBucketId() const override { return _bucketId; } bool hasSingleBucketId() const override { return true; } void print(std::ostream& out, bool verbose, const std::string& indent) const override; @@ -133,7 +133,7 @@ public: ~RepairBucketCommand(); bool hasSingleBucketId() const override { return true; } - document::BucketId getBucketId() const { return _bucket; } + document::BucketId getBucketId() const override { return _bucket; } uint16_t getDisk() const { return _disk; } bool verifyBody() const { return _verifyBody; } @@ -143,7 +143,7 @@ public: void verifyBody(bool doIt) { _verifyBody = doIt; } void moveToIdealDisk(bool doIt) { _moveToIdealDisk = doIt; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; private: @@ -166,7 +166,7 @@ public: RepairBucketReply(const RepairBucketCommand& cmd, const api::BucketInfo& bucketInfo = api::BucketInfo()); ~RepairBucketReply(); - document::BucketId getBucketId() const { return _bucket; } + document::BucketId getBucketId() const override { return _bucket; } bool hasSingleBucketId() const override { return true; } const api::BucketInfo& getBucketInfo() const { return _bucketInfo; } @@ -199,7 +199,7 @@ public: BucketDiskMoveCommand(const document::BucketId& bucket, uint16_t srcDisk, uint16_t dstDisk); ~BucketDiskMoveCommand(); - document::BucketId getBucketId() const { return _bucket; } + document::BucketId getBucketId() const override { return _bucket; } bool hasSingleBucketId() const override { return true; } uint16_t getSrcDisk() const { return _srcDisk; } @@ -207,7 +207,7 @@ public: void setBucketId(const document::BucketId& id) { _bucket = id; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool, const std::string&) const override; }; @@ -234,7 +234,7 @@ public: uint32_t destinationFileSize = 0); ~BucketDiskMoveReply(); - document::BucketId getBucketId() const { return _bucket; } + document::BucketId getBucketId() const override { return _bucket; } bool hasSingleBucketId() const override { return true; } const api::BucketInfo& getBucketInfo() const { return _bucketInfo; } @@ -270,13 +270,13 @@ public: InternalBucketJoinCommand(const document::BucketId& bucket, uint16_t keepOnDisk, uint16_t joinFromDisk); ~InternalBucketJoinCommand(); - document::BucketId getBucketId() const { return _bucket; } + document::BucketId getBucketId() const override { return _bucket; } bool hasSingleBucketId() const override { return true; } uint16_t getDiskOfInstanceToKeep() const { return _keepOnDisk; } uint16_t getDiskOfInstanceToJoin() const { return _joinFromDisk; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; @@ -296,7 +296,7 @@ public: const api::BucketInfo& info = api::BucketInfo()); ~InternalBucketJoinReply(); - document::BucketId getBucketId() const { return _bucket; } + document::BucketId getBucketId() const override { return _bucket; } bool hasSingleBucketId() const override { return true; } const api::BucketInfo& getBucketInfo() const { return _bucketInfo; } diff --git a/storage/src/vespa/storage/common/servicelayercomponent.h b/storage/src/vespa/storage/common/servicelayercomponent.h index 8feccdbf954..e54421b1ce3 100644 --- a/storage/src/vespa/storage/common/servicelayercomponent.h +++ b/storage/src/vespa/storage/common/servicelayercomponent.h @@ -55,10 +55,11 @@ class ServiceLayerComponent : public StorageComponent, MinimumUsedBitsTracker* _minUsedBitsTracker; // ServiceLayerManagedComponent implementation - virtual void setDiskCount(uint16_t count) { _diskCount = count; } - virtual void setBucketDatabase(StorBucketDatabase& db) - { _bucketDatabase = &db; } - virtual void setMinUsedBitsTracker(MinimumUsedBitsTracker& tracker) { + virtual void setDiskCount(uint16_t count) override { _diskCount = count; } + virtual void setBucketDatabase(StorBucketDatabase& db) override { + _bucketDatabase = &db; + } + virtual void setMinUsedBitsTracker(MinimumUsedBitsTracker& tracker) override { _minUsedBitsTracker = &tracker; } public: diff --git a/storage/src/vespa/storage/common/statusmessages.h b/storage/src/vespa/storage/common/statusmessages.h index da1ac173997..4299fefe773 100644 --- a/storage/src/vespa/storage/common/statusmessages.h +++ b/storage/src/vespa/storage/common/statusmessages.h @@ -31,7 +31,7 @@ public: const std::string& getSortToken() const { return _sortToken; } void setSortToken(const std::string& token) { _sortToken = token; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; const framework::HttpUrlPath& getPath() const { return _path; } diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.cpp b/storage/src/vespa/storage/common/statusmetricconsumer.cpp index 85dc82b62af..638ff54cbc7 100644 --- a/storage/src/vespa/storage/common/statusmetricconsumer.cpp +++ b/storage/src/vespa/storage/common/statusmetricconsumer.cpp @@ -415,7 +415,7 @@ namespace { std::ostream& out) : _usedMetrics(used), _out(out) {} - bool visitMetric(const metrics::Metric& metric, bool) { + bool visitMetric(const metrics::Metric& metric, bool) override { std::map<metrics::Metric::String, metrics::Metric::SP>::const_iterator it( _usedMetrics.find(metric.getPath())); diff --git a/storage/src/vespa/storage/common/statusmetricconsumer.h b/storage/src/vespa/storage/common/statusmetricconsumer.h index fac9296032e..0027cef9cd0 100644 --- a/storage/src/vespa/storage/common/statusmetricconsumer.h +++ b/storage/src/vespa/storage/common/statusmetricconsumer.h @@ -33,9 +33,8 @@ public: const std::string& name = "status"); ~StatusMetricConsumer(); - vespalib::string getReportContentType( - const framework::HttpUrlPath&) const; - bool reportStatus(std::ostream& out, const framework::HttpUrlPath&) const; + vespalib::string getReportContentType(const framework::HttpUrlPath&) const override; + bool reportStatus(std::ostream& out, const framework::HttpUrlPath&) const override; void waitUntilTimeProcessed(framework::SecondTime t) const; diff --git a/storage/src/vespa/storage/common/storagelinkqueued.h b/storage/src/vespa/storage/common/storagelinkqueued.h index 2d3d8abd925..cd7b91a7a68 100644 --- a/storage/src/vespa/storage/common/storagelinkqueued.h +++ b/storage/src/vespa/storage/common/storagelinkqueued.h @@ -40,13 +40,13 @@ public: void dispatchUp(const std::shared_ptr<api::StorageMessage>&); /** Remember to call this method if you override it. */ - virtual void onClose() { + virtual void onClose() override { _commandDispatcher.flush(); _closeState |= 1; } /** Remember to call this method if you override it. */ - virtual void onFlush(bool downwards) { + virtual void onFlush(bool downwards) override { if (downwards) { _commandDispatcher.flush(); _closeState |= 2; @@ -82,7 +82,7 @@ private: virtual ~Dispatcher(); void start(); - void run(framework::ThreadHandle&); + void run(framework::ThreadHandle&) override; void add(const std::shared_ptr<Message>&); void flush(); @@ -103,8 +103,9 @@ private: parent, std::numeric_limits<unsigned int>::max(), true) { } - void send(const std::shared_ptr<api::StorageMessage> & reply) - { _parent.sendUp(reply); } + void send(const std::shared_ptr<api::StorageMessage> & reply) override { + _parent.sendUp(reply); + } virtual ~ReplyDispatcher() { terminate(); } }; @@ -117,8 +118,9 @@ private: { } virtual ~CommandDispatcher() { terminate(); } - void send(const std::shared_ptr<api::StorageMessage> & command) - { _parent.sendDown(command); } + void send(const std::shared_ptr<api::StorageMessage> & command) override { + _parent.sendDown(command); + } }; framework::ComponentRegister& _compReg; diff --git a/storage/src/vespa/storage/config/distributorconfiguration.cpp b/storage/src/vespa/storage/config/distributorconfiguration.cpp index 623312a8049..a5ce431d224 100644 --- a/storage/src/vespa/storage/config/distributorconfiguration.cpp +++ b/storage/src/vespa/storage/config/distributorconfiguration.cpp @@ -45,7 +45,7 @@ public: TimeVisitor() : hasCurrentTime(false) {} - void visitCurrentTimeValueNode(const document::select::CurrentTimeValueNode&) { + void visitCurrentTimeValueNode(const document::select::CurrentTimeValueNode&) override { hasCurrentTime = true; } }; diff --git a/storage/src/vespa/storage/distributor/activecopy.h b/storage/src/vespa/storage/distributor/activecopy.h index 00a7bf3d4f6..7f8fbedb61c 100644 --- a/storage/src/vespa/storage/distributor/activecopy.h +++ b/storage/src/vespa/storage/distributor/activecopy.h @@ -37,7 +37,7 @@ public: bool contains(uint16_t) const; bool empty() const { return _v.empty(); } size_t size() const { return _v.size(); } - void print(std::ostream&, bool verbose, const std::string& indent) const; + void print(std::ostream&, bool verbose, const std::string& indent) const override; }; } // distributor diff --git a/storage/src/vespa/storage/distributor/bucketdbupdater.h b/storage/src/vespa/storage/distributor/bucketdbupdater.h index 8f050d87d95..b87f0e5f898 100644 --- a/storage/src/vespa/storage/distributor/bucketdbupdater.h +++ b/storage/src/vespa/storage/distributor/bucketdbupdater.h @@ -43,14 +43,14 @@ public: void recheckBucketInfo(uint32_t nodeIdx, const document::BucketId& bid); - bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>& cmd); + bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>& cmd) override; bool onRequestBucketInfoReply( - const std::shared_ptr<api::RequestBucketInfoReply> & repl); + const std::shared_ptr<api::RequestBucketInfoReply> & repl) override; - bool onMergeBucketReply(const std::shared_ptr<api::MergeBucketReply>& reply); + bool onMergeBucketReply(const std::shared_ptr<api::MergeBucketReply>& reply) override; - bool onNotifyBucketChange(const std::shared_ptr<api::NotifyBucketChangeCommand>&); + bool onNotifyBucketChange(const std::shared_ptr<api::NotifyBucketChangeCommand>&) override; void resendDelayedMessages(); @@ -60,8 +60,8 @@ public: const framework::HttpUrlPath&) const; vespalib::string getReportContentType( - const framework::HttpUrlPath&) const; - bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const; + const framework::HttpUrlPath&) const override; + bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; virtual void print(std::ostream& out, bool verbose, const std::string& indent) const; @@ -241,7 +241,7 @@ private: ~NodeRemover(); - virtual bool process(BucketDatabase::Entry& e); + virtual bool process(BucketDatabase::Entry& e) override; void logRemove(const document::BucketId& bucketId, const char* msg) const; diff --git a/storage/src/vespa/storage/distributor/distributor.cpp b/storage/src/vespa/storage/distributor/distributor.cpp index d1e64406ef6..fdda56cea55 100644 --- a/storage/src/vespa/storage/distributor/distributor.cpp +++ b/storage/src/vespa/storage/distributor/distributor.cpp @@ -462,7 +462,7 @@ public: MaintenanceChecker() : found(false) {}; - bool check(uint32_t msgType, uint16_t node, uint8_t pri) { + bool check(uint32_t msgType, uint16_t node, uint8_t pri) override { (void) node; (void) pri; for (uint32_t i = 0; @@ -486,7 +486,7 @@ public: SplitChecker(uint8_t maxP) : found(false), maxPri(maxP) {}; - bool check(uint32_t msgType, uint16_t node, uint8_t pri) { + bool check(uint32_t msgType, uint16_t node, uint8_t pri) override { (void) node; (void) pri; if (msgType == api::MessageType::SPLITBUCKET_ID && pri <= maxPri) { diff --git a/storage/src/vespa/storage/distributor/distributor.h b/storage/src/vespa/storage/distributor/distributor.h index c56f4f9456a..40d6ee76e07 100644 --- a/storage/src/vespa/storage/distributor/distributor.h +++ b/storage/src/vespa/storage/distributor/distributor.h @@ -56,23 +56,23 @@ public: ~Distributor(); - void onOpen(); + void onOpen() override; - void onClose(); + void onClose() override; - bool onDown(const std::shared_ptr<api::StorageMessage>&); + bool onDown(const std::shared_ptr<api::StorageMessage>&) override; - void sendUp(const std::shared_ptr<api::StorageMessage>&); + void sendUp(const std::shared_ptr<api::StorageMessage>&) override; - void sendDown(const std::shared_ptr<api::StorageMessage>&); + void sendDown(const std::shared_ptr<api::StorageMessage>&) override; - virtual ChainedMessageSender& getMessageSender() { + virtual ChainedMessageSender& getMessageSender() override { return (_messageSender == 0 ? *this : *_messageSender); } - DistributorMetricSet& getMetrics() { return *_metrics; } + DistributorMetricSet& getMetrics() override { return *_metrics; } - PendingMessageTracker& getPendingMessageTracker() { + PendingMessageTracker& getPendingMessageTracker() override { return _pendingMessageTracker; } @@ -82,7 +82,7 @@ public: * Enables a new cluster state. Called after the bucket db updater has * retrieved all bucket info related to the change. */ - void enableClusterState(const lib::ClusterState& clusterState); + void enableClusterState(const lib::ClusterState& clusterState) override; /** * Invoked when a pending cluster state for a distribution (config) @@ -90,39 +90,39 @@ public: * will eventually cause this method to be called, assuming the pending * cluster state completed successfully. */ - void notifyDistributionChangeEnabled(); + void notifyDistributionChangeEnabled() override; - void storageDistributionChanged(); + void storageDistributionChanged() override; - void recheckBucketInfo(uint16_t nodeIdx, const document::BucketId& bid); + void recheckBucketInfo(uint16_t nodeIdx, const document::BucketId& bid) override; - bool handleReply(const std::shared_ptr<api::StorageReply>& reply); + bool handleReply(const std::shared_ptr<api::StorageReply>& reply) override; // StatusReporter implementation vespalib::string getReportContentType( - const framework::HttpUrlPath&) const; - bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const; + const framework::HttpUrlPath&) const override; + bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; - bool handleStatusRequest(const DelegatedStatusRequest& request) const; + bool handleStatusRequest(const DelegatedStatusRequest& request) const override; uint32_t pendingMaintenanceCount() const; std::string getActiveIdealStateOperations() const; std::string getActiveOperations() const; - virtual framework::ThreadWaitInfo doCriticalTick(framework::ThreadIndex); - virtual framework::ThreadWaitInfo doNonCriticalTick(framework::ThreadIndex); + virtual framework::ThreadWaitInfo doCriticalTick(framework::ThreadIndex) override; + virtual framework::ThreadWaitInfo doNonCriticalTick(framework::ThreadIndex) override; /** * Checks whether a bucket needs to be split, and sends a split * if so. */ void checkBucketForSplit(const BucketDatabase::Entry& e, - uint8_t priority); + uint8_t priority) override; - const lib::Distribution& getDistribution() const; + const lib::Distribution& getDistribution() const override; - const lib::ClusterState& getClusterState() const { + const lib::ClusterState& getClusterState() const override { return _clusterState; } @@ -130,7 +130,7 @@ public: * @return Returns the states in which the distributors consider * storage nodes to be up. */ - const char* getStorageNodeUpStates() const + const char* getStorageNodeUpStates() const override { return _initializingIsUp ? "uri" : "ur"; } /** @@ -138,14 +138,14 @@ public: * request bucket info operations have been performed as well. Passes the * merge back to the operation that created it. */ - void handleCompletedMerge(const std::shared_ptr<api::MergeBucketReply>& reply); + void handleCompletedMerge(const std::shared_ptr<api::MergeBucketReply>& reply) override; - bool initializing() const { + bool initializing() const override { return !_doneInitializing; } - const DistributorConfiguration& getConfig() const { + const DistributorConfiguration& getConfig() const override { return _component.getTotalDistributorConfig(); } @@ -153,14 +153,14 @@ public: return _schedulingMode == MaintenanceScheduler::RECOVERY_SCHEDULING_MODE; } - int getDistributorIndex() const; + int getDistributorIndex() const override; - const std::string& getClusterName() const; + const std::string& getClusterName() const override; - const PendingMessageTracker& getPendingMessageTracker() const; + const PendingMessageTracker& getPendingMessageTracker() const override; - virtual void sendCommand(const std::shared_ptr<api::StorageCommand>&); - virtual void sendReply(const std::shared_ptr<api::StorageReply>&); + virtual void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; + virtual void sendReply(const std::shared_ptr<api::StorageReply>&) override; const BucketGcTimeCalculator::BucketIdHasher& getBucketIdHasher() const override { diff --git a/storage/src/vespa/storage/distributor/idealstatemanager.h b/storage/src/vespa/storage/distributor/idealstatemanager.h index b177278bd20..3b468a64024 100644 --- a/storage/src/vespa/storage/distributor/idealstatemanager.h +++ b/storage/src/vespa/storage/distributor/idealstatemanager.h @@ -130,7 +130,7 @@ private: StatusBucketVisitor(const IdealStateManager& ism, std::ostream& out) : _ism(ism), _out(out) {} - bool process(const BucketDatabase::Entry& e) { + bool process(const BucketDatabase::Entry& e) override { _ism.getBucketStatus(e, _statsTracker, _out); return true; } diff --git a/storage/src/vespa/storage/distributor/operations/external/getoperation.h b/storage/src/vespa/storage/distributor/operations/external/getoperation.h index 88f9300a112..ecdfb1e677a 100644 --- a/storage/src/vespa/storage/distributor/operations/external/getoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/getoperation.h @@ -29,15 +29,15 @@ public: const std::shared_ptr<api::GetCommand> & msg, PersistenceOperationMetricSet& metric); - void onClose(DistributorMessageSender& sender); + void onClose(DistributorMessageSender& sender) override; - void onStart(DistributorMessageSender& sender); + void onStart(DistributorMessageSender& sender) override; - void onReceive(DistributorMessageSender& sender, const std::shared_ptr<api::StorageReply> & msg); + void onReceive(DistributorMessageSender& sender, const std::shared_ptr<api::StorageReply> & msg) override; - const char* getName() const { return "get"; } + const char* getName() const override { return "get"; } - std::string getStatus() const { return ""; } + std::string getStatus() const override { return ""; } bool hasConsistentCopies() const; diff --git a/storage/src/vespa/storage/distributor/operations/external/putoperation.h b/storage/src/vespa/storage/distributor/operations/external/putoperation.h index 677b2f85d4e..5043fed307f 100644 --- a/storage/src/vespa/storage/distributor/operations/external/putoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/putoperation.h @@ -27,16 +27,16 @@ public: const std::shared_ptr<api::PutCommand> & msg, PersistenceOperationMetricSet& metric); - void onStart(DistributorMessageSender& sender); + void onStart(DistributorMessageSender& sender) override; - const char* getName() const { return "put"; }; + const char* getName() const override { return "put"; } - std::string getStatus() const { return ""; }; + std::string getStatus() const override { return ""; } void onReceive(DistributorMessageSender& sender, - const std::shared_ptr<api::StorageReply> &); + const std::shared_ptr<api::StorageReply> &) override; - void onClose(DistributorMessageSender& sender); + void onClose(DistributorMessageSender& sender) override; /** * Gets the ideal state of the given bucket, and adds all nodes from the diff --git a/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h b/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h index 8e092a96f88..25cc0825b7d 100644 --- a/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/statbucketlistoperation.h @@ -25,17 +25,15 @@ public: const std::shared_ptr<api::GetBucketListCommand>& cmd); virtual ~StatBucketListOperation() {} - virtual const char* getName() const { return "statBucketList"; } - virtual std::string getStatus() const { return ""; } + virtual const char* getName() const override { return "statBucketList"; } + virtual std::string getStatus() const override { return ""; } - virtual void onStart(DistributorMessageSender& sender); - virtual void onReceive(DistributorMessageSender&, - const std::shared_ptr<api::StorageReply>&) - { + virtual void onStart(DistributorMessageSender& sender) override; + virtual void onReceive(DistributorMessageSender&, const std::shared_ptr<api::StorageReply>&) override { // Never called. assert(false); } - void onClose(DistributorMessageSender&) { + void onClose(DistributorMessageSender&) override { } private: diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp index d0a1e98f0c8..15f8d06965a 100644 --- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.cpp @@ -52,24 +52,24 @@ struct IntermediateMessageSender : DistributorMessageSender { DistributorMessageSender & fwd); ~IntermediateMessageSender(); - virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) { + virtual void sendCommand(const std::shared_ptr<api::StorageCommand>& cmd) override { msgMap.insert(cmd->getMsgId(), callback); forward.sendCommand(cmd); }; - virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) { + virtual void sendReply(const std::shared_ptr<api::StorageReply>& reply) override { _reply = reply; } - virtual int getDistributorIndex() const { + virtual int getDistributorIndex() const override { return forward.getDistributorIndex(); } - virtual const std::string& getClusterName() const { + virtual const std::string& getClusterName() const override { return forward.getClusterName(); } - virtual const PendingMessageTracker& getPendingMessageTracker() const { + virtual const PendingMessageTracker& getPendingMessageTracker() const override { return forward.getPendingMessageTracker(); } }; diff --git a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h index 361fcd03037..7cff0aba493 100644 --- a/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/twophaseupdateoperation.h @@ -52,16 +52,16 @@ public: DistributorMetricSet& metrics); ~TwoPhaseUpdateOperation(); - void onStart(DistributorMessageSender& sender); + void onStart(DistributorMessageSender& sender) override; - const char* getName() const { return "twophaseupdate"; } + const char* getName() const override { return "twophaseupdate"; } - std::string getStatus() const { return ""; } + std::string getStatus() const override { return ""; } void onReceive(DistributorMessageSender&, - const std::shared_ptr<api::StorageReply>&); + const std::shared_ptr<api::StorageReply>&) override; - void onClose(DistributorMessageSender& sender); + void onClose(DistributorMessageSender& sender) override; bool canSendHeaderOnly() const; diff --git a/storage/src/vespa/storage/distributor/operations/external/updateoperation.h b/storage/src/vespa/storage/distributor/operations/external/updateoperation.h index b990e953623..0a2a9e564a0 100644 --- a/storage/src/vespa/storage/distributor/operations/external/updateoperation.h +++ b/storage/src/vespa/storage/distributor/operations/external/updateoperation.h @@ -24,16 +24,16 @@ public: const std::shared_ptr<api::UpdateCommand> & msg, PersistenceOperationMetricSet& metric); - void onStart(DistributorMessageSender& sender); + void onStart(DistributorMessageSender& sender) override; - const char* getName() const { return "update"; }; + const char* getName() const override { return "update"; } - std::string getStatus() const { return ""; }; + std::string getStatus() const override { return ""; } void onReceive(DistributorMessageSender& sender, - const std::shared_ptr<api::StorageReply> & msg); + const std::shared_ptr<api::StorageReply> & msg) override; - void onClose(DistributorMessageSender& sender); + void onClose(DistributorMessageSender& sender) override; std::pair<document::BucketId, uint16_t> getNewestTimestampLocation() const { return _newestTimestampLocation; diff --git a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp index ec165b0ee25..295512d579c 100644 --- a/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp +++ b/storage/src/vespa/storage/distributor/operations/external/visitoroperation.cpp @@ -481,7 +481,7 @@ struct NextEntryFinder : public BucketDatabase::EntryProcessor { NextEntryFinder(const document::BucketId& id) : _first(true), _last(id), _next() {} - bool process(const BucketDatabase::Entry& e) { + bool process(const BucketDatabase::Entry& e) override { document::BucketId bucket(e.getBucketId()); if (_first && bucket == _last) { diff --git a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h index d5a4731c0de..802bb0f4bac 100644 --- a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h +++ b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.h @@ -23,7 +23,7 @@ struct BucketInstance : public vespalib::AsciiPrintable { lib::Node node, uint16_t idealLocationPriority, bool trusted, bool exist = true); - void print(vespalib::asciistream& out, const PrintProperties&) const; + void print(vespalib::asciistream& out, const PrintProperties&) const override; }; class BucketInstanceList : public vespalib::AsciiPrintable { @@ -104,7 +104,7 @@ public: } virtual OperationTargetList getTargets(OperationType type, - const document::BucketId& id) + const document::BucketId& id) override { return getInstances(type, id).createTargets(); } }; diff --git a/storage/src/vespa/storage/distributor/persistence_operation_metric_set.h b/storage/src/vespa/storage/distributor/persistence_operation_metric_set.h index b50ca0cb798..b1353e1c498 100644 --- a/storage/src/vespa/storage/distributor/persistence_operation_metric_set.h +++ b/storage/src/vespa/storage/distributor/persistence_operation_metric_set.h @@ -29,7 +29,7 @@ public: metrics::LongCountMetric notfound; MetricSet * clone(std::vector<Metric::UP>& ownerList, CopyType copyType, - metrics::MetricSet* owner, bool includeUnused) const; + metrics::MetricSet* owner, bool includeUnused) const override; }; class PersistenceOperationMetricSet : public metrics::MetricSet diff --git a/storage/src/vespa/storage/distributor/statechecker.cpp b/storage/src/vespa/storage/distributor/statechecker.cpp index 64a80117fe3..d257663e261 100644 --- a/storage/src/vespa/storage/distributor/statechecker.cpp +++ b/storage/src/vespa/storage/distributor/statechecker.cpp @@ -33,15 +33,15 @@ public: _priority(priority) {} - IdealStateOperation::UP createOperation() { + IdealStateOperation::UP createOperation() override { return std::move(_operation); } - MaintenancePriority getPriority() const { + MaintenancePriority getPriority() const override { return _priority; } - MaintenanceOperation::Type getType() const { + MaintenanceOperation::Type getType() const override { assert(_operation.get()); return _operation->getType(); } diff --git a/storage/src/vespa/storage/distributor/statecheckers.h b/storage/src/vespa/storage/distributor/statecheckers.h index 8edf04f3bf7..0113749f2fd 100644 --- a/storage/src/vespa/storage/distributor/statecheckers.h +++ b/storage/src/vespa/storage/distributor/statecheckers.h @@ -10,21 +10,21 @@ namespace distributor { class SynchronizeAndMoveStateChecker : public StateChecker { public: - std::string getStatusText() const { return "Synchronization and moving"; } + std::string getStatusText() const override { return "Synchronization and moving"; } - Result check(Context& c); + Result check(Context& c) override; - const char* getName() const { return "SynchronizeAndMove"; } + const char* getName() const override { return "SynchronizeAndMove"; } }; class DeleteExtraCopiesStateChecker : public StateChecker { public: - std::string getStatusText() const { return "Delete extra copies"; } + std::string getStatusText() const override { return "Delete extra copies"; } - Result check(Context& c); + Result check(Context& c) override; - const char* getName() const { return "DeleteExtraCopies"; } + const char* getName() const override { return "DeleteExtraCopies"; } private: bool bucketHasNoData(const StateChecker::Context& c); @@ -48,11 +48,11 @@ private: class JoinBucketsStateChecker : public StateChecker { public: - std::string getStatusText() const { return "Join buckets"; } + std::string getStatusText() const override { return "Join buckets"; } - Result check(Context& c); + Result check(Context& c) override; - const char* getName() const { return "JoinBuckets"; } + const char* getName() const override { return "JoinBuckets"; } private: uint64_t getTotalUsedFileSize(const Context& c) const; uint64_t getTotalMetaCount(const Context& c) const; @@ -68,11 +68,11 @@ private: class SplitBucketStateChecker : public StateChecker { public: - std::string getStatusText() const { return "Split buckets"; } + std::string getStatusText() const override { return "Split buckets"; } - Result check(Context& c); + Result check(Context& c) override; - const char* getName() const { return "SplitBucket"; } + const char* getName() const override { return "SplitBucket"; } private: @@ -86,12 +86,12 @@ private: class SplitInconsistentStateChecker : public StateChecker { public: - std::string getStatusText() const + std::string getStatusText() const override { return "Fix inconsistently split buckets"; } - Result check(Context& c); + Result check(Context& c) override; - const char* getName() const { return "SplitInconsistentBuckets"; } + const char* getName() const override { return "SplitInconsistentBuckets"; } private: typedef std::pair<document::BucketId, uint16_t> BucketAndNode; @@ -114,23 +114,23 @@ class BucketStateStateChecker : public StateChecker const ActiveList& activeList, const StateChecker::Context& c) const; public: - std::string getStatusText() const { return "Set bucket copy state"; } + std::string getStatusText() const override { return "Set bucket copy state"; } - Result check(Context& c); + Result check(Context& c) override; - const char* getName() const { return "SetBucketState"; } + const char* getName() const override { return "SetBucketState"; } }; class GarbageCollectionStateChecker : public StateChecker { public: - std::string getStatusText() const { return "Garbage collection"; } + std::string getStatusText() const override { return "Garbage collection"; } bool needsGarbageCollection(const Context& c) const; - Result check(Context& c); + Result check(Context& c) override; - const char* getName() const { return "GarbageCollection"; } + const char* getName() const override { return "GarbageCollection"; } }; } diff --git a/storage/src/vespa/storage/distributor/statusreporterdelegate.h b/storage/src/vespa/storage/distributor/statusreporterdelegate.h index 7f66554b091..0c836910765 100644 --- a/storage/src/vespa/storage/distributor/statusreporterdelegate.h +++ b/storage/src/vespa/storage/distributor/statusreporterdelegate.h @@ -22,8 +22,8 @@ public: void registerStatusPage(); vespalib::string getReportContentType( - const framework::HttpUrlPath&) const; - bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const; + const framework::HttpUrlPath&) const override; + bool reportStatus(std::ostream&, const framework::HttpUrlPath&) const override; }; } // distributor diff --git a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h index f58303519c5..2cf0255bf9f 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/distributorcomponentregisterimpl.h @@ -36,16 +36,16 @@ public: DistributorComponentRegisterImpl(); ~DistributorComponentRegisterImpl(); - virtual void registerDistributorComponent(DistributorManagedComponent&); + virtual void registerDistributorComponent(DistributorManagedComponent&) override; void setTimeCalculator(UniqueTimeCalculator& calc); void setDistributorConfig(const DistributorConfig&); void setVisitorConfig(const VisitorConfig&); private: - virtual void handleNewState(); + virtual void handleNewState() override; - virtual void setNodeStateUpdater(NodeStateUpdater& updater); + virtual void setNodeStateUpdater(NodeStateUpdater& updater) override; }; } // storage diff --git a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h index fe73e5a1563..7d322f027d5 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/servicelayercomponentregisterimpl.h @@ -35,7 +35,7 @@ public: return _minUsedBitsTracker; } - virtual void registerServiceLayerComponent(ServiceLayerManagedComponent&); + virtual void registerServiceLayerComponent(ServiceLayerManagedComponent&) override; void setDiskCount(uint16_t count); }; diff --git a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h index 416391fbd53..cf9abbb6864 100644 --- a/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h +++ b/storage/src/vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h @@ -53,7 +53,7 @@ public: NodeStateUpdater& getNodeStateUpdater() { assert(_nodeStateUpdater != 0); return *_nodeStateUpdater; } - virtual void registerStorageComponent(StorageComponent&); + virtual void registerStorageComponent(StorageComponent&) override; void setNodeInfo(vespalib::stringref clusterName, const lib::NodeType& nodeType, diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp index 10a3c0bcf75..12e2c31068a 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.cpp @@ -236,9 +236,7 @@ StatusWebServer::WebServer::onGetRequest(const string & tmpurl, const string &se namespace { class IndexPageReporter : public framework::HtmlStatusReporter { std::ostringstream ost; - virtual void reportHtmlStatus(std::ostream& out, - const framework::HttpUrlPath&) const - { + virtual void reportHtmlStatus(std::ostream& out, const framework::HttpUrlPath&) const override { out << ost.str(); } diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h index 2f3f5ea9d57..c89c286387b 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h @@ -32,7 +32,7 @@ class StatusWebServer : private config::IFetcherCallback<vespa::config::content: virtual void onGetRequest(const string & url, const string & serverSpec, - Fast_HTTPConnection& conn); + Fast_HTTPConnection& conn) override; const vespalib::string &getServerSpec() const { return _serverSpec; } @@ -74,9 +74,9 @@ public: const vespalib::string &serverSpec); private: - virtual void configure(std::unique_ptr<vespa::config::content::core::StorStatusConfig> config); + virtual void configure(std::unique_ptr<vespa::config::content::core::StorStatusConfig> config) override; void getPage(const char* url, Fast_HTTPConnection& conn); - virtual void run(framework::ThreadHandle&); + virtual void run(framework::ThreadHandle&) override; }; diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp index b904a0ea103..5d58a092053 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.cpp @@ -149,7 +149,7 @@ namespace { virtual void visitThread(const vespalib::string& id, const framework::ThreadProperties& tp, const framework::ThreadTickData& tick, - DeadLockDetector::State& state) + DeadLockDetector::State& state) override { // In case we just got a new tick, ignore the thread if (tick._lastTickMs > _currentTime.getTime()) return; @@ -285,7 +285,7 @@ namespace { void visitThread(const vespalib::string& id, const framework::ThreadProperties& tp, const framework::ThreadTickData& tick, - DeadLockDetector::State& /*state*/) + DeadLockDetector::State& /*state*/) override { _table._table.addRow(id); uint32_t i = _table._table.getRowCount() - 1; diff --git a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h index 61ce0b26757..146d0ccb751 100644 --- a/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h +++ b/storage/src/vespa/storage/frameworkimpl/thread/deadlockdetector.h @@ -88,11 +88,11 @@ private: StorageComponent* _component; framework::Thread::UP _thread; - virtual void run(framework::ThreadHandle&); + virtual void run(framework::ThreadHandle&) override; // Status implementation virtual void reportHtmlStatus(std::ostream& out, - const framework::HttpUrlPath&) const; + const framework::HttpUrlPath&) const override; vespalib::string getBucketLockInfo() const; }; diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h index 378103def1c..e658599a3dc 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandler.h @@ -253,9 +253,9 @@ public: void abortQueuedOperations(const AbortBucketOperationsCommand& cmd); /** Send the given command back out of the persistence layer. */ - void sendCommand(const api::StorageCommand::SP&); + void sendCommand(const api::StorageCommand::SP&) override; /** Send the given reply back out of the persistence layer. */ - void sendReply(const api::StorageReply::SP&); + void sendReply(const api::StorageReply::SP&) override; /** Writes status page. */ void getStatus(std::ostream& out, const framework::HttpUrlPath& path) const; diff --git a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h index 410d586f0a2..dc2bb96d67b 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestorhandlerimpl.h @@ -135,7 +135,7 @@ public: const vespalib::stringref & statusString); ~BucketLock(); - const document::BucketId& getBucketId() const { return _id; } + const document::BucketId& getBucketId() const override { return _id; } private: Disk& _disk; @@ -171,8 +171,8 @@ public: void remapQueue(const RemapInfo& source, RemapInfo& target1, RemapInfo& target2, Operation op); void failOperations(const document::BucketId&, uint16_t fromDisk, const api::ReturnCode&); - void sendCommand(const std::shared_ptr<api::StorageCommand>&); - void sendReply(const std::shared_ptr<api::StorageReply>&); + void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; + void sendReply(const std::shared_ptr<api::StorageReply>&) override; void getStatus(std::ostream& out, const framework::HttpUrlPath& path) const; @@ -190,7 +190,7 @@ public: std::string dumpQueue(uint16_t disk) const; ResumeGuard pause(); - void resume(); + void resume() override; void abortQueuedOperations(const AbortBucketOperationsCommand& cmd); private: diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h index 78c23f083f0..a6942102c42 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.h +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.h @@ -104,8 +104,7 @@ public: ServiceLayerComponentRegister&); ~FileStorManager(); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; // Return true if we are currently merging the given bucket. bool isMerging(const document::BucketId& bucket) const; @@ -118,10 +117,10 @@ public: return *_provider; } - void handleNewState(); + void handleNewState() override; private: - void configure(std::unique_ptr<vespa::config::content::StorFilestorConfig> config); + void configure(std::unique_ptr<vespa::config::content::StorFilestorConfig> config) override; void replyWithBucketNotFound(api::StorageMessage&, const document::BucketId&); @@ -149,53 +148,47 @@ private: uint16_t disk); // Document operations - bool onPut(const std::shared_ptr<api::PutCommand>&); - bool onUpdate(const std::shared_ptr<api::UpdateCommand>&); - bool onGet(const std::shared_ptr<api::GetCommand>&); - bool onRemove(const std::shared_ptr<api::RemoveCommand>&); - bool onRevert(const std::shared_ptr<api::RevertCommand>&); - bool onMultiOperation(const std::shared_ptr<api::MultiOperationCommand>&); - bool onBatchPutRemove(const std::shared_ptr<api::BatchPutRemoveCommand>&); - bool onStatBucket(const std::shared_ptr<api::StatBucketCommand>&); + bool onPut(const std::shared_ptr<api::PutCommand>&) override; + bool onUpdate(const std::shared_ptr<api::UpdateCommand>&) override; + bool onGet(const std::shared_ptr<api::GetCommand>&) override; + bool onRemove(const std::shared_ptr<api::RemoveCommand>&) override; + bool onRevert(const std::shared_ptr<api::RevertCommand>&) override; + bool onMultiOperation(const std::shared_ptr<api::MultiOperationCommand>&) override; + bool onBatchPutRemove(const std::shared_ptr<api::BatchPutRemoveCommand>&) override; + bool onStatBucket(const std::shared_ptr<api::StatBucketCommand>&) override; // Bucket operations - bool onRemoveLocation(const std::shared_ptr<api::RemoveLocationCommand>&); - bool onCreateBucket(const std::shared_ptr<api::CreateBucketCommand>&); - bool onDeleteBucket(const std::shared_ptr<api::DeleteBucketCommand>&); - bool onMergeBucket(const std::shared_ptr<api::MergeBucketCommand>&); - bool onGetBucketDiff(const std::shared_ptr<api::GetBucketDiffCommand>&); - bool onGetBucketDiffReply( - const std::shared_ptr<api::GetBucketDiffReply>&); - bool onApplyBucketDiff( - const std::shared_ptr<api::ApplyBucketDiffCommand>&); - bool onApplyBucketDiffReply( - const std::shared_ptr<api::ApplyBucketDiffReply>&); - bool onJoinBuckets(const std::shared_ptr<api::JoinBucketsCommand>&); - bool onSplitBucket(const std::shared_ptr<api::SplitBucketCommand>&); - bool onSetBucketState(const std::shared_ptr<api::SetBucketStateCommand>&); - bool onNotifyBucketChangeReply( - const std::shared_ptr<api::NotifyBucketChangeReply>&) - { return true; } + bool onRemoveLocation(const std::shared_ptr<api::RemoveLocationCommand>&) override; + bool onCreateBucket(const std::shared_ptr<api::CreateBucketCommand>&) override; + bool onDeleteBucket(const std::shared_ptr<api::DeleteBucketCommand>&) override; + bool onMergeBucket(const std::shared_ptr<api::MergeBucketCommand>&) override; + bool onGetBucketDiff(const std::shared_ptr<api::GetBucketDiffCommand>&) override; + bool onGetBucketDiffReply(const std::shared_ptr<api::GetBucketDiffReply>&) override; + bool onApplyBucketDiff(const std::shared_ptr<api::ApplyBucketDiffCommand>&) override; + bool onApplyBucketDiffReply(const std::shared_ptr<api::ApplyBucketDiffReply>&) override; + bool onJoinBuckets(const std::shared_ptr<api::JoinBucketsCommand>&) override; + bool onSplitBucket(const std::shared_ptr<api::SplitBucketCommand>&) override; + bool onSetBucketState(const std::shared_ptr<api::SetBucketStateCommand>&) override; + bool onNotifyBucketChangeReply(const std::shared_ptr<api::NotifyBucketChangeReply>&) override { return true; } // Other - bool onInternal(const std::shared_ptr<api::InternalCommand>&); - bool onInternalReply(const std::shared_ptr<api::InternalReply>&); + bool onInternal(const std::shared_ptr<api::InternalCommand>&) override; + bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; void handleAbortBucketOperations( const std::shared_ptr<AbortBucketOperationsCommand>&); - void sendCommand(const std::shared_ptr<api::StorageCommand>&); - void sendReply(const std::shared_ptr<api::StorageReply>&); + void sendCommand(const std::shared_ptr<api::StorageCommand>&) override; + void sendReply(const std::shared_ptr<api::StorageReply>&) override; - void sendUp(const std::shared_ptr<api::StorageMessage>&); + void sendUp(const std::shared_ptr<api::StorageMessage>&) override; - void onClose(); - void onFlush(bool downwards); + void onClose() override; + void onFlush(bool downwards) override; - virtual void reportHtmlStatus(std::ostream&, - const framework::HttpUrlPath&) const; + virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; - virtual void storageDistributionChanged(); + virtual void storageDistributionChanged() override; void updateState(); }; diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h index 3b7838bb20c..04c8c7b2391 100644 --- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h +++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h @@ -31,19 +31,19 @@ public: const config::ConfigUri& configUri); ~ModifiedBucketChecker(); - void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig>); + void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig>) override; - void run(framework::ThreadHandle& thread); + void run(framework::ThreadHandle& thread) override; bool tick(); - void onOpen(); - void onClose(); + void onOpen() override; + void onClose() override; void setUnitTestingSingleThreadedMode() { _singleThreadMode = true; } private: - bool onInternalReply(const std::shared_ptr<api::InternalReply>&); + bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; bool currentChunkFinished() const { return _pendingRequests == 0; } diff --git a/storage/src/vespa/storage/persistence/messages.h b/storage/src/vespa/storage/persistence/messages.h index aad2d1bedce..b4cf14413f4 100644 --- a/storage/src/vespa/storage/persistence/messages.h +++ b/storage/src/vespa/storage/persistence/messages.h @@ -31,9 +31,9 @@ public: uint32_t maxByteSize); ~GetIterCommand(); - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; - document::BucketId getBucketId() const { return _bucketId; } + document::BucketId getBucketId() const override { return _bucketId; } bool hasSingleBucketId() const override { return true; } spi::IteratorId getIteratorId() const { return _iteratorId; } @@ -65,7 +65,7 @@ public: ~GetIterReply(); bool hasSingleBucketId() const override { return true; } - document::BucketId getBucketId() const { + document::BucketId getBucketId() const override { return _bucketId; } @@ -102,7 +102,7 @@ public: spi::IncludedVersions includedVersions); ~CreateIteratorCommand(); bool hasSingleBucketId() const override { return true; } - document::BucketId getBucketId() const { return _bucketId; } + document::BucketId getBucketId() const override { return _bucketId; } const spi::Selection& getSelection() const { return _selection; } spi::IncludedVersions getIncludedVersions() const { return _includedVersions; } const std::string& getFields() const { return _fieldSet; } @@ -114,7 +114,7 @@ public: return _readConsistency; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; @@ -132,7 +132,7 @@ public: ~CreateIteratorReply(); bool hasSingleBucketId() const override { return true; } - document::BucketId getBucketId() const { return _bucketId; } + document::BucketId getBucketId() const override { return _bucketId; } spi::IteratorId getIteratorId() const { return _iteratorId; } @@ -152,7 +152,7 @@ public: spi::IteratorId getIteratorId() const { return _iteratorId; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool, const std::string &) const override; }; @@ -182,11 +182,11 @@ public: RecheckBucketInfoCommand(const document::BucketId& bucketId); ~RecheckBucketInfoCommand(); - document::BucketId getBucketId() const { + document::BucketId getBucketId() const override { return _bucketId; } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; @@ -202,7 +202,7 @@ public: RecheckBucketInfoReply(const RecheckBucketInfoCommand& cmd); ~RecheckBucketInfoReply(); - document::BucketId getBucketId() const { + document::BucketId getBucketId() const override { return _bucketId; } @@ -256,7 +256,7 @@ public: return _predicate->shouldAbort(bid); } - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; diff --git a/storage/src/vespa/storage/persistence/persistencethread.h b/storage/src/vespa/storage/persistence/persistencethread.h index 89658b5041e..f4c70353fab 100644 --- a/storage/src/vespa/storage/persistence/persistencethread.h +++ b/storage/src/vespa/storage/persistence/persistencethread.h @@ -31,11 +31,11 @@ public: ~PersistenceThread(); /** Waits for current operation to be finished. */ - void flush(); + void flush() override; bool isMerging(const BucketId& bucket) const; - virtual framework::Thread& getThread() { return *_thread; } + virtual framework::Thread& getThread() override { return *_thread; } MessageTracker::UP handlePut(api::PutCommand& cmd); MessageTracker::UP handleRemove(api::RemoveCommand& cmd); @@ -99,7 +99,7 @@ private: void processMessages(FileStorHandler::LockedMessage & lock); // Thread main loop - virtual void run(framework::ThreadHandle&); + virtual void run(framework::ThreadHandle&) override; bool checkForError(const spi::Result& response, MessageTracker& tracker); diff --git a/storage/src/vespa/storage/persistence/processallhandler.cpp b/storage/src/vespa/storage/persistence/processallhandler.cpp index 23990cd2108..2095e19261c 100644 --- a/storage/src/vespa/storage/persistence/processallhandler.cpp +++ b/storage/src/vespa/storage/persistence/processallhandler.cpp @@ -33,7 +33,7 @@ public: _bucket(bucket), _context(context) {} - void process(spi::DocEntry& entry) { + void process(spi::DocEntry& entry) override { spi::RemoveResult removeResult = _provider.remove( _bucket, entry.getTimestamp(), @@ -55,7 +55,7 @@ public: StatEntryProcessor(std::ostream& o) : ost(o) {}; - void process(spi::DocEntry& e) { + void process(spi::DocEntry& e) override { ost << " Timestamp: " << e.getTimestamp() << ", "; if (e.getDocument() != 0) { ost << "Doc(" << e.getDocument()->getId() << ")" diff --git a/storage/src/vespa/storage/persistence/splitbitdetector.cpp b/storage/src/vespa/storage/persistence/splitbitdetector.cpp index 1749df09d28..8d816760815 100644 --- a/storage/src/vespa/storage/persistence/splitbitdetector.cpp +++ b/storage/src/vespa/storage/persistence/splitbitdetector.cpp @@ -56,7 +56,7 @@ struct BucketVisitor : public BucketProcessor::EntryProcessor { BucketVisitor(const document::BucketIdFactory& factory); ~BucketVisitor(); - void process(spi::DocEntry& slot) { + void process(spi::DocEntry& slot) override { assert(slot.getDocumentId()); ++_docCount; _docSize += slot.getDocumentSize(); diff --git a/storage/src/vespa/storage/storageserver/bucketintegritychecker.h b/storage/src/vespa/storage/storageserver/bucketintegritychecker.h index 47173bedcda..6b87be804d0 100644 --- a/storage/src/vespa/storage/storageserver/bucketintegritychecker.h +++ b/storage/src/vespa/storage/storageserver/bucketintegritychecker.h @@ -49,8 +49,7 @@ struct SchedulingOptions : public document::Printable { for (uint32_t i=0; i<7; ++i) { _dailyStates[i] = RUN_FULL; } } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; @@ -113,10 +112,9 @@ public: ServiceLayerComponentRegister&); ~BucketIntegrityChecker(); - virtual void onClose(); + virtual void onClose() override; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; SchedulingOptions& getSchedulingOptions() { return _scheduleOptions; } @@ -133,26 +131,26 @@ public: framework::Clock& getClock() { return _component.getClock(); } private: - virtual void configure(std::unique_ptr<vespa::config::content::core::StorIntegritycheckerConfig>); + virtual void configure(std::unique_ptr<vespa::config::content::core::StorIntegritycheckerConfig>) override; - void onDoneInit(); + void onDoneInit() override; - bool onInternalReply(const std::shared_ptr<api::InternalReply>&); - bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>&); + bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; + bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>&) override; bool onNotifyBucketChangeReply( - const std::shared_ptr<api::NotifyBucketChangeReply>&) + const std::shared_ptr<api::NotifyBucketChangeReply>&) override { return true; } SchedulingOptions::RunState getCurrentRunState( framework::SecondTime time) const; - virtual void run(framework::ThreadHandle&); + virtual void run(framework::ThreadHandle&) override; uint32_t getTotalPendingCount() const; // Status::Reporter implementation virtual void reportHtmlStatus(std::ostream&, - const framework::HttpUrlPath&) const; + const framework::HttpUrlPath&) const override; }; diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h index 916a92247da..31100de78d1 100644 --- a/storage/src/vespa/storage/storageserver/communicationmanager.h +++ b/storage/src/vespa/storage/storageserver/communicationmanager.h @@ -141,8 +141,8 @@ private: typedef std::vector< std::pair<framework::SecondTime, mbus::IProtocol::SP> > Protocols; Protocols _earlierGenerations; - void onOpen(); - void onClose(); + void onOpen() override; + void onClose() override; void process(const std::shared_ptr<api::StorageMessage>& msg); @@ -151,7 +151,7 @@ private: void configureMessageBusLimits(const CommunicationManagerConfig& cfg); - void configure(std::unique_ptr<CommunicationManagerConfig> config); + void configure(std::unique_ptr<CommunicationManagerConfig> config) override; void receiveStorageReply(const std::shared_ptr<api::StorageReply>&); @@ -201,7 +201,7 @@ public: * From StorageLink. Called when messages arrive from storage * modules. Will convert and dispatch messages to MessageServer */ - virtual bool onUp(const std::shared_ptr<api::StorageMessage>&); + virtual bool onUp(const std::shared_ptr<api::StorageMessage>&) override; bool sendCommand(const std::shared_ptr<api::StorageCommand>& command); @@ -210,19 +210,18 @@ public: void sendMessageBusReply(StorageTransportContext& context, const std::shared_ptr<api::StorageReply>& reply); // Pump thread - void run(framework::ThreadHandle&); + void run(framework::ThreadHandle&) override; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Get messages from messagebus. */ - void handleMessage(std::unique_ptr<mbus::Message> msg); + void handleMessage(std::unique_ptr<mbus::Message> msg) override; void sendMessageBusMessage(const std::shared_ptr<api::StorageCommand>& msg, std::unique_ptr<mbus::Message> mbusMsg, const mbus::Route& route); /** Get replies from messagebus. */ - void handleReply(std::unique_ptr<mbus::Reply> msg); + void handleReply(std::unique_ptr<mbus::Reply> msg) override; void updateMessagebusProtocol(const document::DocumentTypeRepo::SP &repo); diff --git a/storage/src/vespa/storage/storageserver/distributornode.h b/storage/src/vespa/storage/storageserver/distributornode.h index c0b6db67b95..03792d8fb56 100644 --- a/storage/src/vespa/storage/storageserver/distributornode.h +++ b/storage/src/vespa/storage/storageserver/distributornode.h @@ -41,19 +41,19 @@ public: StorageLink::UP communicationManager = StorageLink::UP()); ~DistributorNode(); - virtual const lib::NodeType& getNodeType() const + virtual const lib::NodeType& getNodeType() const override { return lib::NodeType::DISTRIBUTOR; } - virtual ResumeGuard pause(); + virtual ResumeGuard pause() override; void handleConfigChange(vespa::config::content::core::StorDistributormanagerConfig&); void handleConfigChange(vespa::config::content::core::StorVisitordispatcherConfig&); private: - virtual void initializeNodeSpecific(); - virtual StorageLink::UP createChain(); + virtual void initializeNodeSpecific() override; + virtual StorageLink::UP createChain() override; - virtual api::Timestamp getUniqueTimestamp(); + virtual api::Timestamp getUniqueTimestamp() override; /** * Shut down necessary distributor-specific components before shutting diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.cpp b/storage/src/vespa/storage/storageserver/mergethrottler.cpp index c8cfd7f3214..ebfa10fe814 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.cpp +++ b/storage/src/vespa/storage/storageserver/mergethrottler.cpp @@ -35,10 +35,10 @@ class DummyMbusMessage : public Base private: static const mbus::string NAME; public: - const mbus::string& getProtocol() const { return NAME; } - uint32_t getType() const { return 0x1badb007; } + const mbus::string& getProtocol() const override { return NAME; } + uint32_t getType() const override { return 0x1badb007; } - uint8_t priority() const { return 255; } + uint8_t priority() const override { return 255; } }; template <typename Base> diff --git a/storage/src/vespa/storage/storageserver/mergethrottler.h b/storage/src/vespa/storage/storageserver/mergethrottler.h index c58c11d48e0..8ee4ca7be71 100644 --- a/storage/src/vespa/storage/storageserver/mergethrottler.h +++ b/storage/src/vespa/storage/storageserver/mergethrottler.h @@ -245,15 +245,15 @@ public: ~MergeThrottler(); /** Implements document::Runnable::run */ - void run(framework::ThreadHandle&); + void run(framework::ThreadHandle&) override; - void onOpen(); - void onClose(); - void onFlush(bool downwards); - bool onUp(const std::shared_ptr<api::StorageMessage>& msg); - bool onDown(const std::shared_ptr<api::StorageMessage>& msg); + void onOpen() override; + void onClose() override; + void onFlush(bool downwards) override; + bool onUp(const std::shared_ptr<api::StorageMessage>& msg) override; + bool onDown(const std::shared_ptr<api::StorageMessage>& msg) override; - bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>& stateCmd); + bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>& stateCmd) override; // For unit testing only const ActiveMergeMap& getActiveMerges() const { return _merges; } @@ -270,11 +270,10 @@ public: std::size_t getMaxQueueSize() const { return _maxQueueSize; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; // HtmlStatusReporter implementation - void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const; + void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; private: friend class ThreadRendezvousGuard; // impl in .cpp file @@ -328,7 +327,7 @@ private: /** * Callback method for config system (IFetcherCallback) */ - void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig> newConfig); + void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig> newConfig) override; // NOTE: unless explicitly specified, all the below functions require // _sync lock to be held upon call (usually implicitly via MessageGuard) diff --git a/storage/src/vespa/storage/storageserver/opslogger.h b/storage/src/vespa/storage/storageserver/opslogger.h index 6f6b52c4607..57f304a04aa 100644 --- a/storage/src/vespa/storage/storageserver/opslogger.h +++ b/storage/src/vespa/storage/storageserver/opslogger.h @@ -26,21 +26,20 @@ public: const config::ConfigUri & configUri); ~OpsLogger(); - void onClose(); + void onClose() override; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - bool onPutReply(const std::shared_ptr<api::PutReply>& msg); - bool onUpdateReply(const std::shared_ptr<api::UpdateReply>& msg); - bool onRemoveReply(const std::shared_ptr<api::RemoveReply>& msg); - bool onGetReply(const std::shared_ptr<api::GetReply>& msg); + bool onPutReply(const std::shared_ptr<api::PutReply>& msg) override; + bool onUpdateReply(const std::shared_ptr<api::UpdateReply>& msg) override; + bool onRemoveReply(const std::shared_ptr<api::RemoveReply>& msg) override; + bool onGetReply(const std::shared_ptr<api::GetReply>& msg) override; /** Ignore all replies on the way down the storage chain. */ - bool onDown(const std::shared_ptr<api::StorageMessage>&) + bool onDown(const std::shared_ptr<api::StorageMessage>&) override { return false; }; - void configure(std::unique_ptr<vespa::config::content::core::StorOpsloggerConfig> config); + void configure(std::unique_ptr<vespa::config::content::core::StorOpsloggerConfig> config) override; private: vespalib::Lock _lock; diff --git a/storage/src/vespa/storage/storageserver/priorityconverter.h b/storage/src/vespa/storage/storageserver/priorityconverter.h index 5e7eb54acf9..62e476606bc 100644 --- a/storage/src/vespa/storage/storageserver/priorityconverter.h +++ b/storage/src/vespa/storage/storageserver/priorityconverter.h @@ -25,7 +25,7 @@ public: /** Converts the given priority into a document api priority number. */ documentapi::Priority::Value toDocumentPriority(uint8_t) const; - void configure(std::unique_ptr<Config> config); + void configure(std::unique_ptr<Config> config) override; private: static_assert(documentapi::Priority::PRI_ENUM_SIZE == 16, diff --git a/storage/src/vespa/storage/storageserver/statemanager.h b/storage/src/vespa/storage/storageserver/statemanager.h index 537ecec2e72..028168937b5 100644 --- a/storage/src/vespa/storage/storageserver/statemanager.h +++ b/storage/src/vespa/storage/storageserver/statemanager.h @@ -67,27 +67,25 @@ public: std::unique_ptr<HostInfo>, bool testMode = false); ~StateManager(); - void onOpen(); - void onClose(); + void onOpen() override; + void onClose() override; void tick(); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Implementation of HtmlStatusReporter */ - virtual void reportHtmlStatus(std::ostream&, - const framework::HttpUrlPath&) const; + virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; - virtual lib::NodeState::CSP getReportedNodeState() const; - virtual lib::NodeState::CSP getCurrentNodeState() const; - virtual lib::ClusterState::CSP getSystemState() const; + virtual lib::NodeState::CSP getReportedNodeState() const override; + virtual lib::NodeState::CSP getCurrentNodeState() const override; + virtual lib::ClusterState::CSP getSystemState() const override; - virtual void addStateListener(StateListener&); - virtual void removeStateListener(StateListener&); + virtual void addStateListener(StateListener&) override; + virtual void removeStateListener(StateListener&) override; - virtual Lock::SP grabStateChangeLock(); - virtual void setReportedNodeState(const lib::NodeState& state); + virtual Lock::SP grabStateChangeLock() override; + virtual void setReportedNodeState(const lib::NodeState& state) override; void setClusterState(const lib::ClusterState& c); @@ -130,15 +128,15 @@ private: const lib::ClusterState& currentState, const lib::ClusterState& newState) const; - bool onGetNodeState(const std::shared_ptr<api::GetNodeStateCommand>&); - bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>&); + bool onGetNodeState(const std::shared_ptr<api::GetNodeStateCommand>&) override; + bool onSetSystemState(const std::shared_ptr<api::SetSystemStateCommand>&) override; /** * _stateLock MUST NOT be held while calling. */ std::string getNodeInfo() const; - virtual void run(framework::ThreadHandle&); + virtual void run(framework::ThreadHandle&) override; }; diff --git a/storage/src/vespa/storage/storageserver/statereporter.h b/storage/src/vespa/storage/storageserver/statereporter.h index dfef97e85d0..51a9e93a197 100644 --- a/storage/src/vespa/storage/storageserver/statereporter.h +++ b/storage/src/vespa/storage/storageserver/statereporter.h @@ -38,9 +38,9 @@ public: ~StateReporter(); vespalib::string getReportContentType( - const framework::HttpUrlPath&) const; + const framework::HttpUrlPath&) const override; bool reportStatus(std::ostream& out, - const framework::HttpUrlPath& path) const; + const framework::HttpUrlPath& path) const override; private: metrics::MetricManager &_manager; diff --git a/storage/src/vespa/storage/storageserver/storagenode.h b/storage/src/vespa/storage/storageserver/storagenode.h index 3e4a4b7642e..5df29191489 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.h +++ b/storage/src/vespa/storage/storageserver/storagenode.h @@ -81,10 +81,10 @@ public: bool attemptedStopped() const; - virtual void notifyDoneInitializing(); + virtual void notifyDoneInitializing() override; void waitUntilInitialized(uint32_t timeoutSeconds = 15); - void updateMetrics(const MetricLockGuard & guard); + void updateMetrics(const MetricLockGuard & guard) override; /** Updates the document type repo. */ void setNewDocumentRepo(const document::DocumentTypeRepo::SP& repo); @@ -95,7 +95,7 @@ public: */ virtual ResumeGuard pause() = 0; - void requestShutdown(vespalib::stringref reason); + void requestShutdown(vespalib::stringref reason) override; void notifyPartitionDown(int partId, vespalib::stringref reason); @@ -140,10 +140,10 @@ private: std::unique_ptr<StorageLink> _chain; /** Implementation of config callbacks. */ - virtual void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig> config); - virtual void configure(std::unique_ptr<vespa::config::content::UpgradingConfig> config); - virtual void configure(std::unique_ptr<vespa::config::content::StorDistributionConfig> config); - virtual void configure(std::unique_ptr<vespa::config::content::core::StorPrioritymappingConfig>); + virtual void configure(std::unique_ptr<vespa::config::content::core::StorServerConfig> config) override; + virtual void configure(std::unique_ptr<vespa::config::content::UpgradingConfig> config) override; + virtual void configure(std::unique_ptr<vespa::config::content::StorDistributionConfig> config) override; + virtual void configure(std::unique_ptr<vespa::config::content::core::StorPrioritymappingConfig>) override; virtual void configure(std::unique_ptr<document::DocumenttypesConfig> config, bool hasChanged, int64_t generation); void updateUpgradeFlag(const vespa::config::content::UpgradingConfig&); diff --git a/storage/src/vespa/storage/tools/storage-cmd.cpp b/storage/src/vespa/storage/tools/storage-cmd.cpp index 021e5ed9b03..8b0496507c5 100644 --- a/storage/src/vespa/storage/tools/storage-cmd.cpp +++ b/storage/src/vespa/storage/tools/storage-cmd.cpp @@ -43,7 +43,7 @@ private: } public: - int Main() { + int Main() override { if (_argc < 3) { fprintf(stderr, "usage: storage-cmd <connectspec> <method> [args]\n"); fprintf(stderr, "Calls RPC method on a storage/distributor process\n"); diff --git a/storage/src/vespa/storage/tools/throttlingsim.h b/storage/src/vespa/storage/tools/throttlingsim.h index 9135507c0d3..b583a7d2533 100644 --- a/storage/src/vespa/storage/tools/throttlingsim.h +++ b/storage/src/vespa/storage/tools/throttlingsim.h @@ -33,7 +33,7 @@ public: Receiver(int meanwait, int max) : meanwaitms(meanwait), processed(0), maxqueuesize(max) {}; bool enqueue(const Message& msg); - void run(); + void run() override; void print(); }; @@ -55,7 +55,7 @@ public: void sendMessage(const Message& m); void print(); - void run(); + void run() override; }; Messaging::Messaging(int meanwait) : lastOk(0), meanwaitms(meanwait) {} @@ -75,7 +75,7 @@ public: double max_diff; virtual void returnMessage(const Message& m) = 0; - virtual void run(); + virtual void run() override; virtual void print(double timenow); Client(Messaging& msgng, double windowSize, int to); @@ -92,16 +92,16 @@ public: FixedClient(Messaging& msgng, int winsize, int to) : Client(msgng, winsize, to) {}; - virtual void returnMessage(const Message& m); + virtual void returnMessage(const Message& m) override; }; class LoadBalancingClient : public Client { public: LoadBalancingClient(Messaging& msgng, int winsize, int to); - virtual void returnMessage(const Message& m); - virtual void run(); - virtual void print(double timenow); + virtual void returnMessage(const Message& m) override; + virtual void run() override; + virtual void print(double timenow) override; std::vector<double> weights; }; @@ -110,9 +110,9 @@ class BusyCounterBalancingClient : public Client { public: BusyCounterBalancingClient(Messaging& msgng, int winsize, int to); - virtual void returnMessage(const Message& m); - virtual void run(); - virtual void print(double timenow); + virtual void returnMessage(const Message& m) override; + virtual void run() override; + virtual void print(double timenow) override; std::vector<int> busyCount; }; @@ -127,7 +127,7 @@ public: DynamicClient(Messaging& msgng, int maxWinSize, double to) : Client(msgng, 1, static_cast<int>(to)), maxwinsize(maxWinSize), threshold(maxWinSize / 2), lastFailTimestamp(0) {}; - virtual void returnMessage(const Message& m); + virtual void returnMessage(const Message& m) override; }; class LatencyControlClient : public Client { @@ -138,9 +138,9 @@ public: : Client(msgng, 1, static_cast<int>(to)), count(0){}; - virtual void returnMessage(const Message& m); + virtual void returnMessage(const Message& m) override; - virtual void print(double timenow); + virtual void print(double timenow) override; }; @@ -153,6 +153,6 @@ private: public: ThrottlingApp() {}; - int Main(); + int Main() override; }; diff --git a/storage/src/vespa/storage/visiting/countvisitor.h b/storage/src/vespa/storage/visiting/countvisitor.h index 75e0e866553..ecf51035a03 100644 --- a/storage/src/vespa/storage/visiting/countvisitor.h +++ b/storage/src/vespa/storage/visiting/countvisitor.h @@ -18,12 +18,12 @@ public: CountVisitor(StorageComponent&, const vdslib::Parameters& params); - virtual void completedVisiting(HitCounter&); + virtual void completedVisiting(HitCounter&) override; private: void handleDocuments(const document::BucketId& bucketId, std::vector<spi::DocEntry::UP>& entries, - HitCounter& hitCounter); + HitCounter& hitCounter) override; bool _doScheme; std::map<std::string, int> _schemeCount; @@ -43,13 +43,13 @@ private: struct CountVisitorFactory : public VisitorFactory { VisitorEnvironment::UP - makeVisitorEnvironment(StorageComponent&) { + makeVisitorEnvironment(StorageComponent&) override { return VisitorEnvironment::UP(new VisitorEnvironment); }; Visitor* makeVisitor(StorageComponent& c, VisitorEnvironment&, - const vdslib::Parameters& params) + const vdslib::Parameters& params) override { return new CountVisitor(c, params); } diff --git a/storage/src/vespa/storage/visiting/dumpvisitor.h b/storage/src/vespa/storage/visiting/dumpvisitor.h index 0aa690ce3c0..31ff8ef0638 100644 --- a/storage/src/vespa/storage/visiting/dumpvisitor.h +++ b/storage/src/vespa/storage/visiting/dumpvisitor.h @@ -27,7 +27,7 @@ private: void handleDocuments(const document::BucketId& bucketId, std::vector<spi::DocEntry::UP>& entries, - HitCounter& hitCounter); + HitCounter& hitCounter) override; std::unique_ptr<std::set<std::string> > _requestedFields; std::unique_ptr<std::set<std::string> > _requestedDocuments; @@ -40,13 +40,13 @@ public: DumpVisitorFactory() {} VisitorEnvironment::UP - makeVisitorEnvironment(StorageComponent&) { + makeVisitorEnvironment(StorageComponent&) override { return VisitorEnvironment::UP(new VisitorEnvironment); }; storage::Visitor* makeVisitor(StorageComponent& component, storage::VisitorEnvironment&, - const vdslib::Parameters& params) + const vdslib::Parameters& params) override { return new DumpVisitor(component, params); } diff --git a/storage/src/vespa/storage/visiting/dumpvisitorsingle.h b/storage/src/vespa/storage/visiting/dumpvisitorsingle.h index eab10ad2653..d7f7b63d851 100644 --- a/storage/src/vespa/storage/visiting/dumpvisitorsingle.h +++ b/storage/src/vespa/storage/visiting/dumpvisitorsingle.h @@ -20,20 +20,19 @@ public: private: void handleDocuments(const document::BucketId&, - std::vector<spi::DocEntry::UP>&, - HitCounter&); + std::vector<spi::DocEntry::UP>&, HitCounter&) override; }; struct DumpVisitorSingleFactory : public VisitorFactory { VisitorEnvironment::UP - makeVisitorEnvironment(StorageComponent&) { + makeVisitorEnvironment(StorageComponent&) override { return VisitorEnvironment::UP(new VisitorEnvironment); }; Visitor* - makeVisitor(StorageComponent& c, VisitorEnvironment&, - const vdslib::Parameters& params) + makeVisitor(StorageComponent& c, + VisitorEnvironment&, const vdslib::Parameters& params) override { return new DumpVisitorSingle(c, params); } diff --git a/storage/src/vespa/storage/visiting/messages.h b/storage/src/vespa/storage/visiting/messages.h index ab5628b6669..d646355895f 100644 --- a/storage/src/vespa/storage/visiting/messages.h +++ b/storage/src/vespa/storage/visiting/messages.h @@ -28,11 +28,11 @@ public: : api::InternalCommand(ID), _config(config) {} - std::unique_ptr<api::StorageReply> makeReply(); + std::unique_ptr<api::StorageReply> makeReply() override; const vespa::config::content::core::StorVisitorConfig& getConfig() const { return _config; } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "PropagateVisitorConfig()"; @@ -57,7 +57,7 @@ public: } - virtual void print(std::ostream& out, bool verbose, const std::string& indent) const + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "PropagateVisitorConfigReply()"; diff --git a/storage/src/vespa/storage/visiting/recoveryvisitor.h b/storage/src/vespa/storage/visiting/recoveryvisitor.h index b8c64e7d0fd..dac6996028b 100644 --- a/storage/src/vespa/storage/visiting/recoveryvisitor.h +++ b/storage/src/vespa/storage/visiting/recoveryvisitor.h @@ -26,9 +26,9 @@ public: private: void handleDocuments(const document::BucketId& bucketId, std::vector<spi::DocEntry::UP>& entries, - HitCounter& hitCounter); + HitCounter& hitCounter) override; - void completedBucket(const document::BucketId&, HitCounter&); + void completedBucket(const document::BucketId&, HitCounter&) override; std::set<std::string> _requestedFields; @@ -42,13 +42,13 @@ private: struct RecoveryVisitorFactory : public VisitorFactory { VisitorEnvironment::UP - makeVisitorEnvironment(StorageComponent&) { + makeVisitorEnvironment(StorageComponent&) override { return VisitorEnvironment::UP(new VisitorEnvironment); }; Visitor* makeVisitor(StorageComponent& c, VisitorEnvironment&, - const vdslib::Parameters& params) + const vdslib::Parameters& params) override { return new RecoveryVisitor(c, params); } diff --git a/storage/src/vespa/storage/visiting/testvisitor.h b/storage/src/vespa/storage/visiting/testvisitor.h index 9d4bb498ae0..c2740b11d56 100644 --- a/storage/src/vespa/storage/visiting/testvisitor.h +++ b/storage/src/vespa/storage/visiting/testvisitor.h @@ -17,21 +17,21 @@ public: TestVisitor(StorageComponent&, const vdslib::Parameters&); private: - void startingVisitor(const std::vector<document::BucketId>& buckets); + void startingVisitor(const std::vector<document::BucketId>& buckets) override; void handleDocuments(const document::BucketId& bucketId, std::vector<spi::DocEntry::UP>& entries, - HitCounter& hitCounter); + HitCounter& hitCounter) override; - void completedBucket(const document::BucketId& bucket, HitCounter& hitCounter); + void completedBucket(const document::BucketId& bucket, HitCounter& hitCounter) override; spi::ReadConsistency getRequiredReadConsistency() const override { return spi::ReadConsistency::WEAK; } - void completedVisiting(HitCounter& hitCounter); + void completedVisiting(HitCounter& hitCounter) override; - void abortedVisiting(); + void abortedVisiting() override; // Send datagram with message back to client void report(const std::string& message); @@ -42,13 +42,13 @@ private: struct TestVisitorFactory : public VisitorFactory { VisitorEnvironment::UP - makeVisitorEnvironment(StorageComponent&) { + makeVisitorEnvironment(StorageComponent&) override { return VisitorEnvironment::UP(new VisitorEnvironment); }; Visitor* makeVisitor(StorageComponent& c, VisitorEnvironment&, - const vdslib::Parameters& params) { + const vdslib::Parameters& params) override { return new TestVisitor(c, params); } diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h index a392374ed5d..3d5e9fc2c53 100644 --- a/storage/src/vespa/storage/visiting/visitor.h +++ b/storage/src/vespa/storage/visiting/visitor.h @@ -174,8 +174,7 @@ private: bool hasPendingIterators() const { return _pendingIterators > 0; } - void print(std::ostream& out, bool /*verbose*/, - const std::string& /*indent*/) const + void print(std::ostream& out, bool, const std::string& /*indent*/) const override { out << "BucketIterationState(" << _bucketId diff --git a/storage/src/vespa/storage/visiting/visitormanager.h b/storage/src/vespa/storage/visiting/visitormanager.h index aa9ecf37647..9b750e3af4f 100644 --- a/storage/src/vespa/storage/visiting/visitormanager.h +++ b/storage/src/vespa/storage/visiting/visitormanager.h @@ -92,10 +92,9 @@ public: const VisitorFactory::Map& external = VisitorFactory::Map()); virtual ~VisitorManager(); - virtual void onClose(); + virtual void onClose() override; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; uint32_t getActiveVisitorCount() const; @@ -126,8 +125,8 @@ public: void enforceQueueUsage() { _enforceQueueUse = true; } private: - void configure(std::unique_ptr<vespa::config::content::core::StorVisitorConfig>); - virtual void run(framework::ThreadHandle&); + void configure(std::unique_ptr<vespa::config::content::core::StorVisitorConfig>) override; + virtual void run(framework::ThreadHandle&) override; /** * Schedules a visitor for running. onCreateVisitor will typically call @@ -139,10 +138,10 @@ private: bool scheduleVisitor(const std::shared_ptr<api::CreateVisitorCommand>&, bool skipQueue, vespalib::MonitorGuard& visitorLock); - bool onCreateVisitor(const std::shared_ptr<api::CreateVisitorCommand>&); + bool onCreateVisitor(const std::shared_ptr<api::CreateVisitorCommand>&) override; - bool onDown(const std::shared_ptr<api::StorageMessage>& r); - bool onInternalReply(const std::shared_ptr<api::InternalReply>& r); + bool onDown(const std::shared_ptr<api::StorageMessage>& r) override; + bool onInternalReply(const std::shared_ptr<api::InternalReply>& r) override; bool processReply(const std::shared_ptr<api::StorageReply>&); /** @@ -159,14 +158,12 @@ private: bool attemptScheduleQueuedVisitor(vespalib::MonitorGuard& visitorLock); // VisitorMessageHandler implementation - void send(const std::shared_ptr<api::StorageCommand>& cmd, - Visitor& visitor); - void send(const std::shared_ptr<api::StorageReply>& reply); - void closed(api::VisitorId id); + void send(const std::shared_ptr<api::StorageCommand>& cmd, Visitor& visitor) override; + void send(const std::shared_ptr<api::StorageReply>& reply) override; + void closed(api::VisitorId id) override; // Status::Reporter implementation - virtual void reportHtmlStatus(std::ostream&, - const framework::HttpUrlPath&) const; + virtual void reportHtmlStatus(std::ostream&, const framework::HttpUrlPath&) const override; /** * The maximum amount of concurrent visitors for a priority is given diff --git a/storage/src/vespa/storage/visiting/visitorthread.h b/storage/src/vespa/storage/visiting/visitorthread.h index fdfef7b2073..2f0a125d6ce 100644 --- a/storage/src/vespa/storage/visiting/visitorthread.h +++ b/storage/src/vespa/storage/visiting/visitorthread.h @@ -117,7 +117,7 @@ public: } private: - virtual void run(framework::ThreadHandle&); + virtual void run(framework::ThreadHandle&) override; /** * Attempt to fetch an event from the visitor thread's queue. If an event * was available, pop it from the queue and return it. If not, return @@ -134,11 +134,11 @@ private: const vdslib::Parameters& params, vespalib::asciistream & error); - bool onCreateVisitor(const std::shared_ptr<api::CreateVisitorCommand>&); + bool onCreateVisitor(const std::shared_ptr<api::CreateVisitorCommand>&) override; bool onVisitorReply(const std::shared_ptr<api::StorageReply>& reply); - bool onInternal(const std::shared_ptr<api::InternalCommand>&); - bool onInternalReply(const std::shared_ptr<api::InternalReply>&); + bool onInternal(const std::shared_ptr<api::InternalCommand>&) override; + bool onInternalReply(const std::shared_ptr<api::InternalReply>&) override; /** Deletes a visitor instance. */ void close(); diff --git a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp index 5a7a2d65da8..bc71429032e 100644 --- a/storageapi/src/tests/mbusprot/storageprotocoltest.cpp +++ b/storageapi/src/tests/mbusprot/storageprotocoltest.cpp @@ -835,10 +835,9 @@ namespace { struct MyCommand : public api::InternalCommand { MyCommand() : InternalCommand(101) {} - api::StorageReply::UP makeReply(); + api::StorageReply::UP makeReply() override; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "MyCommand()"; if (verbose) { @@ -851,8 +850,7 @@ namespace { struct MyReply : public api::InternalReply { MyReply(const MyCommand& cmd) : InternalReply(102, cmd) {} - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override { out << "MyReply()"; if (verbose) { diff --git a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h index 4b5a5a724d0..692cc171250 100644 --- a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h +++ b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h @@ -79,11 +79,11 @@ public: } void print(std::ostream& out, bool verbose, - const std::string& indent) const + const std::string& indent) const override { vespalib::AsciiPrintable::print(out, verbose, indent); } - virtual void print(vespalib::asciistream&, const PrintProperties&) const; + virtual void print(vespalib::asciistream&, const PrintProperties&) const override; void printXml(vespalib::XmlOutputStream&) const; }; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h index 97a56b5da22..9fa125b1159 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization4_2.h @@ -11,29 +11,29 @@ public: ProtocolSerialization4_2(const document::DocumentTypeRepo::SP&); protected: - virtual void onEncode(GBBuf&, const api::GetCommand&) const; - virtual void onEncode(GBBuf&, const api::RemoveCommand&) const; - virtual void onEncode(GBBuf&, const api::RevertCommand&) const; - virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const; - virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const; - virtual void onEncode(GBBuf&, const api::GetBucketDiffCommand&) const; - virtual void onEncode(GBBuf&, const api::ApplyBucketDiffCommand&) const; - virtual void onEncode(GBBuf&, const api::RequestBucketInfoReply&) const; - virtual void onEncode(GBBuf&, const api::NotifyBucketChangeCommand&) const; - virtual void onEncode(GBBuf&, const api::NotifyBucketChangeReply&) const; - virtual void onEncode(GBBuf&, const api::SplitBucketCommand&) const; - virtual void onEncode(GBBuf&, const api::MultiOperationCommand&) const; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const; - virtual void onEncode(GBBuf&, const api::DestroyVisitorCommand&) const; - virtual void onEncode(GBBuf&, const api::DestroyVisitorReply&) const; - virtual void onEncode(GBBuf&, const api::RemoveLocationCommand&) const; - virtual void onEncode(GBBuf&, const api::RemoveLocationReply&) const; + virtual void onEncode(GBBuf&, const api::GetCommand&) const override; + virtual void onEncode(GBBuf&, const api::RemoveCommand&) const override; + virtual void onEncode(GBBuf&, const api::RevertCommand&) const override; + virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::GetBucketDiffCommand&) const override; + virtual void onEncode(GBBuf&, const api::ApplyBucketDiffCommand&) const override; + virtual void onEncode(GBBuf&, const api::RequestBucketInfoReply&) const override; + virtual void onEncode(GBBuf&, const api::NotifyBucketChangeCommand&) const override; + virtual void onEncode(GBBuf&, const api::NotifyBucketChangeReply&) const override; + virtual void onEncode(GBBuf&, const api::SplitBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::MultiOperationCommand&) const override; + virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; + virtual void onEncode(GBBuf&, const api::DestroyVisitorCommand&) const override; + virtual void onEncode(GBBuf&, const api::DestroyVisitorReply&) const override; + virtual void onEncode(GBBuf&, const api::RemoveLocationCommand&) const override; + virtual void onEncode(GBBuf&, const api::RemoveLocationReply&) const override; // Not supported on 4.2, but implemented here for simplicity. - virtual void onEncode(GBBuf&, const api::BatchPutRemoveCommand&) const; - virtual void onEncode(GBBuf&, const api::BatchPutRemoveReply&) const; - virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const; - virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const; + virtual void onEncode(GBBuf&, const api::BatchPutRemoveCommand&) const override; + virtual void onEncode(GBBuf&, const api::BatchPutRemoveReply&) const override; + virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; + virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; virtual void onEncodeBucketInfoCommand(GBBuf&, const api::BucketInfoCommand&) const; virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const = 0; @@ -42,29 +42,29 @@ protected: virtual void onEncodeDiffEntry(GBBuf&, const api::GetBucketDiffCommand::Entry&) const; virtual void onEncode(GBBuf&, const api::ReturnCode&) const; - virtual SCmd::UP onDecodeGetCommand(BBuf&) const; - virtual SCmd::UP onDecodeRemoveCommand(BBuf&) const; - virtual SCmd::UP onDecodeRevertCommand(BBuf&) const; - virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const; - virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const; - virtual SCmd::UP onDecodeGetBucketDiffCommand(BBuf&) const; - virtual SCmd::UP onDecodeApplyBucketDiffCommand(BBuf&) const; - virtual SRep::UP onDecodeRequestBucketInfoReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeNotifyBucketChangeCommand(BBuf&) const; - virtual SRep::UP onDecodeNotifyBucketChangeReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeSplitBucketCommand(BBuf&) const; - virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const; - virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeMultiOperationCommand(BBuf&) const; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const; - virtual SCmd::UP onDecodeDestroyVisitorCommand(BBuf&) const; - virtual SRep::UP onDecodeDestroyVisitorReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeRemoveLocationCommand(BBuf&) const; - virtual SRep::UP onDecodeRemoveLocationReply(const SCmd&, BBuf&) const; + virtual SCmd::UP onDecodeGetCommand(BBuf&) const override; + virtual SCmd::UP onDecodeRemoveCommand(BBuf&) const override; + virtual SCmd::UP onDecodeRevertCommand(BBuf&) const override; + virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; + virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; + virtual SCmd::UP onDecodeGetBucketDiffCommand(BBuf&) const override; + virtual SCmd::UP onDecodeApplyBucketDiffCommand(BBuf&) const override; + virtual SRep::UP onDecodeRequestBucketInfoReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeNotifyBucketChangeCommand(BBuf&) const override; + virtual SRep::UP onDecodeNotifyBucketChangeReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeSplitBucketCommand(BBuf&) const override; + virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; + virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeMultiOperationCommand(BBuf&) const override; + virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + virtual SCmd::UP onDecodeDestroyVisitorCommand(BBuf&) const override; + virtual SRep::UP onDecodeDestroyVisitorReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeRemoveLocationCommand(BBuf&) const override; + virtual SRep::UP onDecodeRemoveLocationReply(const SCmd&, BBuf&) const override; // Not supported on 4.2, but implemented here for simplicity. - virtual SCmd::UP onDecodeBatchPutRemoveCommand(BBuf&) const; - virtual SRep::UP onDecodeBatchPutRemoveReply(const SCmd&, BBuf&) const; + virtual SCmd::UP onDecodeBatchPutRemoveCommand(BBuf&) const override; + virtual SRep::UP onDecodeBatchPutRemoveReply(const SCmd&, BBuf&) const override; virtual void onDecodeBucketInfoCommand(BBuf&, api::BucketInfoCommand&) const; virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const = 0; diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h index 61de1d97d37..c5a26987a08 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_0.h @@ -15,64 +15,64 @@ public: ProtocolSerialization5_0(const document::DocumentTypeRepo::SP&, const documentapi::LoadTypeSet& loadTypes); - virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const; + virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; virtual void putBucketInfo(const api::BucketInfo& info, - vespalib::GrowableByteBuffer& buf) const; + vespalib::GrowableByteBuffer& buf) const override; - virtual void onEncode(GBBuf&, const api::PutCommand&) const; - virtual void onEncode(GBBuf&, const api::PutReply&) const; - virtual void onEncode(GBBuf&, const api::UpdateCommand&) const; - virtual void onEncode(GBBuf&, const api::UpdateReply&) const; - virtual void onEncode(GBBuf&, const api::GetReply&) const; - virtual void onEncode(GBBuf&, const api::RemoveReply&) const; - virtual void onEncode(GBBuf&, const api::RevertReply&) const; - virtual void onEncode(GBBuf&, const api::CreateBucketReply&) const; - virtual void onEncode(GBBuf&, const api::DeleteBucketCommand&) const; - virtual void onEncode(GBBuf&, const api::DeleteBucketReply&) const; - virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const; - virtual void onEncode(GBBuf&, const api::MergeBucketReply&) const; - virtual void onEncode(GBBuf&, const api::GetBucketDiffReply&) const; - virtual void onEncode(GBBuf&, const api::ApplyBucketDiffReply&) const; - virtual void onEncode(GBBuf&, const api::SplitBucketReply&) const; - virtual void onEncode(GBBuf&, const api::MultiOperationReply&) const; - virtual void onEncode(GBBuf&, const api::JoinBucketsCommand&) const; - virtual void onEncode(GBBuf&, const api::JoinBucketsReply&) const; - virtual void onEncode(GBBuf&, const api::RequestBucketInfoCommand&) const; + virtual void onEncode(GBBuf&, const api::PutCommand&) const override; + virtual void onEncode(GBBuf&, const api::PutReply&) const override; + virtual void onEncode(GBBuf&, const api::UpdateCommand&) const override; + virtual void onEncode(GBBuf&, const api::UpdateReply&) const override; + virtual void onEncode(GBBuf&, const api::GetReply&) const override; + virtual void onEncode(GBBuf&, const api::RemoveReply&) const override; + virtual void onEncode(GBBuf&, const api::RevertReply&) const override; + virtual void onEncode(GBBuf&, const api::CreateBucketReply&) const override; + virtual void onEncode(GBBuf&, const api::DeleteBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::DeleteBucketReply&) const override; + virtual void onEncode(GBBuf&, const api::MergeBucketCommand&) const override; + virtual void onEncode(GBBuf&, const api::MergeBucketReply&) const override; + virtual void onEncode(GBBuf&, const api::GetBucketDiffReply&) const override; + virtual void onEncode(GBBuf&, const api::ApplyBucketDiffReply&) const override; + virtual void onEncode(GBBuf&, const api::SplitBucketReply&) const override; + virtual void onEncode(GBBuf&, const api::MultiOperationReply&) const override; + virtual void onEncode(GBBuf&, const api::JoinBucketsCommand&) const override; + virtual void onEncode(GBBuf&, const api::JoinBucketsReply&) const override; + virtual void onEncode(GBBuf&, const api::RequestBucketInfoCommand&) const override; - virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const; + virtual void onEncodeBucketInfoReply(GBBuf&, const api::BucketInfoReply&) const override; virtual void onEncodeBucketReply(GBBuf&, const api::BucketReply&) const; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand& msg) const; - virtual void onEncode(GBBuf&, const api::CreateVisitorReply& msg) const; - virtual void onEncodeCommand(GBBuf&, const api::StorageCommand&) const; - virtual void onEncodeReply(GBBuf&, const api::StorageReply&) const; + virtual void onEncode(GBBuf&, const api::CreateVisitorCommand& msg) const override; + virtual void onEncode(GBBuf&, const api::CreateVisitorReply& msg) const override; + virtual void onEncodeCommand(GBBuf&, const api::StorageCommand&) const override; + virtual void onEncodeReply(GBBuf&, const api::StorageReply&) const override; - virtual SCmd::UP onDecodePutCommand(BBuf&) const; - virtual SRep::UP onDecodePutReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeUpdateCommand(BBuf&) const; - virtual SRep::UP onDecodeUpdateReply(const SCmd&, BBuf&) const; - virtual SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const; - virtual SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const; - virtual SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const; - virtual SRep::UP onDecodeCreateBucketReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const; - virtual SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const; - virtual SRep::UP onDecodeMergeBucketReply(const SCmd&, BBuf&) const; - virtual SRep::UP onDecodeGetBucketDiffReply(const SCmd&, BBuf&) const; - virtual SRep::UP onDecodeApplyBucketDiffReply(const SCmd&, BBuf&) const; - virtual SRep::UP onDecodeSplitBucketReply(const SCmd&, BBuf&) const; - virtual SRep::UP onDecodeMultiOperationReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeJoinBucketsCommand(BBuf& buf) const; - virtual SRep::UP onDecodeJoinBucketsReply(const SCmd& cmd, BBuf& buf) const; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const; - virtual SCmd::UP onDecodeRequestBucketInfoCommand(BBuf& buf) const; + virtual SCmd::UP onDecodePutCommand(BBuf&) const override; + virtual SRep::UP onDecodePutReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeUpdateCommand(BBuf&) const override; + virtual SRep::UP onDecodeUpdateReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeGetReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeRemoveReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeRevertReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeCreateBucketReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeDeleteBucketCommand(BBuf&) const override; + virtual SRep::UP onDecodeDeleteBucketReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeMergeBucketCommand(BBuf&) const override; + virtual SRep::UP onDecodeMergeBucketReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeGetBucketDiffReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeApplyBucketDiffReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeSplitBucketReply(const SCmd&, BBuf&) const override; + virtual SRep::UP onDecodeMultiOperationReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeJoinBucketsCommand(BBuf& buf) const override; + virtual SRep::UP onDecodeJoinBucketsReply(const SCmd& cmd, BBuf& buf) const override; + virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + virtual SCmd::UP onDecodeRequestBucketInfoCommand(BBuf& buf) const override; - virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const; + virtual void onDecodeBucketInfoReply(BBuf&, api::BucketInfoReply&) const override; virtual void onDecodeBucketReply(BBuf&, api::BucketReply&) const; - virtual SRep::UP onDecodeCreateVisitorReply(const SCmd& cmd, BBuf& buf) const; - virtual void onDecodeCommand(BBuf& buf, api::StorageCommand& msg) const; - virtual void onDecodeReply(BBuf&, api::StorageReply&) const; + virtual SRep::UP onDecodeCreateVisitorReply(const SCmd& cmd, BBuf& buf) const override; + virtual void onDecodeCommand(BBuf& buf, api::StorageCommand& msg) const override; + virtual void onDecodeReply(BBuf&, api::StorageReply&) const override; }; } // mbusprot diff --git a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h index 491dd5e02eb..393596046c2 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h +++ b/storageapi/src/vespa/storageapi/mbusprot/protocolserialization5_1.h @@ -17,22 +17,22 @@ public: ProtocolSerialization5_1(const document::DocumentTypeRepo::SP&, const documentapi::LoadTypeSet& loadTypes); - virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const; + virtual api::BucketInfo getBucketInfo(document::ByteBuffer& buf) const override; virtual void putBucketInfo(const api::BucketInfo& info, - vespalib::GrowableByteBuffer& buf) const; + vespalib::GrowableByteBuffer& buf) const override; protected: - virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const; - virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const; - virtual void onEncode(GBBuf&, const api::GetCommand&) const; - virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const; - virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const; - - virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const; - virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const; - virtual SCmd::UP onDecodeGetCommand(BBuf&) const; - virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const; - virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const; + virtual void onEncode(GBBuf&, const api::SetBucketStateCommand&) const override; + virtual void onEncode(GBBuf&, const api::SetBucketStateReply&) const override; + virtual void onEncode(GBBuf&, const api::GetCommand&) const override; + virtual void onEncode(GBBuf&, const api::CreateVisitorCommand&) const override; + virtual void onEncode(GBBuf&, const api::CreateBucketCommand&) const override; + + virtual SCmd::UP onDecodeSetBucketStateCommand(BBuf&) const override; + virtual SRep::UP onDecodeSetBucketStateReply(const SCmd&, BBuf&) const override; + virtual SCmd::UP onDecodeGetCommand(BBuf&) const override; + virtual SCmd::UP onDecodeCreateVisitorCommand(BBuf&) const override; + virtual SCmd::UP onDecodeCreateBucketCommand(BBuf&) const override; }; } // mbusprot diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h index 11ef23a1254..8549df6077f 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h @@ -15,16 +15,16 @@ public: StorageCommand(const storage::api::StorageCommand::SP&); - const mbus::string & getProtocol() const { return StorageProtocol::NAME; } + const mbus::string & getProtocol() const override { return StorageProtocol::NAME; } - uint32_t getType() const { return _cmd->getType().getId(); } + uint32_t getType() const override { return _cmd->getType().getId(); } const api::StorageCommand::SP& getCommand() { return _cmd; } api::StorageCommand::CSP getCommand() const { return _cmd; } - virtual api::StorageMessage::SP getInternalMessage() { return _cmd; } - virtual api::StorageMessage::CSP getInternalMessage() const { return _cmd; } + virtual api::StorageMessage::SP getInternalMessage() override { return _cmd; } + virtual api::StorageMessage::CSP getInternalMessage() const override { return _cmd; } - virtual uint8_t priority() const { + virtual uint8_t priority() const override { return ((getInternalMessage()->getPriority()) / 255) * 16; } diff --git a/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h b/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h index c490a17555a..8c10ab1dfe1 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storageprotocol.h @@ -22,17 +22,17 @@ public: const documentapi::LoadTypeSet& loadTypes); // Implements IProtocol. - const mbus::string& getName() const { return NAME; } + const mbus::string& getName() const override { return NAME; } // Implements IProtocol. mbus::IRoutingPolicy::UP createPolicy(const mbus::string& name, - const mbus::string& param) const; + const mbus::string& param) const override; // Implements IProtocol. - mbus::Blob encode(const vespalib::Version&, const mbus::Routable&) const; + mbus::Blob encode(const vespalib::Version&, const mbus::Routable&) const override; // Implements IProtocol. - mbus::Routable::UP decode(const vespalib::Version&, mbus::BlobRef) const; + mbus::Routable::UP decode(const vespalib::Version&, mbus::BlobRef) const override; private: ProtocolSerialization5_0 _serializer5_0; diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagereply.h b/storageapi/src/vespa/storageapi/mbusprot/storagereply.h index 429833bf08b..aa7c827a32a 100644 --- a/storageapi/src/vespa/storageapi/mbusprot/storagereply.h +++ b/storageapi/src/vespa/storageapi/mbusprot/storagereply.h @@ -22,19 +22,19 @@ public: StorageReply(const api::StorageReply::SP& reply); virtual ~StorageReply(); - virtual const mbus::string& getProtocol() const + virtual const mbus::string& getProtocol() const override { return StorageProtocol::NAME; } - uint32_t getType() const { return _mbusType; } + uint32_t getType() const override { return _mbusType; } const api::StorageReply::SP& getReply() { deserialize(); return _reply; } api::StorageReply::CSP getReply() const { deserialize(); return _reply; } - virtual api::StorageMessage::SP getInternalMessage() + virtual api::StorageMessage::SP getInternalMessage() override { deserialize(); return _reply; } - virtual api::StorageMessage::CSP getInternalMessage() const + virtual api::StorageMessage::CSP getInternalMessage() const override { deserialize(); return _reply; } - virtual uint8_t priority() const { + virtual uint8_t priority() const override { if (_reply.get()) { return _reply->getPriority(); } diff --git a/storageapi/src/vespa/storageapi/message/batch.h b/storageapi/src/vespa/storageapi/message/batch.h index b4788a5ae75..85e7a8df9ee 100644 --- a/storageapi/src/vespa/storageapi/message/batch.h +++ b/storageapi/src/vespa/storageapi/message/batch.h @@ -43,7 +43,7 @@ public: document::Document::SP document; - const document::DocumentId& getDocumentId() const { + const document::DocumentId& getDocumentId() const override { return document->getId(); } }; @@ -55,7 +55,7 @@ public: document::Document::SP document; uint64_t timestampToUpdate; - const document::DocumentId& getDocumentId() const { + const document::DocumentId& getDocumentId() const override { return document->getId(); } }; @@ -66,7 +66,7 @@ public: document::DocumentId documentId; - const document::DocumentId& getDocumentId() const { + const document::DocumentId& getDocumentId() const override { return documentId; } }; @@ -110,10 +110,9 @@ public: /** Returns an approximate size of this message. */ - uint32_t getMemoryFootprint() const { return _approxSize + 20; } + uint32_t getMemoryFootprint() const override { return _approxSize + 20; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(BatchPutRemoveCommand, onBatchPutRemove) @@ -135,8 +134,7 @@ private: public: explicit BatchPutRemoveReply(const BatchPutRemoveCommand&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; const std::vector<document::DocumentId>& getDocumentsNotFound() const { return _documentsNotFound; } std::vector<document::DocumentId>& getDocumentsNotFound() { return _documentsNotFound; } @@ -159,14 +157,13 @@ public: */ const UpdateList& getUpdates() const { return _updates; }; - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** Returns a bucket id suitable for routing this message. */ - document::BucketId getBucketId() const { return _bucketId; } - virtual bool hasSingleBucketId() const { return true; } + document::BucketId getBucketId() const override { return _bucketId; } + virtual bool hasSingleBucketId() const override { return true; } DECLARE_STORAGECOMMAND(BatchDocumentUpdateCommand, onBatchDocumentUpdate) @@ -187,8 +184,7 @@ class BatchDocumentUpdateReply : public StorageReply { public: explicit BatchDocumentUpdateReply(const BatchDocumentUpdateCommand&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; const std::vector<bool>& getDocumentsNotFound() const { return _documentsNotFound; } std::vector<bool>& getDocumentsNotFound() { return _documentsNotFound; } diff --git a/storageapi/src/vespa/storageapi/message/bucket.h b/storageapi/src/vespa/storageapi/message/bucket.h index d5c4584fe4e..c78591eca61 100644 --- a/storageapi/src/vespa/storageapi/message/bucket.h +++ b/storageapi/src/vespa/storageapi/message/bucket.h @@ -36,8 +36,7 @@ public: void setActive(bool active) { _active = active; } bool getActive() const { return _active; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(CreateBucketCommand, onCreateBucket) }; @@ -52,8 +51,7 @@ class CreateBucketReply : public BucketInfoReply { public: explicit CreateBucketReply(const CreateBucketCommand& cmd); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(CreateBucketReply, onCreateBucketReply); }; @@ -72,8 +70,7 @@ public: const BucketInfo& getBucketInfo() const { return _info; } void setBucketInfo(const BucketInfo& info) { _info = info; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(DeleteBucketCommand, onDeleteBucket) }; @@ -88,8 +85,7 @@ class DeleteBucketReply : public BucketInfoReply { public: explicit DeleteBucketReply(const DeleteBucketCommand& cmd); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(DeleteBucketReply, onDeleteBucketReply) }; @@ -146,8 +142,7 @@ public: void setClusterStateVersion(uint32_t version) { _clusterStateVersion = version; } void setChain(const std::vector<uint16_t>& chain) { _chain = chain; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(MergeBucketCommand, onMergeBucket) }; @@ -179,8 +174,7 @@ public: const std::vector<uint16_t>& getChain() const { return _chain; } uint32_t getClusterStateVersion() const { return _clusterStateVersion; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(MergeBucketReply, onMergeBucketReply) }; @@ -205,8 +199,7 @@ public: Entry(); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const Entry&) const; bool operator<(const Entry& e) const { return (_timestamp < e._timestamp); } @@ -226,8 +219,7 @@ public: const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetBucketDiffCommand, onGetBucketDiff) }; @@ -256,8 +248,7 @@ public: const std::vector<Entry>& getDiff() const { return _diff; } std::vector<Entry>& getDiff() { return _diff; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(GetBucketDiffReply, onGetBucketDiffReply) }; @@ -284,8 +275,7 @@ public: bool filled() const; - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool operator==(const Entry&) const; }; private: @@ -307,8 +297,7 @@ public: std::vector<Entry>& getDiff() { return _diff; } uint32_t getMaxBufferSize() const { return _maxBufferSize; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(ApplyBucketDiffCommand, onApplyBucketDiff) }; @@ -337,8 +326,7 @@ public: std::vector<Entry>& getDiff() { return _diff; } uint32_t getMaxBufferSize() const { return _maxBufferSize; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(ApplyBucketDiffReply, onApplyBucketDiffReply) }; @@ -381,8 +369,7 @@ public: const vespalib::string& getDistributionHash() const { return _distributionHash; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(RequestBucketInfoCommand, onRequestBucketInfo) }; @@ -419,10 +406,9 @@ public: const EntryVector & getBucketInfo() const { return _buckets; } EntryVector & getBucketInfo() { return _buckets; } - uint32_t getMemoryFootprint() const; + uint32_t getMemoryFootprint() const override; - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(RequestBucketInfoReply, onRequestBucketInfoReply) }; @@ -447,8 +433,7 @@ public: const BucketInfo& getBucketInfo() const { return _info; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(NotifyBucketChangeCommand, onNotifyBucketChange) }; @@ -467,8 +452,7 @@ class NotifyBucketChangeReply : public BucketReply { public: explicit NotifyBucketChangeReply(const NotifyBucketChangeCommand& cmd); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(NotifyBucketChangeReply, onNotifyBucketChangeReply) }; @@ -493,15 +477,13 @@ public: SetBucketStateCommand(const document::BucketId& bucket, BUCKET_STATE state); - void print(std::ostream& out, - bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; BUCKET_STATE getState() const { return _state; } DECLARE_STORAGECOMMAND(SetBucketStateCommand, onSetBucketState) private: - virtual vespalib::string getSummary() const; + virtual vespalib::string getSummary() const override; }; /** @@ -515,9 +497,7 @@ class SetBucketStateReply : public BucketInfoReply public: explicit SetBucketStateReply(const SetBucketStateCommand&); - void print(std::ostream& out, - bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SetBucketStateReply, onSetBucketStateReply) }; diff --git a/storageapi/src/vespa/storageapi/message/bucketsplitting.h b/storageapi/src/vespa/storageapi/message/bucketsplitting.h index cbddfc8eaf6..6188a7cc44f 100644 --- a/storageapi/src/vespa/storageapi/message/bucketsplitting.h +++ b/storageapi/src/vespa/storageapi/message/bucketsplitting.h @@ -57,8 +57,7 @@ public: void setMinByteSize(uint32_t v) { _minByteSize = v; } void setMinDocCount(uint32_t v) { _minDocCount = v; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(SplitBucketCommand, onSplitBucket) }; @@ -82,8 +81,7 @@ public: std::vector<Entry>& getSplitInfo() { return _result; } const std::vector<Entry>& getSplitInfo() const { return _result; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SplitBucketReply, onSplitBucketReply) }; @@ -110,8 +108,7 @@ public: void setMinJoinBits(uint8_t minJoinBits) { _minJoinBits = minJoinBits; } uint8_t getMinJoinBits() const { return _minJoinBits; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(JoinBucketsCommand, onJoinBuckets) }; @@ -133,8 +130,7 @@ public: const std::vector<document::BucketId>& getSourceBuckets() const { return _sources; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(JoinBucketsReply, onJoinBucketsReply) }; diff --git a/storageapi/src/vespa/storageapi/message/datagram.h b/storageapi/src/vespa/storageapi/message/datagram.h index 415c7c97908..040f925f98a 100644 --- a/storageapi/src/vespa/storageapi/message/datagram.h +++ b/storageapi/src/vespa/storageapi/message/datagram.h @@ -38,11 +38,10 @@ public: _docBlock = block; } - document::BucketId getBucketId() const { return _bucketId; } - virtual bool hasSingleBucketId() const { return true; } + document::BucketId getBucketId() const override { return _bucketId; } + virtual bool hasSingleBucketId() const override { return true; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; bool keepTimeStamps() const { return _keepTimeStamps; } void keepTimeStamps(bool keepTime) { _keepTimeStamps = keepTime; } @@ -60,8 +59,7 @@ class DocBlockReply : public StorageReply { public: explicit DocBlockReply(const DocBlockCommand&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(DocBlockReply, onDocBlockReply) }; @@ -85,8 +83,7 @@ public: vdslib::Parameters& getData() { return _statistics; }; const vdslib::Parameters& getData() const { return _statistics; }; - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(MapVisitorCommand, onMapVisitor) }; @@ -101,8 +98,7 @@ class MapVisitorReply : public StorageReply { public: explicit MapVisitorReply(const MapVisitorCommand&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(MapVisitorReply, onMapVisitorReply) }; @@ -144,8 +140,7 @@ public: std::vector<Entry>& getDocuments() { return _documents; } const std::vector<Entry>& getDocuments() const { return _documents; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(DocumentListCommand, onDocumentList) @@ -163,8 +158,7 @@ class DocumentListReply : public StorageReply { public: explicit DocumentListReply(const DocumentListCommand&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(DocumentListReply, onDocumentListReply) }; @@ -189,8 +183,7 @@ public: const std::vector<document::BucketId>& getBuckets() const { return _buckets; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(EmptyBucketsCommand, onEmptyBuckets) @@ -207,8 +200,7 @@ class EmptyBucketsReply : public StorageReply { public: explicit EmptyBucketsReply(const EmptyBucketsCommand&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(EmptyBucketsReply, onEmptyBucketsReply) }; diff --git a/storageapi/src/vespa/storageapi/message/documentsummary.h b/storageapi/src/vespa/storageapi/message/documentsummary.h index 2aa3c4765c5..b32723c6ddb 100644 --- a/storageapi/src/vespa/storageapi/message/documentsummary.h +++ b/storageapi/src/vespa/storageapi/message/documentsummary.h @@ -19,10 +19,9 @@ class DocumentSummaryCommand : public StorageCommand, public: explicit DocumentSummaryCommand(); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - uint32_t getMemoryFootprint() const { + uint32_t getMemoryFootprint() const override { return getSerializedSize(); } @@ -39,8 +38,7 @@ class DocumentSummaryReply : public StorageReply { public: explicit DocumentSummaryReply(const DocumentSummaryCommand& command); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(DocumentSummaryReply, onDocumentSummaryReply) }; diff --git a/storageapi/src/vespa/storageapi/message/multioperation.h b/storageapi/src/vespa/storageapi/message/multioperation.h index 31db78458f9..a4defc6078c 100644 --- a/storageapi/src/vespa/storageapi/message/multioperation.h +++ b/storageapi/src/vespa/storageapi/message/multioperation.h @@ -50,15 +50,14 @@ public: _operations = operations; } - uint32_t getMemoryFootprint() const { + uint32_t getMemoryFootprint() const override { return _buffer.size() + 20; } bool keepTimeStamps() const { return _keepTimeStamps; } void keepTimeStamps(bool keepTime) { _keepTimeStamps = keepTime; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(MultiOperationCommand, onMultiOperation) }; @@ -77,8 +76,7 @@ private: public: explicit MultiOperationReply(const MultiOperationCommand&); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; void setHighestModificationTimestamp(uint64_t highestModificationTimestamp) { _highestModificationTimestamp = highestModificationTimestamp; diff --git a/storageapi/src/vespa/storageapi/message/persistence.h b/storageapi/src/vespa/storageapi/message/persistence.h index d0961266cfe..470acca566b 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.h +++ b/storageapi/src/vespa/storageapi/message/persistence.h @@ -64,17 +64,15 @@ public: const document::DocumentId& getDocumentId() const override { return _doc->getId(); } Timestamp getTimestamp() const { return _timestamp; } - uint32_t getMemoryFootprint() const { + uint32_t getMemoryFootprint() const override { return (_doc.get() ? 4096 : 0) + 20; } vespalib::string getSummary() const override; - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual StorageCommand::UP createCopyToForward( - const document::BucketId& bucket, uint64_t timestamp) const; + virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(PutCommand, onPut); }; @@ -105,8 +103,7 @@ public: bool isHeadersOnlyPut() const { return (_updateTimestamp != 0); } bool wasFound() const { return _wasFound; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(PutReply, onPutReply) }; @@ -136,17 +133,15 @@ public: Timestamp getTimestamp() const { return _timestamp; } Timestamp getOldTimestamp() const { return _oldTimestamp; } - uint32_t getMemoryFootprint() const { + uint32_t getMemoryFootprint() const override { return (_update.get() ? 1024 : 0) + 30; } vespalib::string getSummary() const override; - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual StorageCommand::UP createCopyToForward( - const document::BucketId& bucket, uint64_t timestamp) const; + virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(UpdateCommand, onUpdate); }; @@ -175,8 +170,7 @@ public: bool wasFound() const { return (_oldTimestamp != 0); } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * If this update was inconsistent (multiple different timestamps returned), @@ -218,11 +212,9 @@ public: void setFieldSet(const vespalib::stringref & fieldSet) { _fieldSet = fieldSet; } vespalib::string getSummary() const override; - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual StorageCommand::UP createCopyToForward( - const document::BucketId& bucket, uint64_t timestamp) const; + virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(GetCommand, onGet) }; @@ -255,12 +247,11 @@ public: bool wasFound() const { return (_doc.get() != 0); } - uint32_t getMemoryFootprint() const { + uint32_t getMemoryFootprint() const override { return (_doc.get() ? 4096 : 0) + 30; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(GetReply, onGetReply) }; @@ -286,11 +277,9 @@ public: Timestamp getTimestamp() const { return _timestamp; } vespalib::string getSummary() const override; - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual StorageCommand::UP createCopyToForward( - const document::BucketId& bucket, uint64_t timestamp) const; + virtual StorageCommand::UP createCopyToForward(const document::BucketId& bucket, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(RemoveCommand, onRemove) }; @@ -318,8 +307,7 @@ public: bool wasFound() const { return (_oldTimestamp != 0); } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(RemoveReply, onRemoveReply) }; @@ -340,8 +328,7 @@ public: const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(RevertCommand, onRevert) }; @@ -361,8 +348,7 @@ public: const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(RevertReply, onRevertReply) }; diff --git a/storageapi/src/vespa/storageapi/message/queryresult.h b/storageapi/src/vespa/storageapi/message/queryresult.h index c0bed1eee54..8020fa22dea 100644 --- a/storageapi/src/vespa/storageapi/message/queryresult.h +++ b/storageapi/src/vespa/storageapi/message/queryresult.h @@ -18,10 +18,9 @@ class QueryResultCommand : public StorageCommand { public: QueryResultCommand(); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - uint32_t getMemoryFootprint() const { + uint32_t getMemoryFootprint() const override { return getSearchResult().getSerializedSize() + getDocumentSummary().getSerializedSize(); } const vdslib::SearchResult & getSearchResult() const { return _searchResult; } @@ -45,8 +44,7 @@ class QueryResultReply : public StorageReply { public: explicit QueryResultReply(const QueryResultCommand& command); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(QueryResultReply, onQueryResultReply) }; diff --git a/storageapi/src/vespa/storageapi/message/removelocation.h b/storageapi/src/vespa/storageapi/message/removelocation.h index 77e8d42b052..08b5663e2d6 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.h +++ b/storageapi/src/vespa/storageapi/message/removelocation.h @@ -16,9 +16,9 @@ public: const document::BucketId&); void print(std::ostream& out, bool verbose, - const std::string& indent) const; + const std::string& indent) const override; - uint32_t getMemoryFootprint() const { + uint32_t getMemoryFootprint() const override { return _documentSelection.length(); } diff --git a/storageapi/src/vespa/storageapi/message/searchresult.h b/storageapi/src/vespa/storageapi/message/searchresult.h index ea5a47cf37c..b2662800a9d 100644 --- a/storageapi/src/vespa/storageapi/message/searchresult.h +++ b/storageapi/src/vespa/storageapi/message/searchresult.h @@ -17,10 +17,9 @@ class SearchResultCommand : public StorageCommand, public vdslib::SearchResult { public: SearchResultCommand(); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - uint32_t getMemoryFootprint() const { + uint32_t getMemoryFootprint() const override { return getSerializedSize(); } @@ -37,8 +36,7 @@ class SearchResultReply : public StorageReply { public: explicit SearchResultReply(const SearchResultCommand& command); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SearchResultReply, onSearchResultReply) }; diff --git a/storageapi/src/vespa/storageapi/message/stat.h b/storageapi/src/vespa/storageapi/message/stat.h index 063aa579057..3ee4afbb4ba 100644 --- a/storageapi/src/vespa/storageapi/message/stat.h +++ b/storageapi/src/vespa/storageapi/message/stat.h @@ -27,11 +27,9 @@ public: const vespalib::string& getDocumentSelection() const { return _docSelection; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual StorageCommand::UP createCopyToForward( - const document::BucketId&, uint64_t timestamp) const; + virtual StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(StatBucketCommand, onStatBucket); }; @@ -44,8 +42,7 @@ public: const vespalib::string& getResults() { return _results; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(StatBucketReply, onStatBucketReply) }; @@ -64,8 +61,7 @@ class GetBucketListCommand : public BucketCommand { public: GetBucketListCommand(const document::BucketId& bucket); - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetBucketListCommand, onGetBucketList); }; @@ -98,8 +94,7 @@ public: std::vector<BucketInfo>& getBuckets() { return _buckets; } const std::vector<BucketInfo>& getBuckets() const { return _buckets; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(GetBucketListReply, onGetBucketListReply) diff --git a/storageapi/src/vespa/storageapi/message/state.h b/storageapi/src/vespa/storageapi/message/state.h index d3120943619..12a357c1b40 100644 --- a/storageapi/src/vespa/storageapi/message/state.h +++ b/storageapi/src/vespa/storageapi/message/state.h @@ -28,8 +28,7 @@ public: const lib::NodeState* getExpectedState() const { return _expectedState.get(); } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(GetNodeStateCommand, onGetNodeState) }; @@ -51,8 +50,7 @@ public: bool hasNodeState() const { return (_state.get() != 0); } const lib::NodeState& getNodeState() const { return *_state; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; void setNodeInfo(const std::string& info) { _nodeInfo = info; } const std::string& getNodeInfo() const { return _nodeInfo; } @@ -76,8 +74,7 @@ public: const lib::ClusterState& getSystemState() const { return _state; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGECOMMAND(SetSystemStateCommand, onSetSystemState) }; @@ -97,8 +94,7 @@ public: // Not serialized. Available locally const lib::ClusterState& getSystemState() const { return _state; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; DECLARE_STORAGEREPLY(SetSystemStateReply, onSetSystemStateReply) }; diff --git a/storageapi/src/vespa/storageapi/message/visitor.h b/storageapi/src/vespa/storageapi/message/visitor.h index 91e1278ecc4..a9d1de402da 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.h +++ b/storageapi/src/vespa/storageapi/message/visitor.h @@ -115,8 +115,7 @@ public: void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual StorageCommand::UP createCopyToForward( - const document::BucketId&, uint64_t timestamp) const; + virtual StorageCommand::UP createCopyToForward(const document::BucketId&, uint64_t timestamp) const override; DECLARE_STORAGECOMMAND(CreateVisitorCommand, onCreateVisitor) }; diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h index f4f5909fccd..7c078b9545a 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketcommand.h @@ -30,15 +30,14 @@ public: _bucket = bucket; } - document::BucketId getBucketId() const { return _bucket; } + document::BucketId getBucketId() const override { return _bucket; } bool hasBeenRemapped() const { return (_originalBucket.getRawId() != 0); } const document::BucketId& getOriginalBucketId() const { return _originalBucket; } - virtual void print(std::ostream& out, - bool verbose, const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; - virtual bool hasSingleBucketId() const { return true; } + virtual bool hasSingleBucketId() const override { return true; } }; diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h index 4579d83cfed..62171a9e3c0 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinfocommand.h @@ -25,8 +25,7 @@ protected: public: DECLARE_POINTER_TYPEDEFS(BucketInfoCommand); - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h index 0a5c435ade3..d39a6a5eaf8 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketinforeply.h @@ -33,8 +33,7 @@ public: void setBucketInfo(const BucketInfo& info) { _result = info; } /** Overload this to get more descriptive message output. */ - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/bucketreply.h b/storageapi/src/vespa/storageapi/messageapi/bucketreply.h index d2605604568..833f1396c49 100644 --- a/storageapi/src/vespa/storageapi/messageapi/bucketreply.h +++ b/storageapi/src/vespa/storageapi/messageapi/bucketreply.h @@ -27,8 +27,8 @@ protected: public: DECLARE_POINTER_TYPEDEFS(BucketReply); - document::BucketId getBucketId() const { return _bucket; } - virtual bool hasSingleBucketId() const { return true; } + document::BucketId getBucketId() const override { return _bucket; } + virtual bool hasSingleBucketId() const override { return true; } bool hasBeenRemapped() const { return (_originalBucket.getRawId() != 0); } const document::BucketId& getOriginalBucketId() const @@ -40,8 +40,7 @@ public: _bucket = bucket; } - virtual void print(std::ostream& out, bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/storageapi/src/vespa/storageapi/messageapi/returncode.h b/storageapi/src/vespa/storageapi/messageapi/returncode.h index 997487853e8..a7be570e8f4 100644 --- a/storageapi/src/vespa/storageapi/messageapi/returncode.h +++ b/storageapi/src/vespa/storageapi/messageapi/returncode.h @@ -70,8 +70,8 @@ private: vespalib::string _message; void onDeserialize(const document::DocumentTypeRepo &repo, - document::ByteBuffer& buffer); - void onSerialize(document::ByteBuffer& buffer) const; + document::ByteBuffer& buffer) override; + void onSerialize(document::ByteBuffer& buffer) const override; public: ReturnCode(); @@ -79,17 +79,16 @@ public: ReturnCode(const document::DocumentTypeRepo &repo, document::ByteBuffer& buffer); - ReturnCode* clone() const { return new ReturnCode(*this); } + ReturnCode* clone() const override { return new ReturnCode(*this); } - size_t getSerializedSize() const; + size_t getSerializedSize() const override; const vespalib::string& getMessage() const { return _message; } void setMessage(const vespalib::stringref & message) { _message = message; } Result getResult() const { return _result; } - void print(std::ostream& out, bool verbose, - const std::string& indent) const; + void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * Translate from status code to human-readable string diff --git a/storageapi/src/vespa/storageapi/messageapi/storagecommand.h b/storageapi/src/vespa/storageapi/messageapi/storagecommand.h index 73616936aec..00f17458e6a 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagecommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagecommand.h @@ -46,9 +46,7 @@ public: void setNewId() { StorageMessage::setNewMsgId(); } /** Overload this to get more descriptive message output. */ - virtual void print(std::ostream& out, - bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; /** * A way for someone to make a reply to a storage message without diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h index 6d16a6546f9..47dd93a9535 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h @@ -44,7 +44,7 @@ public: \ private: \ virtual bool callHandler( \ MessageHandler& h, \ - const std::shared_ptr<StorageMessage>& m) const \ + const std::shared_ptr<StorageMessage>& m) const override \ { \ return h.callback(std::static_pointer_cast<reply>(m)); \ } @@ -52,7 +52,7 @@ private: \ /** Commands also has a command to implement to create the reply. */ #define DECLARE_STORAGECOMMAND(command, callback) \ public: \ - std::unique_ptr<StorageReply> makeReply(); \ + std::unique_ptr<StorageReply> makeReply() override; \ DECLARE_STORAGEREPLY(command, callback) /** This macro implements common stuff for all storage messages. */ diff --git a/storageapi/src/vespa/storageapi/messageapi/storagereply.h b/storageapi/src/vespa/storageapi/messageapi/storagereply.h index 518c5474b34..eab6470f463 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagereply.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagereply.h @@ -36,9 +36,7 @@ public: const ReturnCode& getResult() const { return _result; } /** Overload this to get more descriptive output. */ - virtual void print(std::ostream& out, - bool verbose, - const std::string& indent) const; + virtual void print(std::ostream& out, bool verbose, const std::string& indent) const override; }; } // api diff --git a/storageframework/src/tests/clock/timetest.cpp b/storageframework/src/tests/clock/timetest.cpp index c41676e5f4d..ae07559e095 100644 --- a/storageframework/src/tests/clock/timetest.cpp +++ b/storageframework/src/tests/clock/timetest.cpp @@ -10,8 +10,8 @@ namespace defaultimplementation { struct TimeTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testBasics(); void testCreatedFromClock(); diff --git a/storageframework/src/tests/memory/memorymanagertest.cpp b/storageframework/src/tests/memory/memorymanagertest.cpp index 50bca7b5b58..885ae86e832 100644 --- a/storageframework/src/tests/memory/memorymanagertest.cpp +++ b/storageframework/src/tests/memory/memorymanagertest.cpp @@ -155,8 +155,7 @@ MemoryManagerTest::testBasics() struct ReduceI : public framework::ReduceMemoryUsageInterface { framework::MemoryToken::UP _token; - virtual uint64_t reduceMemoryConsumption(const MemoryToken& token, - uint64_t reduceBy) + virtual uint64_t reduceMemoryConsumption(const MemoryToken& token, uint64_t reduceBy) override { assert(&token == _token.get()); (void) &token; @@ -283,12 +282,12 @@ struct MemoryManagerLoadGiver : public document::Runnable, { } - uint64_t reduceMemoryConsumption(const MemoryToken&, uint64_t reduceBy) { + uint64_t reduceMemoryConsumption(const MemoryToken&, uint64_t reduceBy) override { ++_reduced; return reduceBy; } - void run() { + void run() override { ReduceMemoryUsageInterface* reducer = 0; if (_type.isCache()) reducer = this; vespalib::RandomGen randomizer; diff --git a/storageframework/src/tests/memory/memorystatetest.cpp b/storageframework/src/tests/memory/memorystatetest.cpp index 6099745e30b..40d102199d6 100644 --- a/storageframework/src/tests/memory/memorystatetest.cpp +++ b/storageframework/src/tests/memory/memorystatetest.cpp @@ -12,8 +12,8 @@ namespace defaultimplementation { struct MemoryStateTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testBasics(); @@ -30,16 +30,16 @@ private: std::map<std::string, framework::MemoryAllocationType> _types; public: - virtual void setMaximumMemoryUsage(uint64_t max) { (void) max; } + virtual void setMaximumMemoryUsage(uint64_t max) override { (void) max; } virtual const framework::MemoryAllocationType& - registerAllocationType(const framework::MemoryAllocationType& type) { + registerAllocationType(const framework::MemoryAllocationType& type) override { _types[type.getName()] = type; return _types[type.getName()]; } virtual const framework::MemoryAllocationType& - getAllocationType(const std::string& name) const { + getAllocationType(const std::string& name) const override { std::map<std::string, framework::MemoryAllocationType>::const_iterator iter = _types.find(name); @@ -50,7 +50,7 @@ public: return iter->second; } - virtual std::vector<const MemoryAllocationType*> getAllocationTypes() const + virtual std::vector<const MemoryAllocationType*> getAllocationTypes() const override { std::vector<const MemoryAllocationType*> types; for(std::map<std::string, framework::MemoryAllocationType> @@ -65,12 +65,12 @@ public: uint64_t, uint64_t, uint8_t, - framework::ReduceMemoryUsageInterface*) + framework::ReduceMemoryUsageInterface*) override { return framework::MemoryToken::UP(); } - uint64_t getMemorySizeFreeForPriority(uint8_t priority) const { + uint64_t getMemorySizeFreeForPriority(uint8_t priority) const override { (void) priority; return 0; } diff --git a/storageframework/src/tests/thread/taskthreadtest.cpp b/storageframework/src/tests/thread/taskthreadtest.cpp index 36d3a8abfab..bca5c81ef01 100644 --- a/storageframework/src/tests/thread/taskthreadtest.cpp +++ b/storageframework/src/tests/thread/taskthreadtest.cpp @@ -34,7 +34,7 @@ namespace { struct MyThread : public TaskThread<Task> { MyThread(ThreadLock& lock) : TaskThread<Task>(lock) {} - virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex) { + virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex) override { return ThreadWaitInfo::NO_MORE_CRITICAL_WORK_KNOWN; } }; diff --git a/storageframework/src/tests/thread/tickingthreadtest.cpp b/storageframework/src/tests/thread/tickingthreadtest.cpp index 508cadc6fbd..c65b809e5da 100644 --- a/storageframework/src/tests/thread/tickingthreadtest.cpp +++ b/storageframework/src/tests/thread/tickingthreadtest.cpp @@ -13,8 +13,8 @@ namespace defaultimplementation { struct TickingThreadTest : public CppUnit::TestFixture { - void setUp() {} - void tearDown() {} + void setUp() override {} + void tearDown() override {} void testTicksBeforeWaitBasic(); void testTicksBeforeWaitLiveUpdate(); @@ -62,7 +62,7 @@ struct MyApp : public TickingThread { void start(ThreadPool& p) { _threadPool->start(p); } - virtual ThreadWaitInfo doCriticalTick(ThreadIndex index) { + virtual ThreadWaitInfo doCriticalTick(ThreadIndex index) override { assert(index < _context.size()); Context& c(_context[index]); if (_doCritOverlapTest) { @@ -74,7 +74,7 @@ struct MyApp : public TickingThread { ++c._critTickCount; return ThreadWaitInfo::NO_MORE_CRITICAL_WORK_KNOWN; } - virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex index) { + virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex index) override { assert(index < _context.size()); Context& c(_context[index]); ++c._nonCritTickCount; @@ -314,7 +314,7 @@ struct BroadcastApp : public TickingThread { void start(ThreadPool& p) { _threadPool->start(p); } - virtual ThreadWaitInfo doCriticalTick(ThreadIndex) { + virtual ThreadWaitInfo doCriticalTick(ThreadIndex) override { if (!_queue.empty()) { for (uint32_t i=0; i<_queue.size(); ++i) { printTaskInfo(_queue[i], "activating"); @@ -325,7 +325,7 @@ struct BroadcastApp : public TickingThread { } return ThreadWaitInfo::NO_MORE_CRITICAL_WORK_KNOWN; } - virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex) { + virtual ThreadWaitInfo doNonCriticalTick(ThreadIndex) override { if (!_active.empty()) { for (uint32_t i=0; i<_active.size(); ++i) { printTaskInfo(_queue[i], "processing"); diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/simplememorylogic.cpp b/storageframework/src/vespa/storageframework/defaultimplementation/memory/simplememorylogic.cpp index b02e1944368..55723eec558 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/simplememorylogic.cpp +++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/simplememorylogic.cpp @@ -20,6 +20,10 @@ SimpleMemoryLogic::SimpleMemoryLogic(Clock& c, uint64_t maxMemory) LOG(debug, "Setup simple memory logic with max memory of %" PRIu64 " bytes", maxMemory); } +SimpleMemoryLogic::~SimpleMemoryLogic() +{ +} + void SimpleMemoryLogic::setMaximumMemoryUsage(uint64_t max) { diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/simplememorylogic.h b/storageframework/src/vespa/storageframework/defaultimplementation/memory/simplememorylogic.h index 5a8df6441f1..8cbb8d13111 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/simplememorylogic.h +++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/simplememorylogic.h @@ -59,6 +59,8 @@ public: SimpleMemoryLogic(Clock&, uint64_t maxMemory); + ~SimpleMemoryLogic(); + SimpleMemoryLogic& setMinJumpToUpdateMax(uint32_t bytes) { _state.setMinJumpToUpdateMax(bytes); return *this; diff --git a/storageserver/src/apps/storaged/storage.cpp b/storageserver/src/apps/storaged/storage.cpp index 255895c8c72..d21b64ecfd6 100644 --- a/storageserver/src/apps/storaged/storage.cpp +++ b/storageserver/src/apps/storaged/storage.cpp @@ -78,8 +78,8 @@ public: void handleSignals(); private: - bool Init(); - int Main(); + bool Init() override; + int Main() override; bool gotSignal() { return _lastSignal != 0; } }; diff --git a/storageserver/src/tests/storageservertest.cpp b/storageserver/src/tests/storageservertest.cpp index ccd4d5a3720..be046ad6d31 100644 --- a/storageserver/src/tests/storageservertest.cpp +++ b/storageserver/src/tests/storageservertest.cpp @@ -88,8 +88,8 @@ struct StorageServerTest : public CppUnit::TestFixture { StorageServerTest(); ~StorageServerTest(); - void setUp(); - void tearDown(); + void setUp() override; + void tearDown() override; void testNormalUsage(); void testPortOverlap_Stress(); @@ -166,8 +166,8 @@ namespace { Distributor(vdstestlib::DirConfig& config); ~Distributor(); - virtual StorageNode& getNode() { return _process.getNode(); } - virtual StorageNodeContext& getContext() + virtual StorageNode& getNode() override { return _process.getNode(); } + virtual StorageNodeContext& getContext() override { return _process.getContext(); } }; @@ -178,8 +178,8 @@ namespace { Storage(vdstestlib::DirConfig& config); ~Storage(); - virtual StorageNode& getNode() { return _process.getNode(); } - virtual StorageNodeContext& getContext() + virtual StorageNode& getNode() override { return _process.getNode(); } + virtual StorageNodeContext& getContext() override { return _process.getContext(); } spi::PartitionStateList getPartitions() { return _process.getProvider().getPartitionStates().getList(); } @@ -342,7 +342,7 @@ namespace { _startedShutdown = true; } - virtual void handleReply(mbus::Reply::UP reply) { + virtual void handleReply(mbus::Reply::UP reply) override { using documentapi::DocumentProtocol; --_currentPending; if (!reply->hasErrors()) { @@ -435,12 +435,12 @@ namespace { stop(); join(); } - virtual bool onStop() { + virtual bool onStop() override { vespalib::MonitorGuard monitor(_threadMonitor); monitor.signal(); return true; } - void run() { + void run() override { uint32_t seed = 0; uint32_t maxDocSize = 65536; init(); @@ -647,12 +647,12 @@ namespace { join(); } } - virtual bool onStop() { + virtual bool onStop() override { vespalib::MonitorGuard monitor(_threadMonitor); monitor.signal(); return true; } - void run() { + void run() override { uint32_t seed = 0; uint32_t maxDocSize = 65536; init(); @@ -828,7 +828,7 @@ namespace { return ost.str(); } - virtual void handleReply(mbus::Reply::UP reply) { + virtual void handleReply(mbus::Reply::UP reply) override { if (_startedShutdown) return; --_currentPending; std::ostringstream err; diff --git a/storageserver/src/vespa/storageserver/app/dummyservicelayerprocess.h b/storageserver/src/vespa/storageserver/app/dummyservicelayerprocess.h index ab119bfba5e..ad0fd3134eb 100644 --- a/storageserver/src/vespa/storageserver/app/dummyservicelayerprocess.h +++ b/storageserver/src/vespa/storageserver/app/dummyservicelayerprocess.h @@ -18,9 +18,9 @@ public: DummyServiceLayerProcess(const config::ConfigUri & configUri); ~DummyServiceLayerProcess() { shutdown(); } - virtual void shutdown(); - virtual void setupProvider(); - virtual spi::PersistenceProvider& getProvider() { return *_provider; } + virtual void shutdown() override; + virtual void setupProvider() override; + virtual spi::PersistenceProvider& getProvider() override { return *_provider; } }; } // storage diff --git a/storageserver/src/vespa/storageserver/app/memfileservicelayerprocess.h b/storageserver/src/vespa/storageserver/app/memfileservicelayerprocess.h index 2e365f3f1a2..6352f370525 100644 --- a/storageserver/src/vespa/storageserver/app/memfileservicelayerprocess.h +++ b/storageserver/src/vespa/storageserver/app/memfileservicelayerprocess.h @@ -40,19 +40,19 @@ public: MemFileServiceLayerProcess(const config::ConfigUri & configUri); ~MemFileServiceLayerProcess() { shutdown(); } - virtual void shutdown(); + virtual void shutdown() override; - void setupConfig(uint64_t subscribeTimeout); - virtual void removeConfigSubscriptions(); - virtual void setupProvider(); - virtual bool configUpdated(); - virtual void updateConfig(); + void setupConfig(uint64_t subscribeTimeout) override; + virtual void removeConfigSubscriptions() override; + virtual void setupProvider() override; + virtual bool configUpdated() override; + virtual void updateConfig() override; - virtual spi::PersistenceProvider& getProvider() { return *_provider; } + virtual spi::PersistenceProvider& getProvider() override { return *_provider; } - void configure(std::unique_ptr<vespa::config::storage::StorMemfilepersistenceConfig> config); - void configure(std::unique_ptr<vespa::config::storage::StorDevicesConfig> config); - void configure(std::unique_ptr<vespa::config::content::PersistenceConfig> config); + void configure(std::unique_ptr<vespa::config::storage::StorMemfilepersistenceConfig> config) override; + void configure(std::unique_ptr<vespa::config::storage::StorDevicesConfig> config) override; + void configure(std::unique_ptr<vespa::config::content::PersistenceConfig> config) override; }; } // storage diff --git a/storageserver/src/vespa/storageserver/app/process.h b/storageserver/src/vespa/storageserver/app/process.h index 85e30e73687..06e76425fdc 100644 --- a/storageserver/src/vespa/storageserver/app/process.h +++ b/storageserver/src/vespa/storageserver/app/process.h @@ -49,7 +49,7 @@ public: virtual StorageNode& getNode() = 0; virtual StorageNodeContext& getContext() = 0; - virtual int64_t getGeneration() const; + virtual int64_t getGeneration() const override; }; } // storage diff --git a/storageserver/src/vespa/storageserver/app/rpcservicelayerprocess.h b/storageserver/src/vespa/storageserver/app/rpcservicelayerprocess.h index 70f843ae597..018082d48b8 100644 --- a/storageserver/src/vespa/storageserver/app/rpcservicelayerprocess.h +++ b/storageserver/src/vespa/storageserver/app/rpcservicelayerprocess.h @@ -18,10 +18,10 @@ public: RpcServiceLayerProcess(const config::ConfigUri & configUri); ~RpcServiceLayerProcess() { shutdown(); } - virtual void shutdown(); - virtual void setupProvider(); - virtual void updateConfig(); - virtual spi::PersistenceProvider& getProvider() { return *_provider; } + virtual void shutdown() override; + virtual void setupProvider() override; + virtual void updateConfig() override; + virtual spi::PersistenceProvider& getProvider() override { return *_provider; } }; } // storage diff --git a/storageserver/src/vespa/storageserver/app/servicelayerprocess.h b/storageserver/src/vespa/storageserver/app/servicelayerprocess.h index d1ac919a674..dd22be8f7c7 100644 --- a/storageserver/src/vespa/storageserver/app/servicelayerprocess.h +++ b/storageserver/src/vespa/storageserver/app/servicelayerprocess.h @@ -33,17 +33,17 @@ protected: public: ServiceLayerProcess(const config::ConfigUri & configUri); - virtual void shutdown(); + virtual void shutdown() override; virtual void setupProvider() = 0; virtual spi::PersistenceProvider& getProvider() = 0; - virtual void createNode(); + virtual void createNode() override; - virtual StorageNode& getNode() { return *_node; } - virtual StorageNodeContext& getContext() { return _context; } + virtual StorageNode& getNode() override { return *_node; } + virtual StorageNodeContext& getContext() override { return _context; } - virtual std::string getComponentName() const { return "servicelayer"; } + virtual std::string getComponentName() const override { return "servicelayer"; } }; } // storage diff --git a/streamingvisitors/src/tests/hitcollector/hitcollector.cpp b/streamingvisitors/src/tests/hitcollector/hitcollector.cpp index 8105da3d0c8..ba37da9e511 100644 --- a/streamingvisitors/src/tests/hitcollector/hitcollector.cpp +++ b/streamingvisitors/src/tests/hitcollector/hitcollector.cpp @@ -33,7 +33,7 @@ private: public: HitCollectorTest(); - int Main(); + int Main() override; }; HitCollectorTest::HitCollectorTest() diff --git a/streamingvisitors/src/tests/querywrapper/querywrapper.cpp b/streamingvisitors/src/tests/querywrapper/querywrapper.cpp index 46fb90a51e8..226e1eecb17 100644 --- a/streamingvisitors/src/tests/querywrapper/querywrapper.cpp +++ b/streamingvisitors/src/tests/querywrapper/querywrapper.cpp @@ -18,7 +18,7 @@ private: void testQueryWrapper(); public: - int Main(); + int Main() override; }; void diff --git a/streamingvisitors/src/tests/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/tests/searchvisitor/searchvisitor.cpp index 66b7743c3b3..6081b5c3ac2 100644 --- a/streamingvisitors/src/tests/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/tests/searchvisitor/searchvisitor.cpp @@ -29,7 +29,7 @@ private: public: SearchVisitorTest(); - int Main(); + int Main() override; }; SearchVisitorTest::SearchVisitorTest() : diff --git a/streamingvisitors/src/vespa/searchvisitor/hitcollector.h b/streamingvisitors/src/vespa/searchvisitor/hitcollector.h index 12503640cbb..b51ad7da82d 100644 --- a/streamingvisitors/src/vespa/searchvisitor/hitcollector.h +++ b/streamingvisitors/src/vespa/searchvisitor/hitcollector.h @@ -87,7 +87,7 @@ public: HitCollector(size_t wantedHits); - virtual const vsm::Document & getDocSum(const search::DocumentIdT & docId) const; + virtual const vsm::Document & getDocSum(const search::DocumentIdT & docId) const override; /** * Adds a hit to this hit collector. diff --git a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp index 2d96eddf493..4c8c76a9f7f 100644 --- a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp @@ -25,7 +25,7 @@ IndexEnvironment::addField(const vespalib::string & name, bool isAttribute) if (getFieldByName(name) != NULL) { return false; } - FieldInfo info(isAttribute ? FieldType::ATTRIBUTE : FieldType::INDEX, CollectionType::SINGLE, name, _fields.size()); + FieldInfo info(isAttribute ? FieldType::ATTRIBUTE : FieldType::INDEX, FieldInfo::CollectionType::SINGLE, name, _fields.size()); info.addAttribute(); // we are able to produce needed attributes at query time _fields.push_back(info); _fieldNames[info.name()] = info.id(); diff --git a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h index 05ddcba92d3..ffe292939d7 100644 --- a/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/queryenvironment.h @@ -35,13 +35,13 @@ public: ~QueryEnvironment(); // inherit documentation - virtual const search::fef::Properties & getProperties() const { return _properties; } + virtual const search::fef::Properties & getProperties() const override { return _properties; } // inherit documentation - virtual uint32_t getNumTerms() const { return _queryTerms.size(); } + virtual uint32_t getNumTerms() const override { return _queryTerms.size(); } // inherit documentation - virtual const search::fef::ITermData *getTerm(uint32_t idx) const { + virtual const search::fef::ITermData *getTerm(uint32_t idx) const override { if (idx >= _queryTerms.size()) { return NULL; } @@ -49,13 +49,13 @@ public: } // inherit documentation - virtual const search::fef::Location & getLocation() const { return _location; } + virtual const search::fef::Location & getLocation() const override { return _location; } // inherit documentation - virtual const search::attribute::IAttributeContext & getAttributeContext() const { return *_attrCtx; } + virtual const search::attribute::IAttributeContext & getAttributeContext() const override { return *_attrCtx; } // inherit documentation - virtual const search::fef::IIndexEnvironment & getIndexEnvironment() const { return _indexEnv; } + virtual const search::fef::IIndexEnvironment & getIndexEnvironment() const override { return _indexEnv; } void addTerm(const search::fef::ITermData *term) { _queryTerms.push_back(term); } }; diff --git a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h index 0da6495bb05..5fb4c2444c6 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h +++ b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.h @@ -22,7 +22,7 @@ private: ~Env(); const vsm::VSMAdapter * getVSMAdapter() const { return _vsmAdapter.get(); } const RankManager * getRankManager() const { return _rankManager.get(); } - void configure(const config::ConfigSnapshot & snapshot); + void configure(const config::ConfigSnapshot & snapshot) override; static config::ConfigKeySet createKeySet(const vespalib::string & configId); private: diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp index 287f640ad63..90b3f58991c 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp @@ -845,7 +845,7 @@ class SingleDocumentStore : public vsm::IDocSumCache { public: SingleDocumentStore(const StorageDocument & doc) : _doc(doc) { } - virtual const vsm::Document & getDocSum(const search::DocumentIdT & docId) const { + virtual const vsm::Document & getDocSum(const search::DocumentIdT & docId) const override { (void) docId; return _doc; } diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h index 9e4d5a11767..7767a601ea4 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.h @@ -393,7 +393,7 @@ private: void setFilter(std::unique_ptr<vsm::DocsumFilter> filter) { _docsumFilter = std::move(filter); } void setDocsumCache(const vsm::IDocSumCache & cache) { _docsumFilter->setDocSumStore(cache); } void setDocsumWriter(IDocsumWriter & docsumWriter) { _docsumWriter = & docsumWriter; } - virtual vespalib::ConstBufferRef fillSummary(search::AttributeVector::DocId lid, const HitsAggregationResult::SummaryClassType & summaryClass); + virtual vespalib::ConstBufferRef fillSummary(search::AttributeVector::DocId lid, const HitsAggregationResult::SummaryClassType & summaryClass) override; private: vsm::GetDocsumsStateCallback _callback; GetDocsumsState _docsumState; @@ -411,8 +411,8 @@ private: { } size_t getNumHitsAggregators() const { return _numHitsAggregators; } private: - virtual void execute(vespalib::Identifiable &obj); - virtual bool check(const vespalib::Identifiable &obj) const; + virtual void execute(vespalib::Identifiable &obj) override; + virtual bool check(const vespalib::Identifiable &obj) const override; SummaryGenerator & _summaryGenerator; size_t _numHitsAggregators; }; @@ -457,10 +457,10 @@ private: class SearchVisitorFactory : public VisitorFactory { config::ConfigUri _configUri; - VisitorEnvironment::UP makeVisitorEnvironment(StorageComponent&); + VisitorEnvironment::UP makeVisitorEnvironment(StorageComponent&) override; Visitor* makeVisitor(StorageComponent&, VisitorEnvironment&env, - const vdslib::Parameters& params); + const vdslib::Parameters& params) override; public: SearchVisitorFactory(const config::ConfigUri & configUri); }; diff --git a/vbench/src/apps/dumpurl/dumpurl.cpp b/vbench/src/apps/dumpurl/dumpurl.cpp index a3bbc9be714..706dd061763 100644 --- a/vbench/src/apps/dumpurl/dumpurl.cpp +++ b/vbench/src/apps/dumpurl/dumpurl.cpp @@ -9,18 +9,18 @@ using namespace vbench; class App : public FastOS_Application { public: - int Main(); + int Main() override; }; struct MyHttpHandler : public HttpResultHandler { - virtual void handleHeader(const string &name, const string &value) { + virtual void handleHeader(const string &name, const string &value) override { fprintf(stderr, "got header: '%s': '%s'\n", name.c_str(), value.c_str()); } - virtual void handleContent(const Memory &data) { + virtual void handleContent(const Memory &data) override { fprintf(stderr, "got data: %zu bytes\n", data.size); fwrite(data.data, 1, data.size, stdout); } - virtual void handleFailure(const string &reason) { + virtual void handleFailure(const string &reason) override { fprintf(stderr, "got FAILURE: '%s'\n", reason.c_str()); } }; diff --git a/vbench/src/apps/vbench/vbench.cpp b/vbench/src/apps/vbench/vbench.cpp index a2dca88f7d5..32af3d70c3d 100644 --- a/vbench/src/apps/vbench/vbench.cpp +++ b/vbench/src/apps/vbench/vbench.cpp @@ -17,7 +17,7 @@ typedef vespalib::SignalHandler SIG; struct NotifyDone : public vespalib::Runnable { vespalib::Gate &done; NotifyDone(vespalib::Gate &d) : done(d) {} - virtual void run() { + virtual void run() override { done.countDown(); } }; diff --git a/vbench/src/tests/dispatcher/dispatcher_test.cpp b/vbench/src/tests/dispatcher/dispatcher_test.cpp index b4afafdaed5..284f7c55d8a 100644 --- a/vbench/src/tests/dispatcher/dispatcher_test.cpp +++ b/vbench/src/tests/dispatcher/dispatcher_test.cpp @@ -7,14 +7,14 @@ using namespace vbench; struct MyHandler : public Handler<int> { int value; MyHandler() : value(-1) {} - virtual void handle(std::unique_ptr<int> v) { value = (v.get() != 0) ? *v : 0; } + virtual void handle(std::unique_ptr<int> v) override { value = (v.get() != 0) ? *v : 0; } }; struct Fetcher : public vespalib::Runnable { Provider<int> &provider; Handler<int> &handler; Fetcher(Provider<int> &p, Handler<int> &h) : provider(p), handler(h) {} - virtual void run() { handler.handle(provider.provide()); } + virtual void run() override { handler.handle(provider.provide()); } }; TEST("dispatcher") { diff --git a/vbench/src/tests/handler_thread/handler_thread_test.cpp b/vbench/src/tests/handler_thread/handler_thread_test.cpp index 43f0c4d4a1b..a21bda82b6a 100644 --- a/vbench/src/tests/handler_thread/handler_thread_test.cpp +++ b/vbench/src/tests/handler_thread/handler_thread_test.cpp @@ -6,7 +6,7 @@ using namespace vbench; struct MyHandler : Handler<int> { std::vector<int> values; - virtual void handle(std::unique_ptr<int> value) { + virtual void handle(std::unique_ptr<int> value) override { values.push_back(*value); vespalib::Thread::sleep(10); // for improved coverage } diff --git a/vbench/src/tests/socket/socket_test.cpp b/vbench/src/tests/socket/socket_test.cpp index 02d4caed507..21c410f382e 100644 --- a/vbench/src/tests/socket/socket_test.cpp +++ b/vbench/src/tests/socket/socket_test.cpp @@ -34,7 +34,7 @@ struct Agent { struct Client : public Agent, public vespalib::Runnable { Client(Stream::UP s) : Agent(std::move(s)) {} - virtual void run() { + virtual void run() override { TEST_THREAD("client"); write("client-"); read("server-"); @@ -43,7 +43,7 @@ struct Client : public Agent, public vespalib::Runnable { struct Server : public Agent, public vespalib::Runnable { Server(Stream::UP s) : Agent(std::move(s)) {} - virtual void run() { + virtual void run() override { TEST_THREAD("server"); read("client-"); write("server-"); diff --git a/vbench/src/vbench/core/input_file_reader.h b/vbench/src/vbench/core/input_file_reader.h index 79562fc0f43..410f0819d3b 100644 --- a/vbench/src/vbench/core/input_file_reader.h +++ b/vbench/src/vbench/core/input_file_reader.h @@ -34,7 +34,7 @@ public: **/ bool readLine(string &dst); - virtual const Taint &tainted() const { return _taint; } + virtual const Taint &tainted() const override { return _taint; } }; } // namespace vbench diff --git a/vbench/src/vbench/core/socket.h b/vbench/src/vbench/core/socket.h index 358db8ead67..092a28952f4 100644 --- a/vbench/src/vbench/core/socket.h +++ b/vbench/src/vbench/core/socket.h @@ -30,12 +30,12 @@ public: Socket(std::unique_ptr<FastOS_SocketInterface> socket); Socket(const string host, int port); virtual ~Socket(); - virtual bool eof() const { return _eof; } - virtual Memory obtain(); - virtual Input &evict(size_t bytes); - virtual WritableMemory reserve(size_t bytes); - virtual Output &commit(size_t bytes); - virtual const Taint &tainted() const { return _taint; } + virtual bool eof() const override { return _eof; } + virtual Memory obtain() override; + virtual Input &evict(size_t bytes) override; + virtual WritableMemory reserve(size_t bytes) override; + virtual Output &commit(size_t bytes) override; + virtual const Taint &tainted() const override { return _taint; } }; } // namespace vbench diff --git a/vbench/src/vbench/core/taintable.cpp b/vbench/src/vbench/core/taintable.cpp index 5409379e02c..23e2745999a 100644 --- a/vbench/src/vbench/core/taintable.cpp +++ b/vbench/src/vbench/core/taintable.cpp @@ -9,7 +9,7 @@ namespace { struct Untaintable : Taintable { Taint taint; - virtual const Taint &tainted() const { return taint; } + virtual const Taint &tainted() const override { return taint; } virtual ~Untaintable() {} }; diff --git a/vbench/src/vbench/http/benchmark_headers.cpp b/vbench/src/vbench/http/benchmark_headers.cpp index df96f6a9dc7..e4bea82023d 100644 --- a/vbench/src/vbench/http/benchmark_headers.cpp +++ b/vbench/src/vbench/http/benchmark_headers.cpp @@ -77,7 +77,7 @@ BenchmarkHeaders::toString() const struct HeaderToString : benchmark_headers::HeaderTraverser { string &str; HeaderToString(string &s) : str(s) {} - virtual void header(const string &name, double value) { + virtual void header(const string &name, double value) override { str += strfmt(" %s: %g\n", name.c_str(), value); } } headerToString(str); diff --git a/vbench/src/vbench/test/request_receptor.h b/vbench/src/vbench/test/request_receptor.h index 738f1336bc6..2de39e528e4 100644 --- a/vbench/src/vbench/test/request_receptor.h +++ b/vbench/src/vbench/test/request_receptor.h @@ -11,7 +11,7 @@ namespace vbench { struct RequestReceptor : public Handler<Request> { Request::UP request; RequestReceptor() : request() {} - virtual void handle(Request::UP req); + virtual void handle(Request::UP req) override; }; } // namespace vbench diff --git a/vbench/src/vbench/test/simple_http_result_handler.h b/vbench/src/vbench/test/simple_http_result_handler.h index f5ec1c36fcf..a58a4cea8af 100644 --- a/vbench/src/vbench/test/simple_http_result_handler.h +++ b/vbench/src/vbench/test/simple_http_result_handler.h @@ -19,9 +19,9 @@ private: public: SimpleHttpResultHandler(); - virtual void handleHeader(const string &name, const string &value); - virtual void handleContent(const Memory &data); - virtual void handleFailure(const string &reason); + virtual void handleHeader(const string &name, const string &value) override; + virtual void handleContent(const Memory &data) override; + virtual void handleFailure(const string &reason) override; const std::vector<std::pair<string, string> > &headers() const { return _headers; } diff --git a/vbench/src/vbench/vbench/dropped_tagger.h b/vbench/src/vbench/vbench/dropped_tagger.h index 6c05dcdaf10..eb64d4b4be4 100644 --- a/vbench/src/vbench/vbench/dropped_tagger.h +++ b/vbench/src/vbench/vbench/dropped_tagger.h @@ -19,7 +19,7 @@ private: public: DroppedTagger(Handler<Request> &next); - virtual void handle(Request::UP request); + virtual void handle(Request::UP request) override; }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/ignore_before.h b/vbench/src/vbench/vbench/ignore_before.h index 0be0add60c4..d74a398efd8 100644 --- a/vbench/src/vbench/vbench/ignore_before.h +++ b/vbench/src/vbench/vbench/ignore_before.h @@ -22,8 +22,8 @@ private: public: IgnoreBefore(double time, Handler<Request> &next); - virtual void handle(Request::UP request); - virtual void report(); + virtual void handle(Request::UP request) override; + virtual void report() override; }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/latency_analyzer.h b/vbench/src/vbench/vbench/latency_analyzer.h index d69c85d0360..499f6f3b991 100644 --- a/vbench/src/vbench/vbench/latency_analyzer.h +++ b/vbench/src/vbench/vbench/latency_analyzer.h @@ -39,8 +39,8 @@ public: string toString() const; }; LatencyAnalyzer(Handler<Request> &next); - virtual void handle(Request::UP request); - virtual void report(); + virtual void handle(Request::UP request) override; + virtual void report() override; void addLatency(double latency); Stats getStats() const; }; diff --git a/vbench/src/vbench/vbench/qps_analyzer.h b/vbench/src/vbench/vbench/qps_analyzer.h index bdc8b4cfe57..4b4b4997f62 100644 --- a/vbench/src/vbench/vbench/qps_analyzer.h +++ b/vbench/src/vbench/vbench/qps_analyzer.h @@ -24,8 +24,8 @@ private: public: QpsAnalyzer(Handler<Request> &next); - virtual void handle(Request::UP request); - virtual void report(); + virtual void handle(Request::UP request) override; + virtual void report() override; void addEndTime(double end); }; diff --git a/vbench/src/vbench/vbench/qps_tagger.h b/vbench/src/vbench/vbench/qps_tagger.h index fcd80b364bf..452ee8fb827 100644 --- a/vbench/src/vbench/vbench/qps_tagger.h +++ b/vbench/src/vbench/vbench/qps_tagger.h @@ -22,7 +22,7 @@ private: public: QpsTagger(double qps, Handler<Request> &next); - virtual void handle(Request::UP request); + virtual void handle(Request::UP request) override; }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/request.h b/vbench/src/vbench/vbench/request.h index 7da731d746f..4951c96fbab 100644 --- a/vbench/src/vbench/vbench/request.h +++ b/vbench/src/vbench/vbench/request.h @@ -68,9 +68,9 @@ public: double latency() const { return (_endTime - _startTime); } - virtual void handleHeader(const string &name, const string &value); - virtual void handleContent(const Memory &data); - virtual void handleFailure(const string &reason); + virtual void handleHeader(const string &name, const string &value) override; + virtual void handleContent(const Memory &data) override; + virtual void handleFailure(const string &reason) override; const BenchmarkHeaders &headers() const { return _headers; } diff --git a/vbench/src/vbench/vbench/request_dumper.h b/vbench/src/vbench/vbench/request_dumper.h index 7005f71fbdf..aede956477c 100644 --- a/vbench/src/vbench/vbench/request_dumper.h +++ b/vbench/src/vbench/vbench/request_dumper.h @@ -21,8 +21,8 @@ private: public: RequestDumper(Handler<Request> &_next); - virtual void handle(Request::UP request); - virtual void report(); + virtual void handle(Request::UP request) override; + virtual void report() override; }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/request_generator.h b/vbench/src/vbench/vbench/request_generator.h index 5559a8ffcf1..38f2c7ad7f8 100644 --- a/vbench/src/vbench/vbench/request_generator.h +++ b/vbench/src/vbench/vbench/request_generator.h @@ -27,9 +27,9 @@ private: public: RequestGenerator(const string &inputFile, Handler<Request> &next); - void abort(); - virtual void run(); - virtual const Taint &tainted() const { return _input.tainted(); } + void abort() override; + virtual void run() override; + virtual const Taint &tainted() const override { return _input.tainted(); } }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/request_scheduler.h b/vbench/src/vbench/vbench/request_scheduler.h index 09c7b7f0f34..1de61073d35 100644 --- a/vbench/src/vbench/vbench/request_scheduler.h +++ b/vbench/src/vbench/vbench/request_scheduler.h @@ -40,15 +40,15 @@ private: HttpConnectionPool _connectionPool; std::vector<Worker::UP> _workers; - virtual void run(); + virtual void run() override; public: typedef std::unique_ptr<RequestScheduler> UP; RequestScheduler(Handler<Request> &next, size_t numWorkers); void abort(); - virtual void handle(Request::UP request); - virtual void start(); - virtual RequestScheduler &stop(); - virtual void join(); + virtual void handle(Request::UP request) override; + virtual void start() override; + virtual RequestScheduler &stop() override; + virtual void join() override; }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/request_sink.h b/vbench/src/vbench/vbench/request_sink.h index 27be9e7942e..37c6ce71fcc 100644 --- a/vbench/src/vbench/vbench/request_sink.h +++ b/vbench/src/vbench/vbench/request_sink.h @@ -15,8 +15,8 @@ class RequestSink : public Analyzer { public: RequestSink(); - virtual void handle(Request::UP request); - virtual void report(); + virtual void handle(Request::UP request) override; + virtual void report() override; }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/server_tagger.h b/vbench/src/vbench/vbench/server_tagger.h index c104b15bd53..6115873bb0c 100644 --- a/vbench/src/vbench/vbench/server_tagger.h +++ b/vbench/src/vbench/vbench/server_tagger.h @@ -23,7 +23,7 @@ private: public: ServerTagger(const ServerSpec &server, Handler<Request> &next); - virtual void handle(Request::UP request); + virtual void handle(Request::UP request) override; }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/vbench.h b/vbench/src/vbench/vbench/vbench.h index f17e5d4c6b1..5796b3dab76 100644 --- a/vbench/src/vbench/vbench/vbench.h +++ b/vbench/src/vbench/vbench/vbench.h @@ -42,8 +42,8 @@ private: public: VBench(const vespalib::Slime &cfg); void abort(); - virtual void run(); - virtual const Taint &tainted() const { return _taint; } + virtual void run() override; + virtual const Taint &tainted() const override { return _taint; } }; } // namespace vbench diff --git a/vbench/src/vbench/vbench/worker.h b/vbench/src/vbench/vbench/worker.h index 14e79312ce2..cdadaf87cd3 100644 --- a/vbench/src/vbench/vbench/worker.h +++ b/vbench/src/vbench/vbench/worker.h @@ -33,12 +33,12 @@ private: HttpConnectionPool &_pool; Timer &_timer; - virtual void run(); + virtual void run() override; public: typedef std::unique_ptr<Worker> UP; Worker(Provider<Request> &provider, Handler<Request> &next, HttpConnectionPool &pool, Timer &timer); - virtual void join() { _thread.join(); } + virtual void join() override { _thread.join(); } }; } // namespace vbench diff --git a/vdslib/src/tests/bucketdistribution/bucketdistributiontest.cpp b/vdslib/src/tests/bucketdistribution/bucketdistributiontest.cpp index 8daf089957f..589d7b66e96 100644 --- a/vdslib/src/tests/bucketdistribution/bucketdistributiontest.cpp +++ b/vdslib/src/tests/bucketdistribution/bucketdistributiontest.cpp @@ -10,8 +10,8 @@ using namespace vdslib; class BucketDistributionTest : public CppUnit::TestFixture { public: - void setUp() { } - void tearDown() { } + void setUp() override { } + void tearDown() override { } void testDistribution(); void testNumBucketBits(); diff --git a/vdslib/src/tests/thread/taskschedulertest.cpp b/vdslib/src/tests/thread/taskschedulertest.cpp index ef4be409ebc..22529a9f37a 100644 --- a/vdslib/src/tests/thread/taskschedulertest.cpp +++ b/vdslib/src/tests/thread/taskschedulertest.cpp @@ -29,7 +29,7 @@ struct TestWatch : public TaskScheduler::Watch { TestWatch(uint64_t startTime = 0) : _time(startTime) {} ~TestWatch() {} - TaskScheduler::Time getTime() const { + TaskScheduler::Time getTime() const override { vespalib::LockGuard guard(_lock); return _time; } @@ -71,7 +71,7 @@ struct TestTask : public TaskScheduler::Task _register = &myregister; } - int64_t run(TaskScheduler::Time currentTime) { + int64_t run(TaskScheduler::Time currentTime) override { // Emulate that we use time to run _watch.increment(_executionTime); if (_register != 0) { diff --git a/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp b/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp index 5e6051269ea..e00815241f0 100644 --- a/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp +++ b/vdstestlib/src/tests/dirconfig/dirconfigtest.cpp @@ -19,7 +19,7 @@ class Test : public vespalib::TestApp { public: void testNormalUsage(); - int Main(); + int Main() override; }; int diff --git a/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.cpp b/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.cpp index 3047208798b..7af156bbc2a 100644 --- a/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.cpp +++ b/vdstestlib/src/vespa/vdstestlib/cppunit/cppunittestrunner.cpp @@ -66,7 +66,7 @@ namespace { return (s[s.size() - 1] == '$'); } - virtual bool include(const std::string& name) const { + virtual bool include(const std::string& name) const override { if ((name.find("stress") != std::string::npos || name.find("Stress") != std::string::npos) && !_includeStressTests) @@ -90,11 +90,11 @@ namespace { struct LogHook : public CppUnit::TextTestProgressListener::TestStartHook { std::string lastTest; - virtual void startedTest(const std::string& testName) { + virtual void startedTest(const std::string& testName) override { LOG(info, "Starting test: %s", testName.c_str()); lastTest = testName; } - virtual void stoppedTest() { + virtual void stoppedTest() override { LOG(info, "Stopped test: %s", lastTest.c_str()); } }; diff --git a/vespaclient/src/vespa/vespaclient/spoolmaster/application.h b/vespaclient/src/vespa/vespaclient/spoolmaster/application.h index 1e4ad9c5b9e..87f628e631c 100644 --- a/vespaclient/src/vespa/vespaclient/spoolmaster/application.h +++ b/vespaclient/src/vespa/vespaclient/spoolmaster/application.h @@ -34,7 +34,7 @@ public: virtual ~Application(); // Implements FastOS_Application. - int Main(); + int Main() override; }; } diff --git a/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp b/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp index a320b7613e2..7ea270eb306 100644 --- a/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp +++ b/vespaclient/src/vespa/vespaclient/vdsstates/statesapp.cpp @@ -221,7 +221,7 @@ struct StateApp : public FastOS_Application { StateApp(std::string calledAs) : _options(getMode(calledAs)) {} - int Main() { + int Main() override { _options.setCommandLineArguments(_argc, _argv); try{ _options.parse(); diff --git a/vespaclient/src/vespa/vespaclient/vespadoclocator/application.h b/vespaclient/src/vespa/vespaclient/vespadoclocator/application.h index f498b522fea..2e50ffde2c0 100644 --- a/vespaclient/src/vespa/vespaclient/vespadoclocator/application.h +++ b/vespaclient/src/vespa/vespaclient/vespadoclocator/application.h @@ -18,6 +18,6 @@ private: public: // Implements FastOS_Application. - int Main(); + int Main() override; }; diff --git a/vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp b/vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp index ae2c362aae2..030f284c182 100644 --- a/vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp +++ b/vespaclient/src/vespa/vespaclient/vespadoclocator/locator.cpp @@ -120,7 +120,7 @@ Locator::configure(const std::string &configId, const std::string &clusterName) struct MyCB : public mbus::IConfigHandler { mbus::RoutingSpec mySpec; MyCB() : mySpec() {} - bool setupRouting(const mbus::RoutingSpec &spec) { + bool setupRouting(const mbus::RoutingSpec &spec) override { mySpec = spec; return true; } diff --git a/vespaclient/src/vespa/vespaclient/vesparoute/application.h b/vespaclient/src/vespa/vespaclient/vesparoute/application.h index c4f9d0ef047..e7eefb7f16d 100644 --- a/vespaclient/src/vespa/vespaclient/vesparoute/application.h +++ b/vespaclient/src/vespa/vespaclient/vesparoute/application.h @@ -69,7 +69,7 @@ public: ~Application(); // Inherit doc from FastOS_Application. - int Main(); + int Main() override; }; } diff --git a/vespaclient/src/vespa/vespaclient/vesparoute/mynetwork.h b/vespaclient/src/vespa/vespaclient/vesparoute/mynetwork.h index c8d959bb4ad..f9737d1de9a 100644 --- a/vespaclient/src/vespa/vespaclient/vesparoute/mynetwork.h +++ b/vespaclient/src/vespa/vespaclient/vesparoute/mynetwork.h @@ -20,13 +20,13 @@ public: MyNetwork(const mbus::RPCNetworkParams ¶ms); // Overrides RPCNetwork. - bool allocServiceAddress(mbus::RoutingNode &recipient); + bool allocServiceAddress(mbus::RoutingNode &recipient) override; // Overrides RPCNetwork. - void freeServiceAddress(mbus::RoutingNode &recipient); + void freeServiceAddress(mbus::RoutingNode &recipient) override; // Overrides RPCNetwork. - void send(const mbus::Message &msg, const std::vector<mbus::RoutingNode*> &recipients); + void send(const mbus::Message &msg, const std::vector<mbus::RoutingNode*> &recipients) override; /** * Returns whether or not the given address is actually out of service. diff --git a/vespalib/CMakeLists.txt b/vespalib/CMakeLists.txt index 39e56a5f97f..e5a374e4e58 100644 --- a/vespalib/CMakeLists.txt +++ b/vespalib/CMakeLists.txt @@ -49,6 +49,7 @@ vespa_define_module( src/tests/memory src/tests/net/selector src/tests/net/socket + src/tests/net/socket_spec src/tests/objects/nbostream src/tests/optimized src/tests/printable diff --git a/vespalib/src/tests/net/socket/socket_client.cpp b/vespalib/src/tests/net/socket/socket_client.cpp index c46b4989954..e12fe5330d0 100644 --- a/vespalib/src/tests/net/socket/socket_client.cpp +++ b/vespalib/src/tests/net/socket/socket_client.cpp @@ -1,6 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/vespalib/net/socket_address.h> +#include <vespa/vespalib/net/socket_spec.h> #include <vespa/vespalib/net/server_socket.h> #include <vespa/vespalib/net/socket.h> #include <vespa/vespalib/util/stringfmt.h> @@ -53,7 +53,7 @@ int main(int argc, char **argv) { fprintf(stderr, " %s\n", addr.spec().c_str()); } } - Socket::UP socket = Socket::connect(host, port); + Socket::UP socket = Socket::connect(SocketSpec::from_host_port(host, port)); if (!socket->valid()) { fprintf(stderr, "connect failed\n"); return 1; diff --git a/vespalib/src/tests/net/socket/socket_server.cpp b/vespalib/src/tests/net/socket/socket_server.cpp index f079a57e6f2..ff8d77f317d 100644 --- a/vespalib/src/tests/net/socket/socket_server.cpp +++ b/vespalib/src/tests/net/socket/socket_server.cpp @@ -1,6 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastos/fastos.h> -#include <vespa/vespalib/net/socket_address.h> +#include <vespa/vespalib/net/socket_spec.h> #include <vespa/vespalib/net/server_socket.h> #include <vespa/vespalib/net/socket.h> #include <vespa/vespalib/util/stringfmt.h> @@ -39,7 +39,7 @@ void write_msg(Socket &socket, const vespalib::string &msg) { } int main(int, char **) { - ServerSocket::UP server = ServerSocket::listen(0); + ServerSocket::UP server = ServerSocket::listen(SocketSpec::from_port(0)); if (!server->valid()) { fprintf(stderr, "listen failed, exiting\n"); return 1; diff --git a/vespalib/src/tests/net/socket/socket_test.cpp b/vespalib/src/tests/net/socket/socket_test.cpp index 8f77f12876c..1c6b027a2b3 100644 --- a/vespalib/src/tests/net/socket/socket_test.cpp +++ b/vespalib/src/tests/net/socket/socket_test.cpp @@ -1,6 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> -#include <vespa/vespalib/net/socket_address.h> +#include <vespa/vespalib/net/socket_spec.h> #include <vespa/vespalib/net/server_socket.h> #include <vespa/vespalib/net/socket.h> #include <vespa/vespalib/util/stringfmt.h> @@ -10,6 +10,54 @@ using namespace vespalib; +bool is_socket(const vespalib::string &path) { + struct stat info; + if (path.empty() || (lstat(path.c_str(), &info) != 0)) { + return false; + } + return S_ISSOCK(info.st_mode); +} + +bool is_file(const vespalib::string &path) { + struct stat info; + if (path.empty() || (lstat(path.c_str(), &info) != 0)) { + return false; + } + return S_ISREG(info.st_mode); +} + +void remove_file(const vespalib::string &path) { + unlink(path.c_str()); +} + +void replace_file(const vespalib::string &path, const vespalib::string &data) { + remove_file(path); + int fd = creat(path.c_str(), 0600); + ASSERT_NOT_EQUAL(fd, -1); + ASSERT_EQUAL(write(fd, data.data(), data.size()), data.size()); + close(fd); +} + +vespalib::string get_meta(const SocketAddress &addr) { + vespalib::string meta; + if (addr.is_ipv4()) { + meta = "ipv4"; + } else if (addr.is_ipv6()) { + meta = "ipv6"; + } else if (addr.is_ipc()) { + meta = "ipc"; + } else { + meta = "???"; + } + if (addr.is_wildcard()) { + meta += " wildcard"; + } + if (addr.is_abstract()) { + meta += " abstract"; + } + return meta; +} + vespalib::string read_bytes(Socket &socket, size_t wanted_bytes) { char tmp[64]; vespalib::string result; @@ -44,12 +92,12 @@ Socket::UP connect_sockets(bool is_server, ServerSocket &server_socket) { if (is_server) { return server_socket.accept(); } else { - SocketAddress server_address = server_socket.address(); - if (server_address.is_ipc()) { - return Socket::connect(server_address.path()); - } else { - return Socket::connect("localhost", server_address.port()); - } + auto server = server_socket.address(); + auto spec = server.spec(); + auto client = SocketSpec(spec).client_address(); + fprintf(stderr, "connecting to '%s' (server: %s) (client: %s)\n", + spec.c_str(), get_meta(server).c_str(), get_meta(client).c_str()); + return Socket::connect(SocketSpec(spec)); } } @@ -59,7 +107,12 @@ TEST("my local address") { auto list = SocketAddress::resolve(4080); fprintf(stderr, "resolve(4080):\n"); for (const auto &addr: list) { - fprintf(stderr, " %s\n", addr.spec().c_str()); + EXPECT_TRUE(addr.is_wildcard()); + EXPECT_TRUE(addr.is_ipv4() || addr.is_ipv6()); + EXPECT_TRUE(!addr.is_ipc()); + EXPECT_TRUE(!addr.is_abstract()); + EXPECT_EQUAL(addr.port(), 4080); + fprintf(stderr, " %s (%s)\n", addr.spec().c_str(), get_meta(addr).c_str()); } } @@ -67,29 +120,83 @@ TEST("yahoo.com address") { auto list = SocketAddress::resolve(80, "yahoo.com"); fprintf(stderr, "resolve(80, 'yahoo.com'):\n"); for (const auto &addr: list) { - fprintf(stderr, " %s\n", addr.spec().c_str()); + EXPECT_TRUE(!addr.is_wildcard()); + EXPECT_TRUE(addr.is_ipv4() || addr.is_ipv6()); + EXPECT_TRUE(!addr.is_ipc()); + EXPECT_TRUE(!addr.is_abstract()); + EXPECT_EQUAL(addr.port(), 80); + fprintf(stderr, " %s (%s)\n", addr.spec().c_str(), get_meta(addr).c_str()); } } -TEST("ipc address") { +TEST("ipc address (path)") { auto addr = SocketAddress::from_path("my_socket"); + EXPECT_TRUE(!addr.is_ipv4()); + EXPECT_TRUE(!addr.is_ipv6()); EXPECT_TRUE(addr.is_ipc()); + EXPECT_TRUE(!addr.is_abstract()); + EXPECT_TRUE(!addr.is_wildcard()); + EXPECT_EQUAL(addr.port(), -1); EXPECT_EQUAL(vespalib::string("my_socket"), addr.path()); + EXPECT_TRUE(addr.name().empty()); + fprintf(stderr, "from_path(my_socket)\n"); + fprintf(stderr, " %s (%s)\n", addr.spec().c_str(), get_meta(addr).c_str()); +} + +TEST("ipc address (name)") { + auto addr = SocketAddress::from_name("my_socket"); + EXPECT_TRUE(!addr.is_ipv4()); + EXPECT_TRUE(!addr.is_ipv6()); + EXPECT_TRUE(addr.is_ipc()); + EXPECT_TRUE(addr.is_abstract()); + EXPECT_TRUE(!addr.is_wildcard()); + EXPECT_EQUAL(addr.port(), -1); + EXPECT_TRUE(addr.path().empty()); + EXPECT_EQUAL(vespalib::string("my_socket"), addr.name()); fprintf(stderr, "from_path(my_socket)\n"); - fprintf(stderr, " %s\n", addr.spec().c_str()); + fprintf(stderr, " %s (%s)\n", addr.spec().c_str(), get_meta(addr).c_str()); +} + +TEST("local client/server addresses") { + auto spec = SocketSpec("tcp/123"); + auto client = spec.client_address(); + auto server = spec.server_address(); + EXPECT_TRUE(!client.is_wildcard()); + EXPECT_EQUAL(client.port(), 123); + EXPECT_TRUE(server.is_wildcard()); + EXPECT_EQUAL(server.port(), 123); + fprintf(stderr, "client(tcp/123): %s (%s)\n", client.spec().c_str(), get_meta(client).c_str()); + fprintf(stderr, "server(tcp/123): %s (%s)\n", server.spec().c_str(), get_meta(server).c_str()); } struct ServerWrapper { - ServerSocket::UP server = ServerSocket::listen(0); + ServerSocket::UP server; + ServerWrapper(const vespalib::string &spec) : server(ServerSocket::listen(SocketSpec(spec))) {} }; -TEST_MT_F("require that basic socket io works", 2, ServerWrapper) { +TEST_MT_FF("require that basic socket io works", 2, ServerWrapper("tcp/0"), TimeBomb(60)) { + bool is_server = (thread_id == 0); + Socket::UP socket = connect_sockets(is_server, *f1.server); + TEST_DO(verify_socket_io(is_server, *socket)); +} + +TEST_MT_FF("require that basic unix domain socket io works (path)", 2, + ServerWrapper("ipc/file:my_socket"), TimeBomb(60)) +{ + bool is_server = (thread_id == 0); + Socket::UP socket = connect_sockets(is_server, *f1.server); + TEST_DO(verify_socket_io(is_server, *socket)); +} + +TEST_MT_FF("require that basic unix domain socket io works (name)", 2, + ServerWrapper(make_string("ipc/name:my_socket-%d", int(getpid()))), TimeBomb(60)) +{ bool is_server = (thread_id == 0); Socket::UP socket = connect_sockets(is_server, *f1.server); TEST_DO(verify_socket_io(is_server, *socket)); } -TEST_MT_F("require that server accept can be interrupted", 2, ServerWrapper) { +TEST_MT_FF("require that server accept can be interrupted", 2, ServerWrapper("tcp/0"), TimeBomb(60)) { bool is_server = (thread_id == 0); if (is_server) { fprintf(stderr, "--> calling accept\n"); @@ -103,24 +210,92 @@ TEST_MT_F("require that server accept can be interrupted", 2, ServerWrapper) { } } -struct IpcServerWrapper { - vespalib::string server_path; - ServerSocket::UP server; - IpcServerWrapper(const vespalib::string &server_path_in) - : server_path(server_path_in), server() +TEST("require that socket file is removed by server socket when destructed") { + remove_file("my_socket"); + ServerSocket::UP server = ServerSocket::listen(SocketSpec("ipc/file:my_socket")); + EXPECT_TRUE(server->valid()); + EXPECT_TRUE(is_socket("my_socket")); + server.reset(); + EXPECT_TRUE(!is_socket("my_socket")); +} + +TEST("require that socket file is only removed on destruction if it is a socket") { + remove_file("my_socket"); + ServerSocket::UP server = ServerSocket::listen(SocketSpec("ipc/file:my_socket")); + EXPECT_TRUE(server->valid()); + EXPECT_TRUE(is_socket("my_socket")); + replace_file("my_socket", "hello\n"); + server.reset(); + EXPECT_TRUE(is_file("my_socket")); + remove_file("my_socket"); +} + +TEST("require that a server socket will fail to listen to a path that is already a regular file") { + replace_file("my_socket", "hello\n"); + ServerSocket::UP server = ServerSocket::listen(SocketSpec("ipc/file:my_socket")); + EXPECT_TRUE(!server->valid()); + server.reset(); + EXPECT_TRUE(is_file("my_socket")); + remove_file("my_socket"); +} + +TEST("require that a server socket will fail to listen to a path that is already taken by another server") { + remove_file("my_socket"); + ServerSocket::UP server1 = ServerSocket::listen(SocketSpec("ipc/file:my_socket")); + ServerSocket::UP server2 = ServerSocket::listen(SocketSpec("ipc/file:my_socket")); + EXPECT_TRUE(server1->valid()); + EXPECT_TRUE(!server2->valid()); + EXPECT_TRUE(is_socket("my_socket")); + server1.reset(); + EXPECT_TRUE(!is_socket("my_socket")); +} + +TEST("require that a server socket will remove an old socket file if it cannot be connected to") { + remove_file("my_socket"); { - unlink(server_path.c_str()); - server = ServerSocket::listen(server_path); + SocketHandle server_handle = SocketAddress::from_path("my_socket").listen(); + EXPECT_TRUE(is_socket("my_socket")); } - ~IpcServerWrapper() { - server.reset(); - unlink(server_path.c_str()); - } -}; + EXPECT_TRUE(is_socket("my_socket")); + ServerSocket::UP server = ServerSocket::listen(SocketSpec("ipc/file:my_socket")); + EXPECT_TRUE(server->valid()); + server.reset(); + EXPECT_TRUE(!is_socket("my_socket")); +} -TEST_MT_F("require that basic unix domain socket io works", 2, IpcServerWrapper("my_socket")) { - bool is_server = (thread_id == 0); - Socket::UP socket = connect_sockets(is_server, *f1.server); +TEST("require that two server sockets cannot have the same abstract unix domain socket name") { + vespalib::string spec = make_string("ipc/name:my_socket-%d", int(getpid())); + ServerSocket::UP server1 = ServerSocket::listen(SocketSpec(spec)); + ServerSocket::UP server2 = ServerSocket::listen(SocketSpec(spec)); + EXPECT_TRUE(server1->valid()); + EXPECT_TRUE(!server2->valid()); +} + +TEST("require that abstract socket names are freed when the server socket is destructed") { + vespalib::string spec = make_string("ipc/name:my_socket-%d", int(getpid())); + ServerSocket::UP server1 = ServerSocket::listen(SocketSpec(spec)); + EXPECT_TRUE(server1->valid()); + server1.reset(); + ServerSocket::UP server2 = ServerSocket::listen(SocketSpec(spec)); + EXPECT_TRUE(server2->valid()); +} + +TEST("require that abstract sockets do not have socket files") { + vespalib::string name = make_string("my_socket-%d", int(getpid())); + vespalib::string spec = make_string("ipc/name:%s", name.c_str()); + ServerSocket::UP server = ServerSocket::listen(SocketSpec(spec)); + EXPECT_TRUE(server->valid()); + EXPECT_TRUE(!is_socket(name)); + EXPECT_TRUE(!is_file(name)); +} + +TEST_MT_FFF("require that abstract and file-based unix domain sockets are not in conflict", 4, + ServerWrapper(make_string("ipc/file:my_socket-%d", int(getpid()))), + ServerWrapper(make_string("ipc/name:my_socket-%d", int(getpid()))), TimeBomb(60)) +{ + bool is_server = ((thread_id % 2) == 0); + ServerSocket &server_socket = ((thread_id / 2) == 0) ? *f1.server : *f2.server; + Socket::UP socket = connect_sockets(is_server, server_socket); TEST_DO(verify_socket_io(is_server, *socket)); } diff --git a/vespalib/src/tests/net/socket_spec/CMakeLists.txt b/vespalib/src/tests/net/socket_spec/CMakeLists.txt new file mode 100644 index 00000000000..66b4ea4d5d6 --- /dev/null +++ b/vespalib/src/tests/net/socket_spec/CMakeLists.txt @@ -0,0 +1,8 @@ +# Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +vespa_add_executable(vespalib_socket_spec_test_app TEST + SOURCES + socket_spec_test.cpp + DEPENDS + vespalib +) +vespa_add_test(NAME vespalib_socket_spec_test_app COMMAND vespalib_socket_spec_test_app) diff --git a/vespalib/src/tests/net/socket_spec/socket_spec_test.cpp b/vespalib/src/tests/net/socket_spec/socket_spec_test.cpp new file mode 100644 index 00000000000..9cb88993c97 --- /dev/null +++ b/vespalib/src/tests/net/socket_spec/socket_spec_test.cpp @@ -0,0 +1,102 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/vespalib/testkit/test_kit.h> +#include <vespa/vespalib/net/socket_spec.h> + +using namespace vespalib; + +void verify(const SocketSpec &spec, bool valid, + const vespalib::string &path, const vespalib::string &name, + const vespalib::string &host, int port) +{ + EXPECT_EQUAL(spec.valid(), valid); + EXPECT_EQUAL(spec.path(), path); + EXPECT_EQUAL(spec.name(), name); + EXPECT_EQUAL(spec.host(), host); + EXPECT_EQUAL(spec.port(), port); +} + +void verify_path(const SocketSpec &spec, const vespalib::string &path) { + TEST_DO(verify(spec, true, path, "", "", -1)); +} + +void verify_name(const SocketSpec &spec, const vespalib::string &name) { + TEST_DO(verify(spec, true, "", name, "", -1)); +} + +void verify_host_port(const SocketSpec &spec, const vespalib::string &host, int port) { + TEST_DO(verify(spec, true, "", "", host, port)); +} + +void verify_port(const SocketSpec &spec, int port) { + TEST_DO(verify(spec, true, "", "", "", port)); +} + +void verify_invalid(const SocketSpec &spec) { + TEST_DO(verify(spec, false, "", "", "", -1)); +} + +void verify_spec(const vespalib::string &str, const vespalib::string &expect) { + vespalib::string actual = SocketSpec(str).spec(); + EXPECT_EQUAL(actual, expect); +} + +void verify_spec(const vespalib::string &str) { + TEST_DO(verify_spec(str, str)); +} + +//----------------------------------------------------------------------------- + +TEST("require that socket spec can be created directly from path") { + TEST_DO(verify_path(SocketSpec::from_path("my_path"), "my_path")); +} + +TEST("require that socket spec can be created directly from name") { + TEST_DO(verify_name(SocketSpec::from_name("my_name"), "my_name")); +} + +TEST("require that socket spec can be created directly from host and port") { + TEST_DO(verify_host_port(SocketSpec::from_host_port("my_host", 123), "my_host", 123)); +} + +TEST("require that socket spec can be created directly from port only") { + TEST_DO(verify_port(SocketSpec::from_port(123), 123)); +} + +TEST("require that socket spec parsing works as expected") { + TEST_DO(verify_invalid(SocketSpec(""))); + TEST_DO(verify_invalid(SocketSpec("bogus"))); + TEST_DO(verify_path(SocketSpec("ipc/file:my_path"), "my_path")); + TEST_DO(verify_invalid(SocketSpec("ipc/file:"))); + TEST_DO(verify_name(SocketSpec("ipc/name:my_name"), "my_name")); + TEST_DO(verify_invalid(SocketSpec("ipc/name:"))); + TEST_DO(verify_host_port(SocketSpec("tcp/my_host:123"), "my_host", 123)); + TEST_DO(verify_port(SocketSpec("tcp/123"), 123)); + TEST_DO(verify_port(SocketSpec("tcp/0"), 0)); + TEST_DO(verify_invalid(SocketSpec("tcp/:123"))); + TEST_DO(verify_invalid(SocketSpec("tcp/:0"))); + TEST_DO(verify_invalid(SocketSpec("tcp/host:xyz"))); + TEST_DO(verify_invalid(SocketSpec("tcp/xyz"))); + TEST_DO(verify_invalid(SocketSpec("tcp/host:-123"))); + TEST_DO(verify_invalid(SocketSpec("tcp/-123"))); + TEST_DO(verify_invalid(SocketSpec("tcp/host:"))); + TEST_DO(verify_invalid(SocketSpec("tcp/"))); + TEST_DO(verify_host_port(SocketSpec("tcp/[my:host]:123"), "my:host", 123)); + TEST_DO(verify_invalid(SocketSpec("tcp/[]:123"))); + TEST_DO(verify_host_port(SocketSpec("tcp/[:123"), "[", 123)); + TEST_DO(verify_host_port(SocketSpec("tcp/]:123"), "]", 123)); + TEST_DO(verify_host_port(SocketSpec("tcp/my:host:123"), "my:host", 123)); +} + +TEST("require that socket spec to string transform works as expected") { + TEST_DO(verify_spec("invalid")); + TEST_DO(verify_spec("bogus", "invalid")); + TEST_DO(verify_spec("ipc/file:my_path")); + TEST_DO(verify_spec("ipc/name:my_name")); + TEST_DO(verify_spec("tcp/123")); + TEST_DO(verify_spec("tcp/0")); + TEST_DO(verify_spec("tcp/host:123")); + TEST_DO(verify_spec("tcp/[my:host]:123")); + TEST_DO(verify_spec("tcp/[host]:123", "tcp/host:123")); +} + +TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/vespalib/src/vespa/vespalib/net/CMakeLists.txt b/vespalib/src/vespa/vespalib/net/CMakeLists.txt index 40b8b656db7..303d16db41e 100644 --- a/vespalib/src/vespa/vespalib/net/CMakeLists.txt +++ b/vespalib/src/vespa/vespalib/net/CMakeLists.txt @@ -6,5 +6,6 @@ vespa_add_library(vespalib_vespalib_net OBJECT socket.cpp socket_address.cpp socket_handle.cpp + socket_spec.cpp DEPENDS ) diff --git a/vespalib/src/vespa/vespalib/net/server_socket.cpp b/vespalib/src/vespa/vespalib/net/server_socket.cpp index 1b026cfa7d4..04be8fc8888 100644 --- a/vespalib/src/vespa/vespalib/net/server_socket.cpp +++ b/vespalib/src/vespa/vespalib/net/server_socket.cpp @@ -1,10 +1,34 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #include "server_socket.h" +#include "socket_spec.h" + +#include <vespa/log/log.h> +LOG_SETUP(".vespalib.net.server_socket"); namespace vespalib { +bool is_socket(const vespalib::string &path) { + struct stat info; + if (path.empty() || (lstat(path.c_str(), &info) != 0)) { + return false; + } + return S_ISSOCK(info.st_mode); +} + +ServerSocket::ServerSocket(SocketHandle handle) + : _handle(std::move(handle)), + _path(SocketAddress::address_of(_handle.get()).path()) +{ +} + +ServerSocket::~ServerSocket() +{ + if (is_socket(_path)) { + unlink(_path.c_str()); + } +} + SocketAddress ServerSocket::address() const { @@ -27,16 +51,16 @@ ServerSocket::accept() } ServerSocket::UP -ServerSocket::listen(int port) +ServerSocket::listen(const SocketSpec &spec) { - SocketHandle handle = SocketAddress::select_local(port).listen(); - return std::make_unique<ServerSocket>(std::move(handle)); -} - -ServerSocket::UP -ServerSocket::listen(const vespalib::string &path) -{ - SocketHandle handle = SocketAddress::from_path(path).listen(); + SocketHandle handle = spec.server_address().listen(); + if (!handle.valid() && is_socket(spec.path())) { + if (!spec.client_address().connect().valid()) { + LOG(warning, "removing old socket: '%s'", spec.path().c_str()); + unlink(spec.path().c_str()); + handle = spec.server_address().listen(); + } + } return std::make_unique<ServerSocket>(std::move(handle)); } diff --git a/vespalib/src/vespa/vespalib/net/server_socket.h b/vespalib/src/vespa/vespalib/net/server_socket.h index cba03e0fb3c..1c4f41343d7 100644 --- a/vespalib/src/vespa/vespalib/net/server_socket.h +++ b/vespalib/src/vespa/vespalib/net/server_socket.h @@ -9,22 +9,25 @@ namespace vespalib { +class SocketSpec; + class ServerSocket { private: SocketHandle _handle; + vespalib::string _path; public: typedef std::unique_ptr<ServerSocket> UP; ServerSocket(const ServerSocket &rhs) = delete; ServerSocket &operator=(const ServerSocket &rhs) = delete; - explicit ServerSocket(SocketHandle handle) : _handle(std::move(handle)) {} + explicit ServerSocket(SocketHandle handle); + ~ServerSocket(); bool valid() const { return _handle.valid(); } SocketAddress address() const; void shutdown(); Socket::UP accept(); - static ServerSocket::UP listen(int port); - static ServerSocket::UP listen(const vespalib::string &path); + static ServerSocket::UP listen(const SocketSpec &spec); }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/net/socket.cpp b/vespalib/src/vespa/vespalib/net/socket.cpp index 23a4e5f9765..8c016df3d6d 100644 --- a/vespalib/src/vespa/vespalib/net/socket.cpp +++ b/vespalib/src/vespa/vespalib/net/socket.cpp @@ -1,6 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "socket.h" +#include "socket_spec.h" namespace vespalib { @@ -47,16 +48,9 @@ Socket::write(const char *buf, size_t len) } Socket::UP -Socket::connect(const vespalib::string &host, int port) +Socket::connect(const SocketSpec &spec) { - SocketHandle handle = SocketAddress::select_remote(port, host.c_str()).connect(); - return std::make_unique<Socket>(std::move(handle)); -} - -Socket::UP -Socket::connect(const vespalib::string &path) -{ - SocketHandle handle = SocketAddress::from_path(path).connect(); + SocketHandle handle = spec.client_address().connect(); return std::make_unique<Socket>(std::move(handle)); } diff --git a/vespalib/src/vespa/vespalib/net/socket.h b/vespalib/src/vespa/vespalib/net/socket.h index 7298c38946c..b83faf0a67c 100644 --- a/vespalib/src/vespa/vespalib/net/socket.h +++ b/vespalib/src/vespa/vespalib/net/socket.h @@ -9,6 +9,8 @@ namespace vespalib { +class SocketSpec; + class Socket { private: @@ -25,8 +27,7 @@ public: void shutdown(); ssize_t read(char *buf, size_t len); ssize_t write(const char *buf, size_t len); - static Socket::UP connect(const vespalib::string &host, int port); - static Socket::UP connect(const vespalib::string &path); + static Socket::UP connect(const SocketSpec &spec); }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/net/socket_address.cpp b/vespalib/src/vespa/vespalib/net/socket_address.cpp index d6cb5a3582b..6a70491beb8 100644 --- a/vespalib/src/vespa/vespalib/net/socket_address.cpp +++ b/vespalib/src/vespa/vespalib/net/socket_address.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #include "socket_address.h" #include <vespa/vespalib/util/stringfmt.h> #include <sys/types.h> @@ -11,18 +10,46 @@ namespace vespalib { +namespace { + +const in6_addr ipv6_wildcard = IN6ADDR_ANY_INIT; + +} // namespace vespalib::<unnamed> + +bool +SocketAddress::is_wildcard() const +{ + if (is_ipv4()) { + return (addr_in()->sin_addr.s_addr == htonl(INADDR_ANY)); + } + if (is_ipv6()) { + return (memcmp(&addr_in6()->sin6_addr, &ipv6_wildcard, sizeof(in6_addr)) == 0); + } + return false; +} + +bool +SocketAddress::is_abstract() const +{ + bool result = false; + if (is_ipc()) { + const char *path_limit = (reinterpret_cast<const char *>(addr_un()) + _size); + const char *pos = &addr_un()->sun_path[0]; + result = ((path_limit > pos) && (pos[0] == '\0')); + } + return result; +} + vespalib::string SocketAddress::ip_address() const { - vespalib::string result = "invalid"; + vespalib::string result; if (is_ipv4()) { char buf[INET_ADDRSTRLEN]; - const sockaddr_in *addr = reinterpret_cast<const sockaddr_in *>(&_addr); - result = inet_ntop(AF_INET, &addr->sin_addr, buf, sizeof(buf)); + result = inet_ntop(AF_INET, &addr_in()->sin_addr, buf, sizeof(buf)); } else if (is_ipv6()) { char buf[INET6_ADDRSTRLEN]; - const sockaddr_in6 *addr = reinterpret_cast<const sockaddr_in6 *>(&_addr); - result = inet_ntop(AF_INET6, &addr->sin6_addr, buf, sizeof(buf)); + result = inet_ntop(AF_INET6, &addr_in6()->sin6_addr, buf, sizeof(buf)); } return result; } @@ -30,11 +57,26 @@ SocketAddress::ip_address() const vespalib::string SocketAddress::path() const { - vespalib::string result = ""; - if (is_ipc()) { - const sockaddr_un *addr = reinterpret_cast<const sockaddr_un *>(&_addr); - const char *path_limit = (reinterpret_cast<const char *>(addr) + _size); - const char *pos = &addr->sun_path[0]; + vespalib::string result; + if (is_ipc() && !is_abstract()) { + const char *path_limit = (reinterpret_cast<const char *>(addr_un()) + _size); + const char *pos = &addr_un()->sun_path[0]; + const char *end = pos; + while ((end < path_limit) && (*end != 0)) { + ++end; + } + result.assign(pos, end - pos); + } + return result; +} + +vespalib::string +SocketAddress::name() const +{ + vespalib::string result; + if (is_ipc() && is_abstract()) { + const char *path_limit = (reinterpret_cast<const char *>(addr_un()) + _size); + const char *pos = &addr_un()->sun_path[1]; const char *end = pos; while ((end < path_limit) && (*end != 0)) { ++end; @@ -56,12 +98,10 @@ int SocketAddress::port() const { if (is_ipv4()) { - const sockaddr_in *addr = reinterpret_cast<const sockaddr_in *>(&_addr); - return ntohs(addr->sin_port); + return ntohs(addr_in()->sin_port); } if (is_ipv6()) { - const sockaddr_in6 *addr = reinterpret_cast<const sockaddr_in6 *>(&_addr); - return ntohs(addr->sin6_port); + return ntohs(addr_in6()->sin6_port); } return -1; } @@ -69,6 +109,9 @@ SocketAddress::port() const vespalib::string SocketAddress::spec() const { + if (is_wildcard()) { + return make_string("tcp/%d", port()); + } if (is_ipv4()) { return make_string("tcp/%s:%d", ip_address().c_str(), port()); } @@ -76,7 +119,11 @@ SocketAddress::spec() const return make_string("tcp/[%s]:%d", ip_address().c_str(), port()); } if (is_ipc()) { - return make_string("ipc/file:%s", path().c_str()); + if (is_abstract()) { + return make_string("ipc/name:%s", name().c_str()); + } else { + return make_string("ipc/file:%s", path().c_str()); + } } return "invalid"; } @@ -182,10 +229,22 @@ SocketAddress::from_path(const vespalib::string &path) { SocketAddress result; sockaddr_un &addr_un = reinterpret_cast<sockaddr_un &>(result._addr); - assert(sizeof(sockaddr_un) <= sizeof(result._addr)); - if (path.size() < sizeof(addr_un.sun_path)) { + if (!path.empty() && (path.size() < sizeof(addr_un.sun_path))) { + addr_un.sun_family = AF_UNIX; + memcpy(&addr_un.sun_path[0], path.data(), path.size()); + result._size = sizeof(sockaddr_un); + } + return result; +} + +SocketAddress +SocketAddress::from_name(const vespalib::string &name) +{ + SocketAddress result; + sockaddr_un &addr_un = reinterpret_cast<sockaddr_un &>(result._addr); + if (!name.empty() && (name.size() < sizeof(addr_un.sun_path))) { addr_un.sun_family = AF_UNIX; - strcpy(&addr_un.sun_path[0], path.c_str()); + memcpy(&addr_un.sun_path[1], name.data(), name.size()); result._size = sizeof(sockaddr_un); } return result; diff --git a/vespalib/src/vespa/vespalib/net/socket_address.h b/vespalib/src/vespa/vespalib/net/socket_address.h index a71b676f274..c6810ad6108 100644 --- a/vespalib/src/vespa/vespalib/net/socket_address.h +++ b/vespalib/src/vespa/vespalib/net/socket_address.h @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - #pragma once #include <vespa/vespalib/stllike/string.h> @@ -8,10 +7,14 @@ #include <vector> #include <sys/socket.h> +struct sockaddr_in; +struct sockaddr_in6; +struct sockaddr_un; + namespace vespalib { /** - * Wrapper class for low-level TCP/IP socket addresses. + * Wrapper class for low-level TCP/IP and IPC socket addresses. **/ class SocketAddress { @@ -20,7 +23,10 @@ private: sockaddr_storage _addr; const sockaddr *addr() const { return reinterpret_cast<const sockaddr *>(&_addr); } - explicit SocketAddress(const sockaddr *addr_in, socklen_t addrlen_in); + const sockaddr_in *addr_in() const { return reinterpret_cast<const sockaddr_in *>(&_addr); } + const sockaddr_in6 *addr_in6() const { return reinterpret_cast<const sockaddr_in6 *>(&_addr); } + const sockaddr_un *addr_un() const { return reinterpret_cast<const sockaddr_un *>(&_addr); } + SocketAddress(const sockaddr *addr_in, socklen_t addrlen_in); public: SocketAddress() { memset(this, 0, sizeof(SocketAddress)); } SocketAddress(const SocketAddress &rhs) { memcpy(this, &rhs, sizeof(SocketAddress)); } @@ -32,9 +38,12 @@ public: bool is_ipv4() const { return (valid() && (_addr.ss_family == AF_INET)); } bool is_ipv6() const { return (valid() && (_addr.ss_family == AF_INET6)); } bool is_ipc() const { return (valid() && (_addr.ss_family == AF_UNIX)); } + bool is_wildcard() const; + bool is_abstract() const; int port() const; vespalib::string ip_address() const; vespalib::string path() const; + vespalib::string name() const; vespalib::string spec() const; SocketHandle connect() const; SocketHandle listen(int backlog = 500) const; @@ -58,6 +67,7 @@ public: return SocketAddress(); } static SocketAddress from_path(const vespalib::string &path); + static SocketAddress from_name(const vespalib::string &name); }; } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/net/socket_spec.cpp b/vespalib/src/vespa/vespalib/net/socket_spec.cpp new file mode 100644 index 00000000000..0964e3f8b8f --- /dev/null +++ b/vespalib/src/vespa/vespalib/net/socket_spec.cpp @@ -0,0 +1,102 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "socket_spec.h" +#include <vespa/vespalib/util/stringfmt.h> + +namespace vespalib { + +namespace { + +const vespalib::string tcp_prefix("tcp/"); +const vespalib::string ipc_path_prefix("ipc/file:"); +const vespalib::string ipc_name_prefix("ipc/name:"); + +SocketAddress make_address(const char *node, int port, bool server) { + if (server) { + return SocketAddress::select_local(port, node); + } else { + return SocketAddress::select_remote(port, node); + } +} + +SocketAddress make_address(int port, bool server) { + const char *node = server ? nullptr : "localhost"; + return make_address(node, port, server); +} + +} // namespace vespalib::<unnamed> + +const vespalib::string SocketSpec::_empty; + +SocketAddress +SocketSpec::address(bool server) const +{ + switch (_type) { + case Type::PATH: return SocketAddress::from_path(_node); + case Type::NAME: return SocketAddress::from_name(_node); + case Type::HOST_PORT: return make_address(_node.c_str(), _port, server); + case Type::PORT: return make_address(_port, server); + case Type::INVALID: ; + } + return SocketAddress(); +} + +SocketSpec::SocketSpec(const vespalib::string &spec) + : SocketSpec() +{ + if (starts_with(spec, ipc_path_prefix)) { + _node = spec.substr(ipc_path_prefix.size()); + _type = Type::PATH; + } else if (starts_with(spec, ipc_name_prefix)) { + _node = spec.substr(ipc_name_prefix.size()); + _type = Type::NAME; + } else if (starts_with(spec, tcp_prefix)) { + bool with_host = (spec.find(':') != spec.npos); + const char *port_str = spec.c_str() + (with_host + ? (spec.rfind(':') + 1) + : tcp_prefix.size()); + int port = atoi(port_str); + if ((port > 0) || (strcmp(port_str, "0") == 0)) { + _port = port; + if (with_host) { + const char *host_str = spec.c_str() + tcp_prefix.size(); + size_t host_str_len = (port_str - host_str) - 1; + if ((host_str_len >= 2) + && (host_str[0] == '[') + && (host_str[host_str_len - 1] == ']')) + { + ++host_str; + host_str_len -= 2; + } + _node.assign(host_str, host_str_len); + _type = Type::HOST_PORT; + } else { + _type = Type::PORT; + } + } + } + if ((_type != Type::PORT) && _node.empty()) { + _type = Type::INVALID; + _port = -1; + } +} + +vespalib::string +SocketSpec::spec() const +{ + switch (_type) { + case Type::PATH: return make_string("ipc/file:%s", _node.c_str()); + case Type::NAME: return make_string("ipc/name:%s", _node.c_str()); + case Type::HOST_PORT: + if (_node.find(':') != _node.npos) { + return make_string("tcp/[%s]:%d", _node.c_str(), _port); + } else { + return make_string("tcp/%s:%d", _node.c_str(), _port); + } + case Type::PORT: return make_string("tcp/%d", _port); + case Type::INVALID: ; + } + return "invalid"; +} + +} // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/net/socket_spec.h b/vespalib/src/vespa/vespalib/net/socket_spec.h new file mode 100644 index 00000000000..488cbf28fe7 --- /dev/null +++ b/vespalib/src/vespa/vespalib/net/socket_spec.h @@ -0,0 +1,50 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include <vespa/vespalib/stllike/string.h> +#include "socket_address.h" + +namespace vespalib { + +/** + * High-level socket address specification. + **/ +class SocketSpec +{ +private: + enum class Type { INVALID, PATH, NAME, HOST_PORT, PORT }; + static const vespalib::string _empty; + Type _type; + vespalib::string _node; + int _port; + + SocketSpec() : _type(Type::INVALID), _node(), _port(-1) {} + SocketSpec(Type type, const vespalib::string &node, int port) + : _type(type), _node(node), _port(port) {} + SocketAddress address(bool server) const; +public: + explicit SocketSpec(const vespalib::string &spec); + vespalib::string spec() const; + static SocketSpec from_path(const vespalib::string &path) { + return SocketSpec(Type::PATH, path, -1); + } + static SocketSpec from_name(const vespalib::string &name) { + return SocketSpec(Type::NAME, name, -1); + } + static SocketSpec from_host_port(const vespalib::string &host, int port) { + return SocketSpec(Type::HOST_PORT, host, port); + } + static SocketSpec from_port(int port) { + return SocketSpec(Type::PORT, "", port); + } + bool valid() const { return (_type != Type::INVALID); } + const vespalib::string &path() const { return (_type == Type::PATH) ? _node : _empty; } + const vespalib::string &name() const { return (_type == Type::NAME) ? _node : _empty; } + const vespalib::string &host() const { return (_type == Type::HOST_PORT) ? _node : _empty; } + int port() const { return _port; } + SocketAddress client_address() const { return address(false); } + SocketAddress server_address() const { return address(true); } +}; + +} // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/arraysize.h b/vespalib/src/vespa/vespalib/util/arraysize.h index b34b76a981e..f29a3e6e74d 100644 --- a/vespalib/src/vespa/vespalib/util/arraysize.h +++ b/vespalib/src/vespa/vespalib/util/arraysize.h @@ -4,7 +4,8 @@ namespace vespalib { -template <typename T, int N> int arraysize(const T (&)[N]) { return N; } +template <typename T, size_t N> +constexpr size_t arraysize(const T (&)[N]) { return N; } } // namespace vespalib diff --git a/vespalib/src/vespa/vespalib/util/closure.h b/vespalib/src/vespa/vespalib/util/closure.h index a389bc5deeb..81ea8430609 100644 --- a/vespalib/src/vespa/vespalib/util/closure.h +++ b/vespalib/src/vespa/vespalib/util/closure.h @@ -69,7 +69,7 @@ class Closure0_0 : public Closure0<R> { Func _func; - virtual R call() + virtual R call() override { return _func(); } public: @@ -85,7 +85,7 @@ class Closure0_1 : public Closure0<R> { Func _func; T1 _arg1; - virtual R call() + virtual R call() override { return _func(std::move(_arg1)); } public: @@ -102,7 +102,7 @@ class Closure0_2 : public Closure0<R> { T1 _arg1; T2 _arg2; - virtual R call() + virtual R call() override { return _func(std::move(_arg1), std::move(_arg2)); } public: @@ -120,7 +120,7 @@ class Closure0_3 : public Closure0<R> { T2 _arg2; T3 _arg3; - virtual R call() + virtual R call() override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3)); } public: @@ -139,7 +139,7 @@ class Closure0_4 : public Closure0<R> { T3 _arg3; T4 _arg4; - virtual R call() + virtual R call() override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4)); } public: @@ -157,7 +157,7 @@ class MemberClosure0_0 : public Closure0<R> { Ptr _ptr; MemFun _mem_fun; - virtual R call() + virtual R call() override { return ((*_ptr).*_mem_fun)(); } public: @@ -209,7 +209,7 @@ class MemberClosure0_3 : public Closure0<R> { T2 _arg2; T3 _arg3; - virtual R call() + virtual R call() override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3)); } public: @@ -229,7 +229,7 @@ class MemberClosure0_4 : public Closure0<R> { T3 _arg3; T4 _arg4; - virtual R call() + virtual R call() override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4)); } public: @@ -246,7 +246,7 @@ class Closure1_0 : public Closure1<P1, R> { Func _func; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return _func(std::move(param1)); } public: @@ -262,7 +262,7 @@ class Closure1_1 : public Closure1<P1, R> { Func _func; T1 _arg1; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return _func(std::move(_arg1), std::move(param1)); } public: @@ -279,7 +279,7 @@ class Closure1_2 : public Closure1<P1, R> { T1 _arg1; T2 _arg2; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return _func(std::move(_arg1), std::move(_arg2), std::move(param1)); } public: @@ -297,7 +297,7 @@ class Closure1_3 : public Closure1<P1, R> { T2 _arg2; T3 _arg3; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(param1)); } public: @@ -316,7 +316,7 @@ class Closure1_4 : public Closure1<P1, R> { T3 _arg3; T4 _arg4; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4), std::move(param1)); } public: @@ -334,7 +334,7 @@ class MemberClosure1_0 : public Closure1<P1, R> { Ptr _ptr; MemFun _mem_fun; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return ((*_ptr).*_mem_fun)(std::move(param1)); } public: @@ -351,7 +351,7 @@ class MemberClosure1_1 : public Closure1<P1, R> { MemFun _mem_fun; T1 _arg1; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(param1)); } public: @@ -369,7 +369,7 @@ class MemberClosure1_2 : public Closure1<P1, R> { T1 _arg1; T2 _arg2; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(param1)); } public: @@ -388,7 +388,7 @@ class MemberClosure1_3 : public Closure1<P1, R> { T2 _arg2; T3 _arg3; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(param1)); } public: @@ -408,7 +408,7 @@ class MemberClosure1_4 : public Closure1<P1, R> { T3 _arg3; T4 _arg4; - virtual R call(P1 param1) + virtual R call(P1 param1) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4), std::move(param1)); } public: @@ -425,7 +425,7 @@ class Closure2_0 : public Closure2<P1, P2, R> { Func _func; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return _func(std::move(param1), std::move(param2)); } public: @@ -441,7 +441,7 @@ class Closure2_1 : public Closure2<P1, P2, R> { Func _func; T1 _arg1; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return _func(std::move(_arg1), std::move(param1), std::move(param2)); } public: @@ -458,7 +458,7 @@ class Closure2_2 : public Closure2<P1, P2, R> { T1 _arg1; T2 _arg2; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return _func(std::move(_arg1), std::move(_arg2), std::move(param1), std::move(param2)); } public: @@ -476,7 +476,7 @@ class Closure2_3 : public Closure2<P1, P2, R> { T2 _arg2; T3 _arg3; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(param1), std::move(param2)); } public: @@ -495,7 +495,7 @@ class Closure2_4 : public Closure2<P1, P2, R> { T3 _arg3; T4 _arg4; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4), std::move(param1), std::move(param2)); } public: @@ -513,7 +513,7 @@ class MemberClosure2_0 : public Closure2<P1, P2, R> { Ptr _ptr; MemFun _mem_fun; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return ((*_ptr).*_mem_fun)(std::move(param1), std::move(param2)); } public: @@ -530,7 +530,7 @@ class MemberClosure2_1 : public Closure2<P1, P2, R> { MemFun _mem_fun; T1 _arg1; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(param1), std::move(param2)); } public: @@ -548,7 +548,7 @@ class MemberClosure2_2 : public Closure2<P1, P2, R> { T1 _arg1; T2 _arg2; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(param1), std::move(param2)); } public: @@ -567,7 +567,7 @@ class MemberClosure2_3 : public Closure2<P1, P2, R> { T2 _arg2; T3 _arg3; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(param1), std::move(param2)); } public: @@ -587,7 +587,7 @@ class MemberClosure2_4 : public Closure2<P1, P2, R> { T3 _arg3; T4 _arg4; - virtual R call(P1 param1, P2 param2) + virtual R call(P1 param1, P2 param2) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4), std::move(param1), std::move(param2)); } public: @@ -604,7 +604,7 @@ class Closure3_0 : public Closure3<P1, P2, P3, R> { Func _func; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return _func(std::move(param1), std::move(param2), std::move(param3)); } public: @@ -620,7 +620,7 @@ class Closure3_1 : public Closure3<P1, P2, P3, R> { Func _func; T1 _arg1; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return _func(std::move(_arg1), std::move(param1), std::move(param2), std::move(param3)); } public: @@ -637,7 +637,7 @@ class Closure3_2 : public Closure3<P1, P2, P3, R> { T1 _arg1; T2 _arg2; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return _func(std::move(_arg1), std::move(_arg2), std::move(param1), std::move(param2), std::move(param3)); } public: @@ -655,7 +655,7 @@ class Closure3_3 : public Closure3<P1, P2, P3, R> { T2 _arg2; T3 _arg3; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(param1), std::move(param2), std::move(param3)); } public: @@ -674,7 +674,7 @@ class Closure3_4 : public Closure3<P1, P2, P3, R> { T3 _arg3; T4 _arg4; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4), std::move(param1), std::move(param2), std::move(param3)); } public: @@ -692,7 +692,7 @@ class MemberClosure3_0 : public Closure3<P1, P2, P3, R> { Ptr _ptr; MemFun _mem_fun; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return ((*_ptr).*_mem_fun)(std::move(param1), std::move(param2), std::move(param3)); } public: @@ -709,7 +709,7 @@ class MemberClosure3_1 : public Closure3<P1, P2, P3, R> { MemFun _mem_fun; T1 _arg1; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(param1), std::move(param2), std::move(param3)); } public: @@ -727,7 +727,7 @@ class MemberClosure3_2 : public Closure3<P1, P2, P3, R> { T1 _arg1; T2 _arg2; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(param1), std::move(param2), std::move(param3)); } public: @@ -746,7 +746,7 @@ class MemberClosure3_3 : public Closure3<P1, P2, P3, R> { T2 _arg2; T3 _arg3; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(param1), std::move(param2), std::move(param3)); } public: @@ -766,7 +766,7 @@ class MemberClosure3_4 : public Closure3<P1, P2, P3, R> { T3 _arg3; T4 _arg4; - virtual R call(P1 param1, P2 param2, P3 param3) + virtual R call(P1 param1, P2 param2, P3 param3) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4), std::move(param1), std::move(param2), std::move(param3)); } public: @@ -783,7 +783,7 @@ class Closure4_0 : public Closure4<P1, P2, P3, P4, R> { Func _func; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return _func(std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -799,7 +799,7 @@ class Closure4_1 : public Closure4<P1, P2, P3, P4, R> { Func _func; T1 _arg1; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return _func(std::move(_arg1), std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -816,7 +816,7 @@ class Closure4_2 : public Closure4<P1, P2, P3, P4, R> { T1 _arg1; T2 _arg2; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return _func(std::move(_arg1), std::move(_arg2), std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -834,7 +834,7 @@ class Closure4_3 : public Closure4<P1, P2, P3, P4, R> { T2 _arg2; T3 _arg3; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -853,7 +853,7 @@ class Closure4_4 : public Closure4<P1, P2, P3, P4, R> { T3 _arg3; T4 _arg4; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return _func(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4), std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -871,7 +871,7 @@ class MemberClosure4_0 : public Closure4<P1, P2, P3, P4, R> { Ptr _ptr; MemFun _mem_fun; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return ((*_ptr).*_mem_fun)(std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -888,7 +888,7 @@ class MemberClosure4_1 : public Closure4<P1, P2, P3, P4, R> { MemFun _mem_fun; T1 _arg1; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -906,7 +906,7 @@ class MemberClosure4_2 : public Closure4<P1, P2, P3, P4, R> { T1 _arg1; T2 _arg2; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -925,7 +925,7 @@ class MemberClosure4_3 : public Closure4<P1, P2, P3, P4, R> { T2 _arg2; T3 _arg3; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: @@ -945,7 +945,7 @@ class MemberClosure4_4 : public Closure4<P1, P2, P3, P4, R> { T3 _arg3; T4 _arg4; - virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) + virtual R call(P1 param1, P2 param2, P3 param3, P4 param4) override { return ((*_ptr).*_mem_fun)(std::move(_arg1), std::move(_arg2), std::move(_arg3), std::move(_arg4), std::move(param1), std::move(param2), std::move(param3), std::move(param4)); } public: diff --git a/vespalog/src/logger/llreader.h b/vespalog/src/logger/llreader.h index 7519f99959f..27b39d23df7 100644 --- a/vespalog/src/logger/llreader.h +++ b/vespalog/src/logger/llreader.h @@ -15,7 +15,7 @@ public: MsgException(const MsgException &x) : std::exception(), _string(x._string) {} MsgException(const char *s) : _string(s) {} ~MsgException() throw() {} // nothing to do - const char *what() const throw() { return _string; } + const char *what() const throw() override { return _string; } }; diff --git a/vespalog/src/test/threads/testthreads.cpp b/vespalog/src/test/threads/testthreads.cpp index 6e5f72da524..515fa10c11f 100644 --- a/vespalog/src/test/threads/testthreads.cpp +++ b/vespalog/src/test/threads/testthreads.cpp @@ -15,7 +15,7 @@ class FileThread : public FastOS_Runnable string _file; public: FileThread(string file) : _done(false), _file(file) {} - virtual void Run(FastOS_ThreadInterface *thread, void *arg); + virtual void Run(FastOS_ThreadInterface *thread, void *arg) override; void stop() {_done = true; } }; @@ -25,7 +25,7 @@ class LoggerThread : public FastOS_Runnable public: bool _useLogBuffer; LoggerThread() : _done(false), _useLogBuffer(false) {} - virtual void Run(FastOS_ThreadInterface *thread, void *arg); + virtual void Run(FastOS_ThreadInterface *thread, void *arg) override; void stop() {_done = true; } }; @@ -74,7 +74,7 @@ LoggerThread::Run(FastOS_ThreadInterface *, void *) class ThreadTester : public FastOS_Application { public: - int Main(); + int Main() override; }; int diff --git a/vespamalloc/src/tests/allocfree/allocfree.cpp b/vespamalloc/src/tests/allocfree/allocfree.cpp index 7e81aaa9c1d..cdb471e35d2 100644 --- a/vespamalloc/src/tests/allocfree/allocfree.cpp +++ b/vespamalloc/src/tests/allocfree/allocfree.cpp @@ -19,7 +19,7 @@ public: FreeWorker(uint32_t maxQueue, bool inverse) : Consumer (maxQueue, inverse) {} private: - virtual void consume(void * p) { free(p); } + virtual void consume(void * p) override { free(p); } }; //----------------------------------------------------------------------------- @@ -30,7 +30,7 @@ public: : Producer(cnt, target), _size(size) {} private: uint32_t _size; - virtual void * produce() { return malloc(_size); } + virtual void * produce() override { return malloc(_size); } }; //----------------------------------------------------------------------------- @@ -41,8 +41,8 @@ public: : ProducerConsumer(cnt, inverse), _size(size) { } private: uint32_t _size; - virtual void * produce() { return malloc(_size); } - virtual void consume(void * p) { free(p); } + virtual void * produce() override { return malloc(_size); } + virtual void consume(void * p) override { free(p); } }; //----------------------------------------------------------------------------- diff --git a/vespamalloc/src/tests/allocfree/linklist.cpp b/vespamalloc/src/tests/allocfree/linklist.cpp index 9642c987899..06acfa8df8a 100644 --- a/vespamalloc/src/tests/allocfree/linklist.cpp +++ b/vespamalloc/src/tests/allocfree/linklist.cpp @@ -61,7 +61,7 @@ public: LinkIn(List::AtomicHeadPtr & list, uint32_t maxQueue, bool inverse); private: List::AtomicHeadPtr & _head; - virtual void consume(void * p) { + virtual void consume(void * p) override { List * l((List *) p); if ( ! ((l >= &globalList[0]) && (l < &globalList[NumBlocks]))) { abort(); } List::linkIn(_head, l, l); @@ -82,7 +82,7 @@ public: : Producer(cnt, target), _head(list) {} private: List::AtomicHeadPtr & _head; - virtual void * produce() { + virtual void * produce() override { void *p = List::linkOut(_head); List *l((List *)p); if ( ! ((l >= &globalList[0]) && (l < &globalList[NumBlocks]))) { abort(); } @@ -98,13 +98,13 @@ public: : ProducerConsumer(cnt, inverse), _head(list) { } private: List::AtomicHeadPtr & _head; - virtual void * produce() { + virtual void * produce() override { void *p = List::linkOut(_head); List *l((List *)p); if ( !((l >= &globalList[0]) && (l < &globalList[NumBlocks]))) { abort(); } return p; } - virtual void consume(void * p) { + virtual void consume(void * p) override { List * l((List *) p); if ( !((l >= &globalList[0]) && (l < &globalList[NumBlocks]))) { abort(); } List::linkIn(_head, l, l); diff --git a/vespamalloc/src/tests/allocfree/producerconsumer.h b/vespamalloc/src/tests/allocfree/producerconsumer.h index c9b7be3258f..07edb4af9ab 100644 --- a/vespamalloc/src/tests/allocfree/producerconsumer.h +++ b/vespamalloc/src/tests/allocfree/producerconsumer.h @@ -22,7 +22,7 @@ public: virtual ~Consumer(); void enqueue(const MemList &mem) { _queue.enqueue(mem); } void close() { _queue.close(); } - void Run(FastOS_ThreadInterface *t, void *); + void Run(FastOS_ThreadInterface *t, void *) override; uint64_t operations() const { return _operations; } }; @@ -35,7 +35,7 @@ private: public: Producer(uint32_t cnt, Consumer &target); virtual ~Producer(); - void Run(FastOS_ThreadInterface *t, void *); + void Run(FastOS_ThreadInterface *t, void *) override; uint64_t operations() const { return _operations; } }; @@ -50,7 +50,7 @@ private: public: ProducerConsumer(uint32_t cnt, bool inverse); virtual ~ProducerConsumer(); - void Run(FastOS_ThreadInterface *t, void *); + void Run(FastOS_ThreadInterface *t, void *) override; uint64_t operationsConsumed() const { return _operationsConsumed; } uint64_t operationsProduced() const { return _operationsProduced; } }; diff --git a/vespamalloc/src/tests/doubledelete/expectsignal.cpp b/vespamalloc/src/tests/doubledelete/expectsignal.cpp index f1fb6eb5694..3237339fb97 100644 --- a/vespamalloc/src/tests/doubledelete/expectsignal.cpp +++ b/vespamalloc/src/tests/doubledelete/expectsignal.cpp @@ -7,9 +7,9 @@ using namespace vespalib; class Test : public TestApp { public: - int Main(); + int Main() override; private: - virtual bool useProcessStarter() const { return true; } + virtual bool useProcessStarter() const override { return true; } }; int Test::Main() diff --git a/vespamalloc/src/tests/overwrite/expectsignal.cpp b/vespamalloc/src/tests/overwrite/expectsignal.cpp index f1fb6eb5694..3237339fb97 100644 --- a/vespamalloc/src/tests/overwrite/expectsignal.cpp +++ b/vespamalloc/src/tests/overwrite/expectsignal.cpp @@ -7,9 +7,9 @@ using namespace vespalib; class Test : public TestApp { public: - int Main(); + int Main() override; private: - virtual bool useProcessStarter() const { return true; } + virtual bool useProcessStarter() const override { return true; } }; int Test::Main() diff --git a/vespamalloc/src/tests/overwrite/overwrite.cpp b/vespamalloc/src/tests/overwrite/overwrite.cpp index 8c35fe841fe..507e8d84c8c 100644 --- a/vespamalloc/src/tests/overwrite/overwrite.cpp +++ b/vespamalloc/src/tests/overwrite/overwrite.cpp @@ -6,7 +6,7 @@ using namespace vespalib; class Test : public TestApp { public: - int Main(); + int Main() override; ~Test(); private: void testFillValue(char *a); diff --git a/vespamalloc/src/tests/test.cpp b/vespamalloc/src/tests/test.cpp index d6208fdc240..9f5bd826a6b 100644 --- a/vespamalloc/src/tests/test.cpp +++ b/vespamalloc/src/tests/test.cpp @@ -26,7 +26,7 @@ void testdd() class Thread : public FastOS_Runnable { private: - void Run(FastOS_ThreadInterface * ti, void * arg); + void Run(FastOS_ThreadInterface * ti, void * arg) override; }; int main(int, char *[]) diff --git a/vespamalloc/src/tests/test1/testatomic.cpp b/vespamalloc/src/tests/test1/testatomic.cpp index 78d94429a3f..cf627e11c77 100644 --- a/vespamalloc/src/tests/test1/testatomic.cpp +++ b/vespamalloc/src/tests/test1/testatomic.cpp @@ -7,7 +7,7 @@ class Test : public vespalib::TestApp { public: - int Main(); + int Main() override; private: template<typename T> void testSwap(T initial); @@ -19,7 +19,7 @@ template <typename T> class Stress : public FastOS_Runnable { private: - void Run(FastOS_ThreadInterface * ti, void * arg); + void Run(FastOS_ThreadInterface * ti, void * arg) override; void stressSwap(T & value); public: Stress(T * value) : _value(value), _successCount(0), _failedCount(0) { } diff --git a/vespamalloc/src/tests/thread/racemanythreads.cpp b/vespamalloc/src/tests/thread/racemanythreads.cpp index ba5cc8b7a1c..8f366acea3a 100644 --- a/vespamalloc/src/tests/thread/racemanythreads.cpp +++ b/vespamalloc/src/tests/thread/racemanythreads.cpp @@ -19,7 +19,7 @@ class Test : public TestApp { public: ~Test(); - int Main(); + int Main() override; }; Test::~Test() diff --git a/vespamalloc/src/tests/thread/thread.cpp b/vespamalloc/src/tests/thread/thread.cpp index 49631c0f7e5..6261a0f8eb6 100644 --- a/vespamalloc/src/tests/thread/thread.cpp +++ b/vespamalloc/src/tests/thread/thread.cpp @@ -19,9 +19,9 @@ class Test : public TestApp { public: ~Test(); - int Main(); + int Main() override; private: - virtual bool useIPCHelper() const { return true; } + virtual bool useIPCHelper() const override { return true; } }; Test::~Test() diff --git a/vsm/src/tests/charbuffer/charbuffer.cpp b/vsm/src/tests/charbuffer/charbuffer.cpp index 4d4148b6426..e619e840910 100644 --- a/vsm/src/tests/charbuffer/charbuffer.cpp +++ b/vsm/src/tests/charbuffer/charbuffer.cpp @@ -10,7 +10,7 @@ class CharBufferTest : public vespalib::TestApp private: void test(); public: - int Main(); + int Main() override; }; void diff --git a/vsm/src/tests/docsum/docsum.cpp b/vsm/src/tests/docsum/docsum.cpp index 8a1697ab099..cb364c0b65e 100644 --- a/vsm/src/tests/docsum/docsum.cpp +++ b/vsm/src/tests/docsum/docsum.cpp @@ -29,14 +29,14 @@ private: public: TestDocument(const search::DocumentIdT & docId, size_t numFields) : vsm::Document(docId, numFields), _fields(numFields) {} - virtual bool setField(FieldIdT fId, document::FieldValue::UP fv) { + virtual bool setField(FieldIdT fId, document::FieldValue::UP fv) override { if (fId < _fields.size()) { _fields[fId].reset(fv.release()); return true; } return false; } - virtual const document::FieldValue * getField(FieldIdT fId) const { + virtual const document::FieldValue * getField(FieldIdT fId) const override { if (fId < _fields.size()) { return _fields[fId].get(); } @@ -68,7 +68,7 @@ private: void testDocSumCache(); public: - int Main(); + int Main() override; }; ArrayFieldValue diff --git a/vsm/src/tests/document/document.cpp b/vsm/src/tests/document/document.cpp index 12b321f7c80..35ca55826ba 100644 --- a/vsm/src/tests/document/document.cpp +++ b/vsm/src/tests/document/document.cpp @@ -16,7 +16,7 @@ private: void testStorageDocument(); void testStringFieldIdTMap(); public: - int Main(); + int Main() override; }; void diff --git a/vsm/src/tests/textutil/textutil.cpp b/vsm/src/tests/textutil/textutil.cpp index 154425e0deb..85aac8bab73 100644 --- a/vsm/src/tests/textutil/textutil.cpp +++ b/vsm/src/tests/textutil/textutil.cpp @@ -44,7 +44,7 @@ private: void test_sse2_foldua(); public: - int Main(); + int Main() override; }; ucs4_t diff --git a/vsm/src/vespa/vsm/searcher/floatfieldsearcher.h b/vsm/src/vespa/vsm/searcher/floatfieldsearcher.h index 79d8ffe65fe..b39e3a96a85 100644 --- a/vsm/src/vespa/vsm/searcher/floatfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/floatfieldsearcher.h @@ -11,8 +11,8 @@ class FloatFieldSearcherT : public FieldSearcher { public: FloatFieldSearcherT(FieldIdT fId=0); - virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf); - virtual void onValue(const document::FieldValue & fv); + virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; + virtual void onValue(const document::FieldValue & fv) override; protected: class FloatInfo { diff --git a/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h b/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h index 93550f51f3d..4eb7f6c79b8 100644 --- a/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h @@ -17,8 +17,8 @@ class FUTF8StrChrFieldSearcher : public UTF8StrChrFieldSearcher static bool lfoldaa(const char * toFold, size_t sz, char * folded, size_t & unalignedStart); static bool lfoldua(const char * toFold, size_t sz, char * folded, size_t & alignedStart); private: - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt); - virtual size_t matchTerms(const FieldRef&, const size_t shortestTerm); + virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; + virtual size_t matchTerms(const FieldRef&, const size_t shortestTerm) override; virtual size_t match(const char *folded, size_t sz, search::QueryTerm & qt); size_t match(const char *folded, size_t sz, size_t mintsz, search::QueryTerm ** qtl, size_t qtlSize); std::vector<char> _folded; diff --git a/vsm/src/vespa/vsm/searcher/intfieldsearcher.h b/vsm/src/vespa/vsm/searcher/intfieldsearcher.h index 42e3c1557f5..f023c5b39f2 100644 --- a/vsm/src/vespa/vsm/searcher/intfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/intfieldsearcher.h @@ -11,8 +11,8 @@ class IntFieldSearcher : public FieldSearcher public: DUPLICATE(IntFieldSearcher); IntFieldSearcher(FieldIdT fId=0); - virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf); - virtual void onValue(const document::FieldValue & fv); + virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; + virtual void onValue(const document::FieldValue & fv) override; protected: class IntInfo { diff --git a/vsm/src/vespa/vsm/searcher/strchrfieldsearcher.h b/vsm/src/vespa/vsm/searcher/strchrfieldsearcher.h index 3446fffd821..a7c4cbcce7a 100644 --- a/vsm/src/vespa/vsm/searcher/strchrfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/strchrfieldsearcher.h @@ -11,8 +11,8 @@ class StrChrFieldSearcher : public FieldSearcher public: StrChrFieldSearcher() : FieldSearcher(0) { } StrChrFieldSearcher(FieldIdT fId) : FieldSearcher(fId) { } - virtual void onValue(const document::FieldValue & fv); - virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf); + virtual void onValue(const document::FieldValue & fv) override; + virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; private: size_t shortestTerm() const; bool matchDoc(const FieldRef & field); diff --git a/vsm/src/vespa/vsm/searcher/utf8exactstringfieldsearcher.h b/vsm/src/vespa/vsm/searcher/utf8exactstringfieldsearcher.h index 1fa1a23a938..8c92b0b281d 100644 --- a/vsm/src/vespa/vsm/searcher/utf8exactstringfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/utf8exactstringfieldsearcher.h @@ -12,8 +12,8 @@ namespace vsm class UTF8ExactStringFieldSearcher : public UTF8StringFieldSearcherBase { protected: - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt); - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm); + virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; + virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; public: DUPLICATE(UTF8ExactStringFieldSearcher); diff --git a/vsm/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.h b/vsm/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.h index 677e9e48ba6..730c7bcdb83 100644 --- a/vsm/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.h @@ -17,13 +17,13 @@ private: * Tries to match the given query term against the content of the given field reference. * Search strategy is choosen based on the query term type. **/ - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt); + virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; /** * Tries to match each query term in the underlying query against the content of the given field reference. * Search strategy is choosen based on the query term type. **/ - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm); + virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; public: DUPLICATE(UTF8FlexibleStringFieldSearcher); diff --git a/vsm/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h b/vsm/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h index de49483524d..f6ba0d76e96 100644 --- a/vsm/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h @@ -17,8 +17,8 @@ public: UTF8StrChrFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } protected: - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt); - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm); + virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; + virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; }; } diff --git a/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h b/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h index a734e6356c3..c77c8b7d824 100644 --- a/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h +++ b/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h @@ -24,8 +24,8 @@ private: const char * _readPtr; // buffer to read from (field reference) char _unitSep; // the unit separator character to use - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt); - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm); + virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; + virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; /** * Copies n bytes from the field reference to the modified buffer and updates the read pointer. diff --git a/vsm/src/vespa/vsm/searcher/utf8suffixstringfieldsearcher.h b/vsm/src/vespa/vsm/searcher/utf8suffixstringfieldsearcher.h index 5fafa027985..d66df1248d0 100644 --- a/vsm/src/vespa/vsm/searcher/utf8suffixstringfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/utf8suffixstringfieldsearcher.h @@ -12,8 +12,8 @@ namespace vsm class UTF8SuffixStringFieldSearcher : public UTF8StringFieldSearcherBase { protected: - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt); - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm); + virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; + virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; public: DUPLICATE(UTF8SuffixStringFieldSearcher); |