diff options
48 files changed, 227 insertions, 476 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java index ff8d3211d47..e34d490afe1 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/DomAdminV4Builder.java @@ -28,6 +28,7 @@ import java.util.stream.Collectors; * @author bratseth */ public class DomAdminV4Builder extends DomAdminBuilderBase { + private ApplicationId ZONE_APPLICATION_ID = ApplicationId.from("hosted-vespa", "routing", "default"); private final Collection<ContainerModel> containerModels; diff --git a/configd/src/apps/sentinel/metrics.cpp b/configd/src/apps/sentinel/metrics.cpp index df1b0076001..812ab56cd15 100644 --- a/configd/src/apps/sentinel/metrics.cpp +++ b/configd/src/apps/sentinel/metrics.cpp @@ -1,13 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "metrics.h" -#include <vespa/log/log.h> -LOG_SETUP(".metrics"); - #include <vespa/vespalib/metrics/simple_metrics.h> -namespace config { -namespace sentinel { +namespace config::sentinel { using vespalib::metrics::SimpleMetricsManager; using vespalib::metrics::SimpleManagerConfig; @@ -17,9 +13,7 @@ StartMetrics::StartMetrics() producer(metrics), currentlyRunningServices(0), totalRestartsCounter(0), - totalRestartsLastPeriod(1), startedTime(time(nullptr)), - lastLoggedTime(startedTime - 55), sentinel_restarts(metrics->counter("sentinel.restarts", "how many times sentinel restarted a service")), sentinel_totalRestarts(metrics->gauge("sentinel.totalRestarts", @@ -33,20 +27,7 @@ StartMetrics::StartMetrics() sentinel_restarts.add(); } -void -StartMetrics::output() -{ - EV_VALUE("currently_running_services", currentlyRunningServices); - EV_VALUE("total_restarts_last_period", totalRestartsLastPeriod); - EV_COUNT("total_restarts_counter", totalRestartsCounter); -} - -void -StartMetrics::reset(unsigned long curTime) -{ - totalRestartsLastPeriod = 0; - lastLoggedTime = curTime; -} +StartMetrics::~StartMetrics() = default; void StartMetrics::maybeLog() @@ -55,11 +36,6 @@ StartMetrics::maybeLog() sentinel_totalRestarts.sample(totalRestartsCounter); sentinel_running.sample(currentlyRunningServices); sentinel_uptime.sample(curTime - startedTime); - if (curTime > lastLoggedTime + 59) { - output(); - reset(curTime); - } } -} // end namespace config::sentinel -} // end namespace config +} diff --git a/configd/src/apps/sentinel/metrics.h b/configd/src/apps/sentinel/metrics.h index 2378a055663..2263d70fb60 100644 --- a/configd/src/apps/sentinel/metrics.h +++ b/configd/src/apps/sentinel/metrics.h @@ -15,19 +15,15 @@ struct StartMetrics { vespalib::metrics::Producer producer; unsigned long currentlyRunningServices; unsigned long totalRestartsCounter; - unsigned long totalRestartsLastPeriod; long startedTime; - long lastLoggedTime; Counter sentinel_restarts; Gauge sentinel_totalRestarts; Gauge sentinel_running; Gauge sentinel_uptime; StartMetrics(); - ~StartMetrics() {} + ~StartMetrics(); - void output(); - void reset(unsigned long curTime); void maybeLog(); }; diff --git a/configd/src/apps/sentinel/service.cpp b/configd/src/apps/sentinel/service.cpp index e38328975dc..866171bf75f 100644 --- a/configd/src/apps/sentinel/service.cpp +++ b/configd/src/apps/sentinel/service.cpp @@ -336,7 +336,6 @@ Service::youExited(int status) LOG(debug, "%s: Has autorestart flag, restarting.", name().c_str()); setState(READY); _metrics.totalRestartsCounter++; - _metrics.totalRestartsLastPeriod++; _metrics.sentinel_restarts.add(); start(); } diff --git a/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java b/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java index ecebcca6f95..131d4fcc9da 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/WeightedSetItem.java @@ -44,6 +44,7 @@ public class WeightedSetItem extends SimpleTaggableItem { public Integer addToken(long value, int weight) { return addInternal(value, weight); } + /** * Add weighted token. * If token is already in the set, the maximum weight is kept. @@ -54,6 +55,7 @@ public class WeightedSetItem extends SimpleTaggableItem { if (token == null) throw new IllegalArgumentException("token must be a string"); return addInternal(token, weight); } + private Integer addInternal(Object token, int weight) { Integer newWeight = weight; Integer oldWeight = set.put(token, newWeight); @@ -172,4 +174,5 @@ public class WeightedSetItem extends SimpleTaggableItem { clone.set = this.set.clone(); return clone; } + } diff --git a/container-search/src/main/java/com/yahoo/search/querytransform/LowercasingSearcher.java b/container-search/src/main/java/com/yahoo/search/querytransform/LowercasingSearcher.java index 58486c98dbd..26c52a24e5c 100644 --- a/container-search/src/main/java/com/yahoo/search/querytransform/LowercasingSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/querytransform/LowercasingSearcher.java @@ -91,7 +91,7 @@ public abstract class LowercasingSearcher extends Searcher { } private void lowerCase(WeightedSetItem set, IndexFacts.Session indexFacts) { - if (!syntheticLowerCaseCheck(set.getIndexName(), indexFacts, true)) { + if ( ! syntheticLowerCaseCheck(set.getIndexName(), indexFacts, true)) { return; } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java index e51814e44f8..d166bb0d3fb 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/Node.java @@ -50,14 +50,6 @@ public class Node { this.wantedRebootGeneration = wantedRebootGeneration; } - // TODO: Remove once internal code supports new constructor - public Node(HostName hostname, State state, NodeType type, Optional<ApplicationId> owner, - Version currentVersion, Version wantedVersion, ServiceState serviceState, - long restartGeneration, long wantedRestartGeneration, long rebootGeneration, long wantedRebootGeneration) { - this(hostname, state, type, owner, currentVersion, wantedVersion, Version.emptyVersion, Version.emptyVersion, - serviceState, restartGeneration, wantedRestartGeneration, rebootGeneration, wantedRebootGeneration); - } - @TestOnly public Node(HostName hostname, State state, NodeType type, Optional<ApplicationId> owner, Version currentVersion, Version wantedVersion) { diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java index 92d07edaca8..b0acea188d0 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java @@ -31,8 +31,6 @@ public interface NodeRepository { void upgrade(ZoneId zone, NodeType type, Version version); /** Upgrade OS for all nodes of given type to a new version */ - default void upgradeOs(ZoneId zone, NodeType type, Version version) { - // TODO: Remove default implementation once implemented in internal code - } + void upgradeOs(ZoneId zone, NodeType type, Version version); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/CloudName.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/CloudName.java new file mode 100644 index 00000000000..e7a6b32b36e --- /dev/null +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/CloudName.java @@ -0,0 +1,62 @@ +// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.hosted.controller.api.integration.zone; + +import org.jetbrains.annotations.NotNull; + +import java.util.Objects; + +/** + * Represents a cloud provider used in a hosted Vespa system. + * + * @author mpolden + */ +public class CloudName implements Comparable<CloudName> { + + private final static CloudName defaultCloud = from("default"); + + private final String cloud; + + private CloudName(String cloud) { + this.cloud = cloud; + } + + public String value() { + return cloud; + } + + public boolean isDefault() { + return defaultName().equals(this); + } + + public static CloudName defaultName() { + return defaultCloud; + } + + public static CloudName from(String cloud) { + return new CloudName(cloud); + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CloudName cloudName = (CloudName) o; + return Objects.equals(cloud, cloudName.cloud); + } + + @Override + public int hashCode() { + return Objects.hash(cloud); + } + + @Override + public String toString() { + return cloud; + } + + @Override + public int compareTo(@NotNull CloudName o) { + return cloud.compareTo(o.cloud); + } + +} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilterMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilterMock.java index 67d2fd14e6b..10cf862fa30 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilterMock.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneFilterMock.java @@ -9,20 +9,21 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; +import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; /** - * A Zones.List implementation which assumes all zones are controllerManaged. + * A ZoneList implementation which assumes all zones are controllerManaged. * * @author jonmv */ public class ZoneFilterMock implements ZoneList { - private final java.util.List<ZoneId> zones; + private final List<ZoneId> zones; private final boolean negate; - private ZoneFilterMock(java.util.List<ZoneId> zones, boolean negate) { + private ZoneFilterMock(List<ZoneId> zones, boolean negate) { this.negate = negate; this.zones = zones; } @@ -67,7 +68,7 @@ public class ZoneFilterMock implements ZoneList { } @Override - public java.util.List<ZoneId> ids() { + public List<ZoneId> ids() { return Collections.unmodifiableList(zones); } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneId.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneId.java index b53b81398c6..c98f6da3f29 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneId.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneId.java @@ -18,10 +18,16 @@ public class ZoneId { private final Environment environment; private final RegionName region; + private final CloudName cloud; - private ZoneId(Environment environment, RegionName region) { + private ZoneId(Environment environment, RegionName region, CloudName cloud) { this.environment = Objects.requireNonNull(environment); this.region = Objects.requireNonNull(region); + this.cloud = cloud; + } + + private ZoneId(Environment environment, RegionName region) { + this(environment, region, CloudName.defaultName()); } public static ZoneId from(Environment environment, RegionName region) { @@ -31,12 +37,21 @@ public class ZoneId { public static ZoneId from(String environment, String region) { return from(Environment.from(environment), RegionName.from(region)); } + /** Create from a serialised ZoneId. Inverse of {@code ZoneId.value()}. */ public static ZoneId from(String value) { String[] parts = value.split("\\."); return from(parts[0], parts[1]); } + public static ZoneId from(Environment environment, RegionName region, CloudName cloud) { + return new ZoneId(environment, region, cloud); + } + + public static ZoneId from(String environment, String region, String cloud) { + return new ZoneId(Environment.from(environment), RegionName.from(region), CloudName.from(cloud)); + } + public Environment environment() { return environment; } @@ -45,6 +60,10 @@ public class ZoneId { return region; } + public CloudName cloud() { + return cloud; + } + /** Returns the serialised value of this. Inverse of {@code ZoneId.from(String value)}. */ public String value() { return environment + "." + region; @@ -52,21 +71,22 @@ public class ZoneId { @Override public String toString() { - return "zone " + value(); + return "zone " + value() + " in " + cloud; } @Override public boolean equals(Object o) { if (this == o) return true; - if ( ! (o instanceof ZoneId)) return false; - ZoneId id = (ZoneId) o; - return environment == id.environment && - Objects.equals(region, id.region); + if (o == null || getClass() != o.getClass()) return false; + ZoneId zoneId = (ZoneId) o; + return environment == zoneId.environment && + Objects.equals(region, zoneId.region) && + Objects.equals(cloud, zoneId.cloud); } @Override public int hashCode() { - return Objects.hash(environment, region); + return Objects.hash(environment, region, cloud); } } diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java index f721564c80e..4fbad88df8d 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/zone/ZoneRegistry.java @@ -53,9 +53,14 @@ public interface ZoneRegistry { UpgradePolicy upgradePolicy(); /** Returns the OS upgrade policy to use for zones in this registry */ - // TODO: Remove default once internal code implements this + // TODO: Remove default UpgradePolicy osUpgradePolicy() { return upgradePolicy(); } + /** Returns the OS upgrade policy to use for zones belonging to given cloud, in this registry */ + default UpgradePolicy osUpgradePolicy(CloudName cloud) { + return osUpgradePolicy(); // TODO: Remove default implementation + } + } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java index 9711c1d8533..39b81baa023 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java @@ -114,7 +114,7 @@ public class InternalStepRunner implements StepRunner { return Optional.empty(); } catch (RuntimeException e) { - logger.log(INFO, "Unexpected exception running " + id + ": " + Exceptions.toMessageString(e)); + logger.log(INFO, "Unexpected exception running " + id, e); if (JobProfile.of(id.type()).alwaysRun().contains(step.get())) { logger.log("Will keep trying, as this is a cleanup step."); return Optional.empty(); @@ -524,6 +524,8 @@ public class InternalStepRunner implements StepRunner { String timestamp = timestampFormat.format(new Date(record.getMillis())); for (String line : record.getMessage().split("\n")) out.println(timestamp + ": " + line); + if (record.getThrown() != null) + record.getThrown().printStackTrace(out); record.setSourceClassName(null); // Makes the root logger's ConsoleHandler use the logger name instead, when printing. getParent().log(record); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java index 671bab9aae6..1ec64e1b3d6 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/Versions.java @@ -9,6 +9,7 @@ import com.yahoo.vespa.hosted.controller.application.Change; import com.yahoo.vespa.hosted.controller.application.Deployment; import com.yahoo.vespa.hosted.controller.application.JobStatus; +import java.util.Objects; import java.util.Optional; import static java.util.Objects.requireNonNull; @@ -71,6 +72,22 @@ public class Versions { } @Override + public boolean equals(Object o) { + if (this == o) return true; + if ( ! (o instanceof Versions)) return false; + Versions versions = (Versions) o; + return Objects.equals(targetPlatform, versions.targetPlatform) && + Objects.equals(targetApplication, versions.targetApplication) && + Objects.equals(sourcePlatform, versions.sourcePlatform) && + Objects.equals(sourceApplication, versions.sourceApplication); + } + + @Override + public int hashCode() { + return Objects.hash(targetPlatform, targetApplication, sourcePlatform, sourceApplication); + } + + @Override public String toString() { return String.format("platform %s%s, application %s%s", sourcePlatform.filter(source -> !source.equals(targetPlatform)) diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializer.java index a71e6a393ac..47a690459a8 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializer.java @@ -111,10 +111,10 @@ class RunSerializer { ? Optional.of(Version.fromString(versionsObject.field(sourceField).field(platformVersionField).asString())) : Optional.empty(); Optional<ApplicationVersion> sourceApplicationVersion = versionsObject.field(sourceField).valid() - ? Optional.of(ApplicationVersion.from(new SourceRevision(versionsObject.field(repositoryField).asString(), - versionsObject.field(branchField).asString(), - versionsObject.field(commitField).asString()), - versionsObject.field(buildField).asLong())) + ? Optional.of(ApplicationVersion.from(new SourceRevision(versionsObject.field(sourceField).field(repositoryField).asString(), + versionsObject.field(sourceField).field(branchField).asString(), + versionsObject.field(sourceField).field(commitField).asString()), + versionsObject.field(sourceField).field(buildField).asLong())) : Optional.empty(); return new Versions(targetPlatformVersion, targetApplicationVersion, sourcePlatformVersion, sourceApplicationVersion); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java index 10537f42c0b..a1fa4c1cd29 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/RunSerializerTest.java @@ -1,10 +1,13 @@ package com.yahoo.vespa.hosted.controller.persistence; import com.google.common.collect.ImmutableMap; +import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; import com.yahoo.vespa.config.SlimeUtils; import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobType; import com.yahoo.vespa.hosted.controller.api.integration.deployment.RunId; +import com.yahoo.vespa.hosted.controller.application.ApplicationVersion; +import com.yahoo.vespa.hosted.controller.application.SourceRevision; import com.yahoo.vespa.hosted.controller.deployment.Run; import com.yahoo.vespa.hosted.controller.deployment.RunStatus; import com.yahoo.vespa.hosted.controller.deployment.Step; @@ -67,6 +70,18 @@ public class RunSerializerTest { assertFalse(run.hasEnded()); assertEquals(running, run.status()); assertEquals(3, run.lastTestRecord()); + assertEquals(new Version(1, 2, 3), run.versions().targetPlatform()); + assertEquals(ApplicationVersion.from(new SourceRevision("git@github.com:user/repo.git", + "master", + "f00bad"), + 123), + run.versions().targetApplication()); + assertEquals(new Version(1, 2, 2), run.versions().sourcePlatform().get()); + assertEquals(ApplicationVersion.from(new SourceRevision("git@github.com:user/repo.git", + "master", + "badb17"), + 122), + run.versions().sourceApplication().get()); assertEquals(ImmutableMap.<Step, Step.Status>builder() .put(deployInitialReal, unfinished) .put(installInitialReal, failed) @@ -91,6 +106,8 @@ public class RunSerializerTest { assertEquals(run.start(), phoenix.start()); assertEquals(run.end(), phoenix.end()); assertEquals(run.status(), phoenix.status()); + assertEquals(run.lastTestRecord(), phoenix.lastTestRecord()); + assertEquals(run.versions(), phoenix.versions()); assertEquals(run.steps(), phoenix.steps()); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json index 0e0149897fc..ceeef722e90 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/testdata/run-status.json @@ -26,7 +26,7 @@ "commit": "f00bad", "build": 123, "source": { - "platform": "1.2.3", + "platform": "1.2.2", "repository": "git@github.com:user/repo.git", "branch": "master", "commit": "badb17", diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java index f0cb7ca645d..9e8dfad82c1 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/JobControllerApiHandlerHelperTest.java @@ -161,7 +161,7 @@ public class JobControllerApiHandlerHelperTest { private void assertFile(HttpResponse response, String resourceName) { try { - Path path = Paths.get(getClass().getClassLoader().getResource(resourceName).getPath()); + Path path = Paths.get("src/test/resources/").resolve(resourceName); String expected = new String(Files.readAllBytes(path)); compare(response, expected); } catch (Exception e) { 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 9a94946981f..1fe2719d2a0 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 @@ -159,7 +159,7 @@ public class StorageMaintainer { private SecretAgentCheckConfig annotatedCheck(NodeSpec node, SecretAgentCheckConfig check) { check.withTag("namespace", "Vespa") - .withTag("role", "tenants") + .withTag("role", SecretAgentCheckConfig.nodeTypeToRole(node.getNodeType())) .withTag("flavor", node.getFlavor()) .withTag("canonicalFlavor", node.getCanonicalFlavor()) .withTag("state", node.getState().toString()) diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java index 50e325c2149..09c6891612e 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/util/SecretAgentCheckConfig.java @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.node.admin.util; +import com.yahoo.config.provision.NodeType; import com.yahoo.vespa.hosted.node.admin.task.util.file.FileWriter; import java.io.IOException; @@ -74,4 +75,17 @@ public class SecretAgentCheckConfig { return stringBuilder.toString(); } + + // TODO: Change role dimension to nodeType? + public static String nodeTypeToRole(NodeType nodeType) { + switch (nodeType) { + case tenant: return "tenants"; + case host: return "docker"; + case proxy: return "routing"; + case proxyhost: return "routinghost"; + case config: return "configserver"; + case confighost: return "configserverhost"; + default: throw new IllegalArgumentException("Unknown node type " + nodeType); + } + } } diff --git a/parent/pom.xml b/parent/pom.xml index 3badece1f86..c7e0f490905 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -150,6 +150,8 @@ <artifactId>maven-javadoc-plugin</artifactId> <configuration> <doclint>${doclint},-missing</doclint> + <quiet>true</quiet> + <show>protected</show> </configuration> <version>3.0.1</version> </plugin> @@ -270,6 +272,7 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <configuration> + <quiet>true</quiet> <!-- Avoid javadoc warning ".. not specified the version of HTML .." --> <additionalJOption>-html4</additionalJOption> </configuration> @@ -327,7 +330,8 @@ <doclint>${doclint},-missing</doclint> <failOnError>${javadoc.failOnError}</failOnError> <quiet>true</quiet> - <show>private</show> + <show>protected</show> + <header><a href="https://docs.vespa.ai"><img src="https://docs.vespa.ai/img/vespa-logo.png" width="100" height="28" style="padding-top:7px"/></a></header> </configuration> </plugin> </plugins> diff --git a/processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java b/processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java index 75b5e4d8a22..eac96e9b408 100644 --- a/processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java +++ b/processing/src/main/java/com/yahoo/processing/execution/AsyncExecution.java @@ -15,7 +15,7 @@ import java.util.List; import java.util.concurrent.*; /** - * Provides asynchronous execution of processing chains. Usage: + * <p>Provides asynchronous execution of processing chains. Usage:</p> * * <pre> * Execution execution = new Execution(chain); diff --git a/searchcommon/src/vespa/searchcommon/attribute/basictype.h b/searchcommon/src/vespa/searchcommon/attribute/basictype.h index 3a2a319afd8..5bc51cdbea8 100644 --- a/searchcommon/src/vespa/searchcommon/attribute/basictype.h +++ b/searchcommon/src/vespa/searchcommon/attribute/basictype.h @@ -27,13 +27,10 @@ class BasicType MAX_TYPE }; - explicit - BasicType(int t) : _type(Type(t)) { } - explicit - BasicType(unsigned int t) : _type(Type(t)) { } + explicit BasicType(int t) : _type(Type(t)) { } + explicit BasicType(unsigned int t) : _type(Type(t)) { } BasicType(Type t) : _type(t) { } - explicit - BasicType(const vespalib::string & t) : _type(asType(t)) { } + explicit BasicType(const vespalib::string & t) : _type(asType(t)) { } Type type() const { return _type; } const char * asString() const { return asString(_type); } diff --git a/searchcore/src/apps/fdispatch/fdispatch.cpp b/searchcore/src/apps/fdispatch/fdispatch.cpp index 97cfdcb408c..cd3ef3b7550 100644 --- a/searchcore/src/apps/fdispatch/fdispatch.cpp +++ b/searchcore/src/apps/fdispatch/fdispatch.cpp @@ -1,7 +1,6 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/searchcore/fdispatch/program/fdispatch.h> -#include <vespa/searchcore/fdispatch/common/perftask.h> #include <vespa/vespalib/net/state_server.h> #include <vespa/vespalib/net/simple_health_producer.h> #include <vespa/vespalib/net/simple_metrics_producer.h> @@ -96,7 +95,6 @@ FastS_FDispatchApp::Main() vespalib::SimpleHealthProducer health; vespalib::SimpleMetricsProducer metrics; vespalib::StateServer stateServer(myfdispatch->getHealthPort(), health, metrics, myfdispatch->getComponentConfig()); - FastS_PerfTask perfTask(*myfdispatch, 300.0); while (!CheckShutdownFlags()) { if (myfdispatch->Failed()) { throw std::runtime_error("myfdispatch->Failed()"); diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/CMakeLists.txt b/searchcore/src/vespa/searchcore/fdispatch/common/CMakeLists.txt index 7a91efcd2ec..45261162e93 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/common/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/fdispatch/common/CMakeLists.txt @@ -2,8 +2,6 @@ vespa_add_library(searchcore_fdcommon STATIC SOURCES appcontext.cpp - perftask.cpp - queryperf.cpp rpc.cpp search.cpp timestat.cpp diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp index 248babad316..78efc1f7429 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.cpp @@ -28,53 +28,38 @@ FastS_AppContext::FastS_AppContext() _createTime = _timeKeeper.GetTime(); } - -FastS_AppContext::~FastS_AppContext() -{ -} - +FastS_AppContext::~FastS_AppContext() = default; FNET_Transport * FastS_AppContext::GetFNETTransport() { - return NULL; + return nullptr; } - FNET_Scheduler * FastS_AppContext::GetFNETScheduler() { - return NULL; + return nullptr; } - FastS_NodeManager * FastS_AppContext::GetNodeManager() { - return NULL; + return nullptr; } - FastS_DataSetCollection * FastS_AppContext::GetDataSetCollection() { - return NULL; + return nullptr; } - FastOS_ThreadPool * FastS_AppContext::GetThreadPool() { - return NULL; -} - - -void -FastS_AppContext::logPerformance() -{ + return nullptr; } - uint32_t FastS_AppContext::getDispatchLevel() { diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h index 7a5652577a0..fce468b4532 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h +++ b/searchcore/src/vespa/searchcore/fdispatch/common/appcontext.h @@ -41,7 +41,6 @@ public: virtual FNET_Scheduler *GetFNETScheduler(); virtual FastS_DataSetCollection *GetDataSetCollection(); virtual FastOS_ThreadPool *GetThreadPool(); - virtual void logPerformance(); virtual uint32_t getDispatchLevel(); private: }; diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/perftask.cpp b/searchcore/src/vespa/searchcore/fdispatch/common/perftask.cpp deleted file mode 100644 index 17113285fab..00000000000 --- a/searchcore/src/vespa/searchcore/fdispatch/common/perftask.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "perftask.h" -#include "appcontext.h" - -#include <vespa/log/log.h> -LOG_SETUP(".perftask"); - -FastS_PerfTask::FastS_PerfTask(FastS_AppContext &ctx, double delay) - : FNET_Task(ctx.GetFNETScheduler()), - _ctx(ctx), - _delay(delay), - _valid(ctx.GetFNETScheduler() != NULL) -{ - if (_valid) { - ScheduleNow(); - } else { - LOG(warning, "Performance monitoring disabled; " - "no scheduler found in application context"); - } -} - - -FastS_PerfTask::~FastS_PerfTask() -{ - if (_valid) { - Kill(); - } -} - - -void -FastS_PerfTask::PerformTask() -{ - Schedule(_delay); - _ctx.logPerformance(); -} diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/perftask.h b/searchcore/src/vespa/searchcore/fdispatch/common/perftask.h deleted file mode 100644 index 09c3b9840ab..00000000000 --- a/searchcore/src/vespa/searchcore/fdispatch/common/perftask.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -#include <vespa/fnet/task.h> - -class FastS_AppContext; - -class FastS_PerfTask : public FNET_Task -{ -private: - FastS_AppContext &_ctx; - double _delay; - bool _valid; - - FastS_PerfTask(const FastS_PerfTask &); - FastS_PerfTask &operator=(const FastS_PerfTask &); - -public: - FastS_PerfTask(FastS_AppContext &ctx, double delay); - ~FastS_PerfTask(); - void PerformTask() override; - bool isValid() const { return _valid; } -}; - diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/queryperf.cpp b/searchcore/src/vespa/searchcore/fdispatch/common/queryperf.cpp deleted file mode 100644 index a0cc89d15c6..00000000000 --- a/searchcore/src/vespa/searchcore/fdispatch/common/queryperf.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "queryperf.h" - -#include <vespa/log/log.h> -LOG_SETUP(".queryperf"); - -namespace { - -struct MyLogTask : vespalib::Executor::Task { - uint32_t queueLen; - uint32_t activeCnt; - uint32_t queryCnt; - uint32_t dropCnt; - uint32_t timeoutCnt; - double avgQueryTime; - MyLogTask(uint32_t queueLen_in, - uint32_t activeCnt_in, - uint32_t queryCnt_in, - uint32_t dropCnt_in, - uint32_t timeoutCnt_in, - double avgQueryTime_in) - : queueLen(queueLen_in), - activeCnt(activeCnt_in), - queryCnt(queryCnt_in), - dropCnt(dropCnt_in), - timeoutCnt(timeoutCnt_in), - avgQueryTime(avgQueryTime_in) - { - } - void run() override { - EV_VALUE("queued_queries", queueLen); - EV_VALUE("active_queries", activeCnt); - EV_COUNT("queries", queryCnt); - EV_COUNT("dropped_queries", dropCnt); - EV_COUNT("timedout_queries", timeoutCnt); - if (avgQueryTime > 0.0) { - EV_VALUE("query_eval_time_avg_s", avgQueryTime); - } - } -}; - -} // namespace <unnamed> - -FastS_QueryPerf::FastS_QueryPerf() - : queueLen(0), - activeCnt(0), - queryCnt(0), - queryTime(0), - dropCnt(0), - timeoutCnt(0), - _lastQueryCnt(0), - _lastQueryTime(0.0) -{ -} - -void -FastS_QueryPerf::reset() -{ - queueLen = 0; - activeCnt = 0; - queryCnt = 0; - queryTime = 0; - dropCnt = 0; - timeoutCnt = 0; -} - -vespalib::Executor::Task::UP -FastS_QueryPerf::make_log_task() -{ - double avgQueryTime = 0.0; - if (queryCnt > _lastQueryCnt) { - avgQueryTime = (queryTime - _lastQueryTime) - / ((double)(queryCnt - _lastQueryCnt)); - } - _lastQueryCnt = queryCnt; - _lastQueryTime = queryTime; - return std::make_unique<MyLogTask>(queueLen, - activeCnt, - queryCnt, - dropCnt, - timeoutCnt, - avgQueryTime); -} diff --git a/searchcore/src/vespa/searchcore/fdispatch/common/queryperf.h b/searchcore/src/vespa/searchcore/fdispatch/common/queryperf.h deleted file mode 100644 index ee31a8e58b2..00000000000 --- a/searchcore/src/vespa/searchcore/fdispatch/common/queryperf.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -#include <cstdint> -#include <vespa/vespalib/util/executor.h> - -struct FastS_QueryPerf -{ - uint32_t queueLen; - uint32_t activeCnt; - uint32_t queryCnt; - double queryTime; - uint32_t dropCnt; - uint32_t timeoutCnt; - - FastS_QueryPerf(); - - /** - * reset all values except the cached 'old' values. This will - * prepare the object for reuse logging wise. - **/ - void reset(); - vespalib::Executor::Task::UP make_log_task(); - -private: - uint32_t _lastQueryCnt; - double _lastQueryTime; -}; - diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.cpp b/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.cpp index b68566c3c9b..93680a95d44 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.cpp @@ -389,13 +389,6 @@ Fdispatch::Init() return true; } - -void -Fdispatch::logPerformance() -{ - _nodeManager->logPerformance(_executor); -} - uint32_t Fdispatch::getDispatchLevel() { diff --git a/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h b/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h index 6cfb4bfb5a1..093308d68d2 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h +++ b/searchcore/src/vespa/searchcore/fdispatch/program/fdispatch.h @@ -96,7 +96,6 @@ public: 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(); bool Failed(); diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/dataset_base.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/dataset_base.cpp index 1b96a48d35b..519960bfad0 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/dataset_base.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/search/dataset_base.cpp @@ -248,14 +248,12 @@ FastS_DataSetBase::AbortQueryQueue_HasLock() } } - void FastS_DataSetBase::AddCost() { _totalrefcost += _unitrefcost; } - void FastS_DataSetBase::SubCost() { @@ -263,10 +261,8 @@ FastS_DataSetBase::SubCost() _totalrefcost -= _unitrefcost; } - void -FastS_DataSetBase::UpdateSearchTime(double tnow, - double elapsed, bool timedout) +FastS_DataSetBase::UpdateSearchTime(double tnow, double elapsed, bool timedout) { int slot; auto dsGuard(getDsGuard()); @@ -279,36 +275,18 @@ FastS_DataSetBase::UpdateSearchTime(double tnow, _total._normalTimeStat.Update(tnow, elapsed, timedout); } - void FastS_DataSetBase::UpdateEstimateCount() { ++_total._estimates; } - void FastS_DataSetBase::CountTimeout() { ++_total._nTimedOut; } - -void -FastS_DataSetBase::addPerformance(FastS_QueryPerf &qp) -{ - FastS_TimeStatTotals totals; - auto dsGuard(getDsGuard()); - _total._normalTimeStat.AddTotal(&totals); - qp.queueLen += _queryQueue.GetQueueLen(); - qp.activeCnt += _queryQueue.GetActiveQueries(); - qp.queryCnt += totals._totalCount; - qp.queryTime += totals._totalAccTime; - qp.dropCnt += _total._nOverload; - qp.timeoutCnt += _total._nTimedOut; -} - - ChildInfo FastS_DataSetBase::getChildInfo() const { diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/dataset_base.h b/searchcore/src/vespa/searchcore/fdispatch/search/dataset_base.h index 042e18bf96f..f4f69285e89 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/dataset_base.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/dataset_base.h @@ -20,7 +20,6 @@ class FastS_QueryResult; class FastS_PlainDataSet; class FastS_FNET_DataSet; class FastS_AppContext; -class FastS_QueryPerf; class FNET_Task; //--------------------------------------------------------------------------- @@ -220,13 +219,9 @@ public: FastS_TimeKeeper *timeKeeper, bool async) = 0; virtual void Free() = 0; - virtual void addPerformance(FastS_QueryPerf &qp); // typesafe down-cast //------------------- virtual FastS_PlainDataSet *GetPlainDataSet() { return nullptr; } virtual FastS_FNET_DataSet *GetFNETDataSet() { return nullptr; } }; - -//--------------------------------------------------------------------------- - diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp index 879009c384f..f2af03d4c52 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp +++ b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.cpp @@ -88,7 +88,6 @@ FastS_NodeManager::FastS_NodeManager(vespalib::SimpleComponentConfigProducer &co _mldDocStamp(0), _mldDocStampMin(0), _gencnt(0), - _queryPerf(), _fetcher(), _configUri(config::ConfigUri::createEmpty()), _lastPartMap(NULL), @@ -389,24 +388,6 @@ FastS_NodeManager::getChildInfo() return r; } - -void -FastS_NodeManager::logPerformance(vespalib::Executor &executor) -{ - _queryPerf.reset(); - FastS_DataSetCollection *dsc = GetDataSetCollection(); - - for (unsigned int i = 0; i < dsc->GetMaxNumDataSets(); i++) { - if (dsc->PeekDataSet(i) != NULL) { - dsc->PeekDataSet(i)->addPerformance(_queryPerf); - } - } - - dsc->subRef(); - executor.execute(_queryPerf.make_log_task()); -} - - void FastS_NodeManager::CheckEvents(FastS_TimeKeeper *timeKeeper) { diff --git a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h index 77d4482fba7..70dc80914f4 100644 --- a/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h +++ b/searchcore/src/vespa/searchcore/fdispatch/search/nodemanager.h @@ -5,7 +5,6 @@ #include "child_info.h" #include "configdesc.h" #include <vespa/config/helper/configfetcher.h> -#include <vespa/searchcore/fdispatch/common/queryperf.h> #include <vespa/vespalib/net/simple_component_config_producer.h> #include <vespa/config/subscription/configuri.h> #include <vespa/vespalib/util/executor.h> @@ -34,7 +33,6 @@ private: uint32_t _mldDocStampMin; // Bumped for global cache flush uint32_t _gencnt; - FastS_QueryPerf _queryPerf; std::unique_ptr<config::ConfigFetcher> _fetcher; @@ -89,12 +87,6 @@ public: ChildInfo getChildInfo(); void ShutdownConfig(); - /** - * log query performance. This method should only be invoked from - * the FNET thread. - **/ - void logPerformance(vespalib::Executor &executor); - void CheckEvents(FastS_TimeKeeper *timeKeeper); // invoked by FNET thread }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp index d8fc9557023..9be1156b154 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp @@ -8,8 +8,7 @@ using namespace search::fef; -namespace proton { -namespace matching { +namespace proton::matching { void IndexEnvironment::extractFields(const search::index::Schema &schema) @@ -17,29 +16,20 @@ 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); - FieldInfo fieldInfo(FieldType::ATTRIBUTE, - 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); - FieldInfo fieldInfo(FieldType::INDEX, - 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())) - { + if (indexproperties::IsFilterField::check(_properties, field.getName())) { fieldInfo.setFilter(true); } FieldNameMap::const_iterator itr = _fieldNames.find(field.getName()); if (itr != _fieldNames.end()) { // override the attribute field - FieldInfo shadow_field(fieldInfo.type(), - fieldInfo.collection(), - fieldInfo.name(), - itr->second); + FieldInfo shadow_field(fieldInfo.type(), fieldInfo.collection(), fieldInfo.name(), itr->second); shadow_field.set_data_type(fieldInfo.get_data_type()); shadow_field.addAttribute(); // tell ranking about the shadowed attribute _fields[itr->second] = shadow_field; @@ -48,19 +38,15 @@ IndexEnvironment::extractFields(const search::index::Schema &schema) } } for (const auto &attr : schema.getImportedAttributeFields()) { - FieldInfo field(FieldType::ATTRIBUTE, - 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 { - FieldInfo fieldInfo(FieldType::HIDDEN_ATTRIBUTE, - FieldInfo::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); @@ -85,9 +71,7 @@ IndexEnvironment::IndexEnvironment(const search::index::Schema &schema, _motivation(UNKNOWN), _constantValueRepo(constantValueRepo) { - _tableManager.addFactory( - search::fef::ITableFactory::SP( - new search::fef::FunctionTableFactory(256))); + _tableManager.addFactory(std::make_shared<search::fef::FunctionTableFactory>(256)); extractFields(schema); } @@ -124,38 +108,26 @@ IndexEnvironment::getFieldByName(const string &name) const } const search::fef::ITableManager & -IndexEnvironment::getTableManager() const -{ +IndexEnvironment::getTableManager() const { return _tableManager; } IIndexEnvironment::FeatureMotivation -IndexEnvironment::getFeatureMotivation() const -{ +IndexEnvironment::getFeatureMotivation() const { return _motivation; } void -IndexEnvironment::hintFeatureMotivation(FeatureMotivation motivation) const -{ +IndexEnvironment::hintFeatureMotivation(FeatureMotivation motivation) const { _motivation = motivation; } void -IndexEnvironment::hintFieldAccess(uint32_t fieldId) const -{ - (void) fieldId; -} +IndexEnvironment::hintFieldAccess(uint32_t ) const { } void -IndexEnvironment::hintAttributeAccess(const string &name) const -{ - (void) name; -} +IndexEnvironment::hintAttributeAccess(const string &) const { } -IndexEnvironment::~IndexEnvironment() -{ -} +IndexEnvironment::~IndexEnvironment() = default; -} // namespace matching -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h index 09ff1fef2ea..a17ef1677a5 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h +++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h @@ -10,8 +10,7 @@ #include <vespa/searchcommon/common/schema.h> #include <vespa/eval/eval/value_cache/constant_value.h> -namespace proton { -namespace matching { +namespace proton::matching { /** * Index environment implementation for the proton matching pipeline. @@ -47,40 +46,21 @@ public: const search::fef::Properties &props, const IConstantValueRepo &constantValueRepo); - // inherited from search::fef::IIndexEnvironment - virtual const search::fef::Properties &getProperties() const override; - - // inherited from search::fef::IIndexEnvironment - virtual uint32_t getNumFields() const override; - - // inherited from search::fef::IIndexEnvironment - virtual const search::fef::FieldInfo *getField(uint32_t id) const override; - - // inherited from search::fef::IIndexEnvironment - virtual const search::fef::FieldInfo * - getFieldByName(const string &name) const override; - - // inherited from search::fef::IIndexEnvironment - virtual const search::fef::ITableManager &getTableManager() const override; - - virtual FeatureMotivation getFeatureMotivation() const override; - - // inherited from search::fef::IIndexEnvironment - virtual void hintFeatureMotivation(FeatureMotivation motivation) const override; - - // inherited from search::fef::IIndexEnvironment - virtual void hintFieldAccess(uint32_t fieldId) const override; - - // inherited from search::fef::IIndexEnvironment - virtual void hintAttributeAccess(const string &name) const override; - - virtual vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override { + const search::fef::Properties &getProperties() const override; + uint32_t getNumFields() const override; + const search::fef::FieldInfo *getField(uint32_t id) const override; + const search::fef::FieldInfo *getFieldByName(const string &name) const override; + const search::fef::ITableManager &getTableManager() const override; + FeatureMotivation getFeatureMotivation() const override; + void hintFeatureMotivation(FeatureMotivation motivation) const override; + void hintFieldAccess(uint32_t fieldId) const override; + void hintAttributeAccess(const string &name) const override; + + vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override { return _constantValueRepo.getConstant(name); } - virtual ~IndexEnvironment(); + ~IndexEnvironment() override; }; -} // namespace matching -} // namespace proton - +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp index ec3f1c7223f..6bce05b6c26 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_master.cpp @@ -69,10 +69,9 @@ MatchMaster::match(const MatchParams ¶ms, std::vector<MatchThread::UP> threadState; std::vector<vespalib::Runnable*> targets; for (size_t i = 0; i < threadBundle.size(); ++i) { - IMatchLoopCommunicator &com = - (i == 0)? - static_cast<IMatchLoopCommunicator&>(timedCommunicator) : - static_cast<IMatchLoopCommunicator&>(communicator); + IMatchLoopCommunicator &com = (i == 0) + ? static_cast<IMatchLoopCommunicator&>(timedCommunicator) + : static_cast<IMatchLoopCommunicator&>(communicator); threadState.emplace_back(std::make_unique<MatchThread>(i, threadBundle.size(), params, matchToolsFactory, com, *scheduler, resultProcessor, mergeDirector, distributionKey)); @@ -101,10 +100,10 @@ MatchMaster::match(const MatchParams ¶ms, } FeatureSet::SP -MatchMaster::getFeatureSet(const MatchToolsFactory &matchToolsFactory, +MatchMaster::getFeatureSet(const MatchToolsFactory &mtf, const std::vector<uint32_t> &docs, bool summaryFeatures) { - MatchTools::UP matchTools = matchToolsFactory.createMatchTools(); + MatchTools::UP matchTools = mtf.createMatchTools(); if (summaryFeatures) { matchTools->setup_summary(); } else { @@ -118,7 +117,7 @@ MatchMaster::getFeatureSet(const MatchToolsFactory &matchToolsFactory, for (size_t i = 0; i < resolver.num_features(); ++i) { featureNames.emplace_back(resolver.name_of(i)); } - FeatureSet::SP retval(new FeatureSet(featureNames, docs.size())); + auto retval = std::make_shared<FeatureSet>(featureNames, docs.size()); if (docs.empty()) { return retval; } diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp index 1e22eec2d55..232f0bdba6c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp @@ -96,7 +96,7 @@ convertLidsToGids(DocsumReply &reply, const DocsumRequest &request) DocsumReply::UP createEmptyReply(const DocsumRequest & request) { - DocsumReply::UP reply(new DocsumReply()); + auto reply = std::make_unique<DocsumReply>(); for (size_t i = 0; i < request.hits.size(); ++i) { reply->docsums.push_back(DocsumReply::Docsum()); reply->docsums.back().gid = request.hits[i].gid; @@ -113,7 +113,7 @@ SearchView::SearchView(const ISummaryManager::ISummarySetup::SP & summarySetup, _matchView(matchView) { } -SearchView::~SearchView() {} +SearchView::~SearchView() = default; DocsumReply::UP SearchView::getDocsums(const DocsumRequest & req) diff --git a/searchlib/src/vespa/searchlib/queryeval/hitcollector.h b/searchlib/src/vespa/searchlib/queryeval/hitcollector.h index 4429d28d1a4..97beaa0fd55 100644 --- a/searchlib/src/vespa/searchlib/queryeval/hitcollector.h +++ b/searchlib/src/vespa/searchlib/queryeval/hitcollector.h @@ -141,6 +141,9 @@ private: VESPA_DLL_LOCAL void sortHitsByDocId(); public: + HitCollector(const HitCollector &) = delete; + HitCollector &operator=(const HitCollector &) = delete; + /** * Creates a hit collector used to store hits for doc ids in the * range [0, numDocs>. Doc id and rank score are stored for the n @@ -174,6 +177,8 @@ public: */ SortedHitSequence getSortedHitSequence(size_t max_hits); + const std::vector<Hit> & getReRankedHits() const { return _reRankedHits; } + /** * Re-ranks the given hits by invoking the score() method on the * given document scorer. The hits are sorted on doc id so that @@ -193,10 +198,6 @@ public: * @param default_value rank value to be used for results without rank value **/ std::unique_ptr<ResultSet> getResultSet(HitRank default_value = default_rank_value); - -private: - HitCollector(const HitCollector &); // Not implemented - HitCollector &operator=(const HitCollector &); // Not implemented }; } diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp index f9a82c8d20f..65bb682a389 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.cpp @@ -165,7 +165,6 @@ void TransLogServer::run() { FRT_RPCRequest *req(NULL); bool hasPacket(false); - logMetric(); do { for (req = NULL; (hasPacket = _reqQ.pop(req, 60000)) && (req != NULL); req = NULL) { bool immediate = true; @@ -199,22 +198,10 @@ void TransLogServer::run() req->Return(); } } - logMetric(); } while (running() && !(hasPacket && (req == NULL))); LOG(info, "TLS Stopped"); } -void TransLogServer::logMetric() const -{ - Guard domainGuard(_lock); - for (DomainList::const_iterator it(_domains.begin()), mt(_domains.end()); it != mt; it++) { - vespalib::string prefix("translogserver." + it->first + ".serialnum."); - EV_COUNT((prefix + "last").c_str(), it->second->end()); - EV_COUNT((prefix + "first").c_str(), it->second->begin()); - EV_VALUE((prefix + "numused").c_str(), it->second->size()); - } -} - DomainStats TransLogServer::getDomainStats() const { diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h index 9dcc17a4a1f..189be8c38d8 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserver.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserver.h @@ -67,7 +67,6 @@ private: void finiSession(FRT_RPCRequest *req); void downSession(FRT_RPCRequest *req); - void logMetric() const; std::vector<vespalib::string> getDomainNames(); Domain::SP findDomain(vespalib::stringref name); vespalib::string dir() const { return _baseDir + "/" + _name; } diff --git a/storage/src/vespa/storage/bucketmover/bucketmover.cpp b/storage/src/vespa/storage/bucketmover/bucketmover.cpp index b47b3b59b4f..904e8a66c27 100644 --- a/storage/src/vespa/storage/bucketmover/bucketmover.cpp +++ b/storage/src/vespa/storage/bucketmover/bucketmover.cpp @@ -6,7 +6,6 @@ #include <vespa/storage/common/bucketmessages.h> #include <vespa/storage/common/content_bucket_space_repo.h> #include <vespa/storage/common/nodestateupdater.h> -#include <vespa/storage/storageutil/log.h> #include <vespa/config/common/exceptions.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/document/bucket/fixed_bucket_spaces.h> diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp index d1f0a24178a..bf0244255c1 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp @@ -11,7 +11,6 @@ #include <vespa/storage/config/config-stor-server.h> #include <vespa/storage/persistence/bucketownershipnotifier.h> #include <vespa/storage/persistence/persistencethread.h> -#include <vespa/storage/storageutil/log.h> #include <vespa/storageapi/message/batch.h> #include <vespa/storageapi/message/bucketsplitting.h> #include <vespa/storageapi/message/state.h> diff --git a/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp b/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp index 01a84177e43..650637f206d 100644 --- a/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp +++ b/storage/src/vespa/storage/storageserver/bucketintegritychecker.cpp @@ -2,7 +2,6 @@ #include "bucketintegritychecker.h" #include <vespa/storage/common/bucketmessages.h> -#include <vespa/storage/storageutil/log.h> #include <vespa/storage/bucketdb/storbucketdb.h> #include <vespa/storageapi/message/state.h> #include <vespa/vdslib/distribution/distribution.h> diff --git a/storage/src/vespa/storage/storageutil/log.h b/storage/src/vespa/storage/storageutil/log.h deleted file mode 100644 index f7e89443b32..00000000000 --- a/storage/src/vespa/storage/storageutil/log.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once -#include <vespa/log/log.h> - -#define STORAGE_LOG_INTERVAL 30 - -#define STORAGE_LOG_COUNT(name, interval) do { \ - static uint64_t C_count ## name = 0; \ - static time_t C_last ## name = time(NULL); \ - C_count ## name ++; \ - time_t C_now ## name = time(NULL); \ - if (C_now ## name - C_last ## name >= interval) { \ - EV_COUNT(#name, C_count ## name); \ - C_last ## name = C_now ## name; \ - } } while (false) - -#define STORAGE_LOG_AVERAGE(name, value, interval) do { \ - static uint64_t A_count ## name = 0; \ - static float A_total ## name = 0.0; \ - static time_t A_last ## name = time(NULL); \ - A_count ## name ++; \ - A_total ## name += value; \ - time_t A_now ## name = time(NULL); \ - if (A_now ## name - A_last ## name >= interval) { \ - EV_VALUE(#name, A_total ## name / A_count ## name); \ - A_count ## name = 0; \ - A_total ## name = 0; \ - A_last ## name = A_now ## name; \ - }} while (false) - |