summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-07-09 11:26:07 +0200
committerGitHub <noreply@github.com>2020-07-09 11:26:07 +0200
commitcbca38828c11f8d0e369b0e6a263ca5701796f59 (patch)
tree3ea7c69f90c2ff49bdc4afcb79a4e125583cd07b
parent637de9a2313414da6930f703e2a63eae4637d0e6 (diff)
parent1d12f4b4b92771dfe7e245b88ce89adc911c509e (diff)
Merge branch 'master' into balder/skip-communicationmanager-only
-rw-r--r--.github/workflows/python.yml2
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java1
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleTestBundleMojo.java6
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateBundleClassPathMappingsMojo.java1
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java1
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java4
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java (renamed from bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/Artifacts.java)20
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslator.java (renamed from bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/TestBundleDependencyScopeTranslator.java)23
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleUtils.java (renamed from bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/TestBundleUtils.java)10
-rw-r--r--bundle-plugin/src/test/java/com/yahoo/container/plugin/mojo/TestBundleDependencyScopeTranslatorTest.java101
-rw-r--r--bundle-plugin/src/test/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslatorTest.java134
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java4
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java8
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java14
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java5
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java9
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java5
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java2
-rw-r--r--flags/src/main/java/com/yahoo/vespa/flags/Flags.java6
-rw-r--r--jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java3
-rw-r--r--messagebus/src/tests/bucketsequence/bucketsequence.cpp15
-rw-r--r--messagebus/src/vespa/messagebus/message.h2
-rw-r--r--messagebus/src/vespa/messagebus/network/rpcsend.cpp2
-rw-r--r--storage/src/vespa/storage/storageserver/communicationmanager.cpp31
-rw-r--r--storage/src/vespa/storage/storageserver/communicationmanager.h3
-rw-r--r--storageapi/src/vespa/storageapi/mbusprot/storagecommand.h2
26 files changed, 221 insertions, 193 deletions
diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml
index e85c0837170..834fdd9ab3e 100644
--- a/.github/workflows/python.yml
+++ b/.github/workflows/python.yml
@@ -42,7 +42,7 @@ jobs:
run: |
nbdev_test_nbs
- name: Build and publish
- if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
+ if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java
index bed7610e82f..441d7b5a7b8 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleContainerPluginMojo.java
@@ -1,6 +1,7 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.mojo;
+import com.yahoo.container.plugin.util.Artifacts;
import org.apache.maven.model.Build;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component;
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleTestBundleMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleTestBundleMojo.java
index ddf382b02dc..98176e62b93 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleTestBundleMojo.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/AssembleTestBundleMojo.java
@@ -1,6 +1,8 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.plugin.mojo;
+import com.yahoo.container.plugin.util.Artifacts;
+import com.yahoo.container.plugin.util.TestBundleDependencyScopeTranslator;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
@@ -10,8 +12,8 @@ import org.codehaus.plexus.archiver.jar.JarArchiver;
import java.nio.file.Path;
import java.nio.file.Paths;
-import static com.yahoo.container.plugin.mojo.TestBundleUtils.archiveFile;
-import static com.yahoo.container.plugin.mojo.TestBundleUtils.manifestFile;
+import static com.yahoo.container.plugin.util.TestBundleUtils.archiveFile;
+import static com.yahoo.container.plugin.util.TestBundleUtils.manifestFile;
/**
* @author bjorncs
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateBundleClassPathMappingsMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateBundleClassPathMappingsMojo.java
index 4d5b0e327d5..e94e05512aa 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateBundleClassPathMappingsMojo.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateBundleClassPathMappingsMojo.java
@@ -5,6 +5,7 @@ import com.google.common.base.Preconditions;
import com.yahoo.container.plugin.bundle.AnalyzeBundle;
import com.yahoo.container.plugin.osgi.ProjectBundleClassPaths;
import com.yahoo.container.plugin.osgi.ProjectBundleClassPaths.BundleClasspathMapping;
+import com.yahoo.container.plugin.util.Artifacts;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java
index be71c9c149f..892eb9aac05 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateOsgiManifestMojo.java
@@ -8,6 +8,7 @@ import com.yahoo.container.plugin.classanalysis.PackageTally;
import com.yahoo.container.plugin.osgi.ExportPackages;
import com.yahoo.container.plugin.osgi.ExportPackages.Export;
import com.yahoo.container.plugin.osgi.ImportPackages.Import;
+import com.yahoo.container.plugin.util.Artifacts;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java
index 0d4b4dbc8a4..819b47aa417 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/GenerateTestBundleOsgiManifestMojo.java
@@ -6,6 +6,8 @@ import com.yahoo.container.plugin.classanalysis.ClassFileMetaData;
import com.yahoo.container.plugin.classanalysis.PackageTally;
import com.yahoo.container.plugin.osgi.ExportPackages.Export;
import com.yahoo.container.plugin.osgi.ImportPackages;
+import com.yahoo.container.plugin.util.Artifacts;
+import com.yahoo.container.plugin.util.TestBundleDependencyScopeTranslator;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
@@ -18,7 +20,7 @@ import java.util.Map;
import java.util.stream.Stream;
import static com.yahoo.container.plugin.bundle.AnalyzeBundle.exportedPackagesAggregated;
-import static com.yahoo.container.plugin.mojo.TestBundleUtils.outputDirectory;
+import static com.yahoo.container.plugin.util.TestBundleUtils.outputDirectory;
import static com.yahoo.container.plugin.osgi.ExportPackages.exportsByPackageName;
import static com.yahoo.container.plugin.osgi.ImportPackages.calculateImports;
import static com.yahoo.container.plugin.util.Files.allDescendantFiles;
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/Artifacts.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java
index 0dbed043de0..fc771e23fa7 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/Artifacts.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/Artifacts.java
@@ -1,5 +1,5 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.container.plugin.mojo;
+package com.yahoo.container.plugin.util;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
@@ -12,16 +12,16 @@ import java.util.List;
* @author Tony Vaagenes
* @author ollivir
*/
-class Artifacts {
+public class Artifacts {
interface ScopeTranslator {
String scopeOf(Artifact artifact);
}
- static class NoopScopeTranslator implements ScopeTranslator {
+ private static class NoopScopeTranslator implements ScopeTranslator {
@Override public String scopeOf(Artifact artifact) { return artifact.getScope(); }
}
- static class ArtifactSet {
+ public static class ArtifactSet {
private final List<Artifact> jarArtifactsToInclude;
private final List<Artifact> jarArtifactsProvided;
@@ -36,22 +36,22 @@ class Artifacts {
this.nonJarArtifacts = nonJarArtifacts;
}
- List<Artifact> getJarArtifactsToInclude() {
+ public List<Artifact> getJarArtifactsToInclude() {
return jarArtifactsToInclude;
}
- List<Artifact> getJarArtifactsProvided() {
+ public List<Artifact> getJarArtifactsProvided() {
return jarArtifactsProvided;
}
- List<Artifact> getNonJarArtifacts() {
+ public List<Artifact> getNonJarArtifacts() {
return nonJarArtifacts;
}
}
- static ArtifactSet getArtifacts(MavenProject project) { return getArtifacts(project, new NoopScopeTranslator()); }
+ public static ArtifactSet getArtifacts(MavenProject project) { return getArtifacts(project, new NoopScopeTranslator()); }
- static ArtifactSet getArtifacts(MavenProject project, ScopeTranslator scopeTranslator) {
+ public static ArtifactSet getArtifacts(MavenProject project, ScopeTranslator scopeTranslator) {
List<Artifact> jarArtifactsToInclude = new ArrayList<>();
List<Artifact> jarArtifactsProvided = new ArrayList<>();
List<Artifact> nonJarArtifactsToInclude = new ArrayList<>();
@@ -76,7 +76,7 @@ class Artifacts {
return new ArtifactSet(jarArtifactsToInclude, jarArtifactsProvided, nonJarArtifactsToInclude);
}
- static Collection<Artifact> getArtifactsToInclude(MavenProject project) {
+ public static Collection<Artifact> getArtifactsToInclude(MavenProject project) {
return getArtifacts(project, new NoopScopeTranslator()).getJarArtifactsToInclude();
}
}
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/TestBundleDependencyScopeTranslator.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslator.java
index 9ad0a0e34ba..04ede59e2fe 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/TestBundleDependencyScopeTranslator.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslator.java
@@ -1,5 +1,5 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.container.plugin.mojo;
+package com.yahoo.container.plugin.util;
import org.apache.maven.artifact.Artifact;
@@ -18,14 +18,14 @@ import static java.util.stream.Collectors.toList;
*
* Dependencies of scope 'test' are by default translated to 'compile'. Dependencies of other scopes are kept as is.
*
- * Default scope translation can be overridden through a comma-separated configuration string.
+ * Default scope translation for 'test' scope dependencies can be overridden through a comma-separated configuration string.
* Each substring is a triplet on the form [groupId]:[artifactId]:[scope].
* Scope translation overrides affects all transitive dependencies.
* The ordering of the triplets determines the priority - only the first matching override will affect a given dependency.
*
* @author bjorncs
*/
-class TestBundleDependencyScopeTranslator implements Artifacts.ScopeTranslator {
+public class TestBundleDependencyScopeTranslator implements Artifacts.ScopeTranslator {
private static final Logger log = Logger.getLogger(TestBundleDependencyScopeTranslator.class.getName());
@@ -37,7 +37,7 @@ class TestBundleDependencyScopeTranslator implements Artifacts.ScopeTranslator {
@Override public String scopeOf(Artifact artifact) { return Objects.requireNonNull(dependencyScopes.get(artifact)); }
- static TestBundleDependencyScopeTranslator from(Map<String, Artifact> dependencies, String rawConfig) {
+ public static TestBundleDependencyScopeTranslator from(Map<String, Artifact> dependencies, String rawConfig) {
List<DependencyOverride> dependencyOverrides = toDependencyOverrides(rawConfig);
Map<Artifact, String> dependencyScopes = new HashMap<>();
for (Artifact dependency : dependencies.values()) {
@@ -72,12 +72,10 @@ class TestBundleDependencyScopeTranslator implements Artifacts.ScopeTranslator {
private static String getScopeForDependency(
Artifact dependency, List<DependencyOverride> overrides, Map<String, Artifact> otherArtifacts) {
String oldScope = dependency.getScope();
+ if (!oldScope.equals(Artifact.SCOPE_TEST)) return oldScope;
for (DependencyOverride override : overrides) {
for (Artifact dependent : dependencyTrailOf(dependency, otherArtifacts)) {
if (override.isForArtifact(dependent)) {
- // This translation is not always correct for artifacts having 'runtime' scope dependencies.
- // If such dependencies are overridden to 'compile' scope, its 'runtime' dependencies will get
- // scope 'compile' instead of 'runtime'.
log.fine(() -> String.format(
"Overriding scope of '%s'; scope '%s' overridden to '%s'",
dependency.getId(), oldScope, override.scope));
@@ -85,11 +83,10 @@ class TestBundleDependencyScopeTranslator implements Artifacts.ScopeTranslator {
}
}
}
- String newScope = defaultScopeTranslationOf(oldScope);
log.fine(() -> String.format(
- "Using default scope translation for '%s'; scope '%s' translated to '%s'",
- dependency.getId(), oldScope, newScope));
- return newScope;
+ "Using default scope translation for '%s'; scope 'test' translated to 'compile'",
+ dependency.getId()));
+ return Artifact.SCOPE_COMPILE;
}
private static List<Artifact> dependencyTrailOf(Artifact artifact, Map<String, Artifact> otherArtifacts) {
@@ -100,10 +97,6 @@ class TestBundleDependencyScopeTranslator implements Artifacts.ScopeTranslator {
.collect(toList());
}
- private static String defaultScopeTranslationOf(String scope) {
- return scope.equals(Artifact.SCOPE_TEST) ? Artifact.SCOPE_COMPILE : scope;
- }
-
private static class DependencyOverride {
final String groupId;
final String artifactId;
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/TestBundleUtils.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleUtils.java
index 9a3fc89bbd5..b8824952995 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/mojo/TestBundleUtils.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/util/TestBundleUtils.java
@@ -1,5 +1,5 @@
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.container.plugin.mojo;
+package com.yahoo.container.plugin.util;
import org.apache.maven.project.MavenProject;
@@ -10,14 +10,14 @@ import java.util.jar.JarFile;
/**
* @author bjorncs
*/
-class TestBundleUtils {
+public class TestBundleUtils {
private TestBundleUtils() {}
- static Path outputDirectory(MavenProject project) { return targetDirectory(project).resolve("test-bundle/"); }
+ public static Path outputDirectory(MavenProject project) { return targetDirectory(project).resolve("test-bundle/"); }
- static Path manifestFile(MavenProject project) { return outputDirectory(project).resolve(JarFile.MANIFEST_NAME); }
+ public static Path manifestFile(MavenProject project) { return outputDirectory(project).resolve(JarFile.MANIFEST_NAME); }
- static Path archiveFile(MavenProject project) {
+ public static Path archiveFile(MavenProject project) {
return targetDirectory(project).resolve(project.getBuild().getFinalName() + "-tests.jar");
}
diff --git a/bundle-plugin/src/test/java/com/yahoo/container/plugin/mojo/TestBundleDependencyScopeTranslatorTest.java b/bundle-plugin/src/test/java/com/yahoo/container/plugin/mojo/TestBundleDependencyScopeTranslatorTest.java
deleted file mode 100644
index c0e1c9b4b9a..00000000000
--- a/bundle-plugin/src/test/java/com/yahoo/container/plugin/mojo/TestBundleDependencyScopeTranslatorTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.container.plugin.mojo;
-
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.DefaultArtifact;
-import org.apache.maven.artifact.handler.DefaultArtifactHandler;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author bjorncs
- */
-public class TestBundleDependencyScopeTranslatorTest {
-
- private static final String GROUP_ID = "com.test";
-
- @Test
- public void findsAllTestProvidedDependencies() {
- Map<String, Artifact> artifacts = new TreeMap<>();
- Artifact a = createArtifact(artifacts, "a", "compile", List.of());
- Artifact aa = createArtifact(artifacts, "a-a", "compile", List.of("a"));
- Artifact ab = createArtifact(artifacts, "a-b", "runtime", List.of("a"));
- Artifact aba = createArtifact(artifacts, "a-b-a", "runtime", List.of("a", "a-b"));
- Artifact ac = createArtifact(artifacts, "a-c", "runtime", List.of("a"));
- Artifact ad = createArtifact(artifacts, "a-d", "compile", List.of("a"));
- Artifact ada = createArtifact(artifacts, "a-d-a", "compile", List.of("a", "a-d"));
- Artifact adb = createArtifact(artifacts, "a-d-b", "compile", List.of("a", "a-d"));
- Artifact b = createArtifact(artifacts, "b", "provided", List.of());
- Artifact ba = createArtifact(artifacts, "b-a", "provided", List.of("b"));
- Artifact bb = createArtifact(artifacts, "b-b", "provided", List.of("b"));
- Artifact c = createArtifact(artifacts, "c", "runtime", List.of());
- Artifact ca = createArtifact(artifacts, "c-a", "runtime", List.of("c"));
- Artifact d = createArtifact(artifacts, "d", "test", List.of());
- Artifact da = createArtifact(artifacts, "d-a", "test", List.of("d"));
- Artifact daa = createArtifact(artifacts, "d-a-a", "test", List.of("d", "d-a"));
- Artifact db = createArtifact(artifacts, "d-b", "test", List.of("d"));
- Artifact dc = createArtifact(artifacts, "d-c", "test", List.of("d"));
- Artifact dca = createArtifact(artifacts, "d-c-a", "test", List.of("d", "d-c"));
-
- String configString =
- "com.test:a-d:compile," +
- "com.test:a:provided," +
- "com.test:d-a:test," +
- "com.test:d-c:compile," +
- "com.test:d:runtime";
- TestBundleDependencyScopeTranslator translator = TestBundleDependencyScopeTranslator.from(artifacts, configString);
- assertScope(translator, a, "provided");
- assertScope(translator, aa, "provided");
- assertScope(translator, ab, "provided");
- assertScope(translator, aba, "provided");
- assertScope(translator, ac, "provided");
- assertScope(translator, ad, "compile");
- assertScope(translator, ada, "compile");
- assertScope(translator, adb, "compile");
- assertScope(translator, b, "provided");
- assertScope(translator, ba, "provided");
- assertScope(translator, bb, "provided");
- assertScope(translator, c, "runtime");
- assertScope(translator, ca, "runtime");
- assertScope(translator, d, "runtime");
- assertScope(translator, da, "test");
- assertScope(translator, daa, "test");
- assertScope(translator, db, "runtime");
- assertScope(translator, dc, "compile");
- assertScope(translator, dca, "compile");
- }
-
- private static Artifact createArtifact(
- Map<String, Artifact> artifacts, String artifactId, String scope, List<String> transitiveDependents) {
- Artifact artifact = createArtifact(artifactId, scope, transitiveDependents);
- artifacts.put(simpleId(artifactId), artifact);
- return artifact;
- }
-
- private static Artifact createArtifact(String artifactId, String scope, List<String> transitiveDependents) {
- Artifact artifact = new DefaultArtifact(
- GROUP_ID, artifactId, "1.0", scope, "jar", /*classifier*/null, new DefaultArtifactHandler("jar"));
- List<String> dependencyTrail = new ArrayList<>();
- dependencyTrail.add(GROUP_ID + "my-project:container-plugin:1-SNAPSHOT");
- transitiveDependents.forEach(dependent -> dependencyTrail.add(fullId(dependent)));
- dependencyTrail.add(fullId(artifactId));
- artifact.setDependencyTrail(dependencyTrail);
- return artifact;
- }
-
- private static void assertScope(
- TestBundleDependencyScopeTranslator translator, Artifact artifact, String expectedScope) {
- assertEquals(expectedScope, translator.scopeOf(artifact));
- }
-
- private static String fullId(String artifactId) { return simpleId(artifactId) + ":jar:1.0"; }
- private static String simpleId(String artifactId) { return GROUP_ID + ":" + artifactId; }
-
-} \ No newline at end of file
diff --git a/bundle-plugin/src/test/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslatorTest.java b/bundle-plugin/src/test/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslatorTest.java
new file mode 100644
index 00000000000..e01477eb22a
--- /dev/null
+++ b/bundle-plugin/src/test/java/com/yahoo/container/plugin/util/TestBundleDependencyScopeTranslatorTest.java
@@ -0,0 +1,134 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.container.plugin.util;
+
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.DefaultArtifact;
+import org.apache.maven.artifact.handler.DefaultArtifactHandler;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author bjorncs
+ */
+public class TestBundleDependencyScopeTranslatorTest {
+
+ private static final String GROUP_ID = "com.test";
+
+ @Test
+ public void test_dependencies_are_translated_to_compile_scope_by_default() {
+ Map<String, Artifact> artifacts = new TreeMap<>();
+ Artifact a = createArtifact(artifacts, "a", "test", List.of());
+ Artifact aa = createArtifact(artifacts, "a-a", "test", List.of("a"));
+ Artifact ab = createArtifact(artifacts, "a-b", "test", List.of("a"));
+ Artifact aba = createArtifact(artifacts, "a-b-a", "test", List.of("a", "a-b"));
+
+ TestBundleDependencyScopeTranslator translator = TestBundleDependencyScopeTranslator.from(artifacts, null);
+ assertScope(translator, a, "compile");
+ assertScope(translator, aa, "compile");
+ assertScope(translator, ab, "compile");
+ assertScope(translator, aba, "compile");
+
+ }
+
+ @Test
+ public void non_test_scope_dependencies_keep_original_scope() {
+ Map<String, Artifact> artifacts = new TreeMap<>();
+ Artifact a = createArtifact(artifacts, "a", "provided", List.of());
+ Artifact aa = createArtifact(artifacts, "a-a", "provided", List.of("a"));
+ Artifact ab = createArtifact(artifacts, "a-b", "provided", List.of("a"));
+ Artifact b = createArtifact(artifacts, "b", "runtime", List.of());
+ Artifact ba = createArtifact(artifacts, "b-a", "runtime", List.of("b"));
+ Artifact c = createArtifact(artifacts, "c", "test", List.of());
+ Artifact ca = createArtifact(artifacts, "c-a", "test", List.of("c"));
+
+ TestBundleDependencyScopeTranslator translator = TestBundleDependencyScopeTranslator.from(artifacts, null);
+ assertScope(translator, a, "provided");
+ assertScope(translator, aa, "provided");
+ assertScope(translator, ab, "provided");
+ assertScope(translator, b, "runtime");
+ assertScope(translator, ba, "runtime");
+ assertScope(translator, c, "compile");
+ assertScope(translator, ca, "compile");
+ }
+
+ @Test
+ public void ordering_in_config_string_determines_translation() {
+ Map<String, Artifact> artifacts = new TreeMap<>();
+ Artifact a = createArtifact(artifacts, "a", "test", List.of());
+ Artifact aa = createArtifact(artifacts, "a-a", "test", List.of("a"));
+ {
+ String configString =
+ "com.test:a-a:runtime," +
+ "com.test:a:test,";
+ TestBundleDependencyScopeTranslator translator = TestBundleDependencyScopeTranslator.from(artifacts, configString);
+ assertScope(translator, a, "test");
+ assertScope(translator, aa, "runtime");
+ }
+ {
+ String configString =
+ "com.test:a:test," +
+ "com.test:a-a:runtime";
+ TestBundleDependencyScopeTranslator translator = TestBundleDependencyScopeTranslator.from(artifacts, configString);
+ assertScope(translator, a, "test");
+ assertScope(translator, aa, "test");
+ }
+ }
+
+ @Test
+ public void transitive_non_test_dependencies_of_test_dependencies_keep_original_scope() {
+ Map<String, Artifact> artifacts = new TreeMap<>();
+ Artifact a = createArtifact(artifacts, "a", "test", List.of());
+ Artifact aa = createArtifact(artifacts, "a-a", "test", List.of("a"));
+ Artifact ab = createArtifact(artifacts, "a-b", "test", List.of("a"));
+ Artifact aba = createArtifact(artifacts, "a-b-a", "compile", List.of("a", "a-b"));
+ Artifact ac = createArtifact(artifacts, "a-c", "runtime", List.of("a"));
+ Artifact b = createArtifact(artifacts, "b", "test", List.of());
+ Artifact ba = createArtifact(artifacts, "b-a", "test", List.of("b"));
+ Artifact bb = createArtifact(artifacts, "b-b", "provided", List.of("b"));
+
+ String configString = "com.test:a:provided";
+ TestBundleDependencyScopeTranslator translator = TestBundleDependencyScopeTranslator.from(artifacts, configString);
+ assertScope(translator, a, "provided");
+ assertScope(translator, aa, "provided");
+ assertScope(translator, ab, "provided");
+ assertScope(translator, aba, "compile");
+ assertScope(translator, ac, "runtime");
+ assertScope(translator, b, "compile");
+ assertScope(translator, ba, "compile");
+ assertScope(translator, bb, "provided");
+ }
+
+ private static Artifact createArtifact(
+ Map<String, Artifact> artifacts, String artifactId, String scope, List<String> transitiveDependents) {
+ Artifact artifact = createArtifact(artifactId, scope, transitiveDependents);
+ artifacts.put(simpleId(artifactId), artifact);
+ return artifact;
+ }
+
+ private static Artifact createArtifact(String artifactId, String scope, List<String> transitiveDependents) {
+ Artifact artifact = new DefaultArtifact(
+ GROUP_ID, artifactId, "1.0", scope, "jar", /*classifier*/null, new DefaultArtifactHandler("jar"));
+ List<String> dependencyTrail = new ArrayList<>();
+ dependencyTrail.add(GROUP_ID + "my-project:container-plugin:1-SNAPSHOT");
+ transitiveDependents.forEach(dependent -> dependencyTrail.add(fullId(dependent)));
+ dependencyTrail.add(fullId(artifactId));
+ artifact.setDependencyTrail(dependencyTrail);
+ return artifact;
+ }
+
+ private static void assertScope(
+ TestBundleDependencyScopeTranslator translator, Artifact artifact, String expectedScope) {
+ assertEquals(expectedScope, translator.scopeOf(artifact));
+ }
+
+ private static String fullId(String artifactId) { return simpleId(artifactId) + ":jar:1.0"; }
+ private static String simpleId(String artifactId) { return GROUP_ID + ":" + artifactId; }
+
+} \ No newline at end of file
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java
index ce67d0d8317..3588645232c 100644
--- a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java
+++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java
@@ -113,8 +113,8 @@ public interface ModelContext {
Optional<ApplicationRoles> applicationRoles();
- // TODO(bjorncs): Temporary feature flag, revisit July 2020
- default Duration jdiscHealthCheckProxyClientTimeout() { return Duration.ofSeconds(1); }
+ // TODO(bjorncs): Temporary feature flag, revisit August 2020
+ default Duration jdiscHealthCheckProxyClientTimeout() { return Duration.ofMillis(100); }
}
}
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
index 3efc26913a0..f329f62ee7b 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/ContentSearchCluster.java
@@ -392,7 +392,13 @@ public class ContentSearchCluster extends AbstractConfigProducer implements Prot
if (hasAnyNonIndexedCluster) {
builder.feeding.concurrency(builder.feeding.build().concurrency() * 2);
}
- builder.indexing.optimize(feedSequencerType);
+ if ((feedSequencerType == ProtonConfig.Indexing.Optimize.Enum.THROUGHPUT) && (visibilityDelay == 0.0)) {
+ // THROUGHPUT and zero visibilityDelay is inconsistent and currently a suboptimal combination, defaulting to LATENCY.
+ // TODO: Once we have figured out optimal combination this limitation will be cleaned up.
+ builder.indexing.optimize(ProtonConfig.Indexing.Optimize.Enum.LATENCY);
+ } else {
+ builder.indexing.optimize(feedSequencerType);
+ }
}
private boolean isGloballyDistributed(NewDocumentType docType) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
index 5d9b5e3dbce..bd44489fab7 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/builder/xml/dom/ContentBuilderTest.java
@@ -760,10 +760,16 @@ public class ContentBuilderTest extends DomBuilderTest {
}
}
- private void verifyFeedSequencer(String input, String expceted) {
+ private void verifyFeedSequencer(String input, String expected) {
+ verifyFeedSequencer(input, expected, 0);
+ }
+ private void verifyFeedSequencer(String input, String expected, double visibilityDelay) {
String hostedXml = "<services>" +
"<content version='1.0' id='search'>" +
" <redundancy>1</redundancy>" +
+ " <search>" +
+ " <visibility-delay>" + visibilityDelay + "</visibility-delay>" +
+ " </search>" +
" <documents>" +
" <document type='music' mode='index'/>" +
" </documents>" +
@@ -778,7 +784,7 @@ public class ContentBuilderTest extends DomBuilderTest {
.build())
.create(deployStateBuilder);
ProtonConfig config = getProtonConfig(model.getContentClusters().values().iterator().next());
- assertEquals(expceted, config.indexing().optimize().toString());
+ assertEquals(expected, config.indexing().optimize().toString());
}
@@ -786,7 +792,9 @@ public class ContentBuilderTest extends DomBuilderTest {
public void ensureFeedSequencerIsControlledByFlag() {
verifyFeedSequencer("LATENCY", "LATENCY");
verifyFeedSequencer("ADAPTIVE", "ADAPTIVE");
- verifyFeedSequencer("THROUGHPUT", "THROUGHPUT");
+ verifyFeedSequencer("THROUGHPUT", "LATENCY", 0);
+ verifyFeedSequencer("THROUGHPUT", "THROUGHPUT", 0.1);
+
verifyFeedSequencer("THOUGHPUT", "LATENCY");
verifyFeedSequencer("adaptive", "LATENCY");
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
index 8ba4581e158..bd86052c0dd 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java
@@ -619,9 +619,8 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
private long getSessionIdForApplication(Tenant tenant, ApplicationId applicationId) {
TenantApplications applicationRepo = tenant.getApplicationRepo();
- if (applicationRepo == null)
- throw new NotFoundException("Application repo for tenant '" + tenant.getName() + "' not found");
-
+ if (! applicationRepo.exists(applicationId))
+ throw new NotFoundException("Unknown application id '" + applicationId + "'");
return applicationRepo.requireActiveSessionOf(applicationId);
}
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java
index 7337dc446f5..5567de6dadc 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java
@@ -127,11 +127,12 @@ public class TenantApplications implements RequestHandler, HostValidator<Applica
return curator.exists(applicationPath(id));
}
- /** Returns the id of the currently active session for the given application, if any. Throws on unknown applications. */
+ /** Returns the active session id for the given application. Returns Optional.empty if application not found or no active session exists. */
public Optional<Long> activeSessionOf(ApplicationId id) {
- String data = curator.getData(applicationPath(id)).map(Utf8::toString)
- .orElseThrow(() -> new NotFoundException("No active session found for application id: '" + id + "'"));
- return data.isEmpty() ? Optional.empty() : Optional.of(Long.parseLong(data));
+ Optional<byte[]> data = curator.getData(applicationPath(id));
+ return (data.isEmpty() || data.get().length == 0)
+ ? Optional.empty()
+ : data.map(bytes -> Long.parseLong(Utf8.toString(bytes)));
}
public boolean hasLocalSession(long sessionId) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
index 3cf7bdabb4d..6ad69540eb2 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java
@@ -25,7 +25,6 @@ import com.yahoo.vespa.flags.Flags;
import java.io.File;
import java.net.URI;
-import java.time.Duration;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -159,7 +158,6 @@ public class ModelContextImpl implements ModelContext {
private final int numResponseThreads;
private final Optional<AthenzDomain> athenzDomain;
private final Optional<ApplicationRoles> applicationRoles;
- private final int jdiscHealthCheckProxyClientTimeout;
public Properties(ApplicationId applicationId,
boolean multitenantFromConfig,
@@ -208,8 +206,6 @@ public class ModelContextImpl implements ModelContext {
.with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value();
this.athenzDomain = athenzDomain;
this.applicationRoles = applicationRoles;
- jdiscHealthCheckProxyClientTimeout = Flags.JDISC_HEALTH_CHECK_PROXY_CLIENT_TIMEOUT.bindTo(flagSource)
- .with(FetchVector.Dimension.APPLICATION_ID, applicationId.serializedForm()).value();
}
@Override
@@ -283,7 +279,6 @@ public class ModelContextImpl implements ModelContext {
return applicationRoles;
}
- @Override public Duration jdiscHealthCheckProxyClientTimeout() { return Duration.ofMillis(jdiscHealthCheckProxyClientTimeout); }
@Override public String jvmGCOptions() { return jvmGCOPtions; }
@Override public String feedSequencerType() { return feedSequencer; }
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
index 3438fbecc59..eca32cd364a 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandlerTest.java
@@ -235,7 +235,7 @@ public class ApplicationHandlerTest {
ApplicationId unknown = new ApplicationId.Builder().applicationName("unknown").tenant("default").build();
HttpResponse responseForUnknown = fileDistributionStatus(unknown, zone);
assertEquals(404, responseForUnknown.getStatus());
- assertEquals("{\"error-code\":\"NOT_FOUND\",\"message\":\"No active session found for application id: 'default.unknown'\"}",
+ assertEquals("{\"error-code\":\"NOT_FOUND\",\"message\":\"Unknown application id 'default.unknown'\"}",
getRenderedString(responseForUnknown));
}
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
index d37dfb2bbe1..6addf4b932c 100644
--- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
+++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
@@ -272,12 +272,6 @@ public class Flags {
"Takes effect on next deployment (controller)",
ZONE_ID);
- public static final UnboundIntFlag JDISC_HEALTH_CHECK_PROXY_CLIENT_TIMEOUT = defineIntFlag(
- "jdisc-health-check-proxy-client-timeout", 1000,
- "Temporary flag to rollout reduced timeout for JDisc's health check proxy client. Timeout in milliseconds",
- "Takes effect on next internal redeployment",
- APPLICATION_ID);
-
public static final UnboundBooleanFlag APPLICATION_IAM_ROLE = defineFeatureFlag(
"application-iam-roles", false,
"Allow separate iam roles when provisioning/assigning hosts",
diff --git a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java
index 5ae5359d097..3b178b4ff89 100644
--- a/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java
+++ b/jdisc_http_service/src/main/java/com/yahoo/jdisc/http/server/jetty/HealthCheckProxyHandler.java
@@ -107,9 +107,6 @@ class HealthCheckProxyHandler extends HandlerWrapper {
log.log(Level.INFO, message);
log.log(Level.FINE, e.toString(), e);
servletResponse.sendError(Response.Status.INTERNAL_SERVER_ERROR, message);
- if (Duration.ofSeconds(1).compareTo(proxyTarget.timeout) >= 0) { // TODO bjorncs: remove call to close() if client is correctly pruning bad connections (VESPA-17628)
- proxyTarget.close();
- }
}
} else {
servletResponse.sendError(NOT_FOUND);
diff --git a/messagebus/src/tests/bucketsequence/bucketsequence.cpp b/messagebus/src/tests/bucketsequence/bucketsequence.cpp
index 57d1f99e5c3..671f50efc03 100644
--- a/messagebus/src/tests/bucketsequence/bucketsequence.cpp
+++ b/messagebus/src/tests/bucketsequence/bucketsequence.cpp
@@ -11,19 +11,13 @@
using namespace mbus;
-TEST_SETUP(Test);
-
class MyMessage : public SimpleMessage {
public:
MyMessage() : SimpleMessage("foo") { }
- bool hasBucketSequence() override { return true; }
+ bool hasBucketSequence() const override { return true; }
};
-int
-Test::Main()
-{
- TEST_INIT("bucketsequence_test");
-
+TEST("bucketsequence_test") {
Slobrok slobrok;
TestServer server(MessageBusParams()
.addProtocol(std::make_shared<SimpleProtocol>())
@@ -37,9 +31,10 @@ Test::Main()
msg->setRoute(Route::parse("foo"));
ASSERT_TRUE(session->send(std::move(msg)).isAccepted());
Reply::UP reply = receptor.getReply();
- ASSERT_TRUE(reply.get() != nullptr);
+ ASSERT_TRUE(reply);
EXPECT_EQUAL(1u, reply->getNumErrors());
EXPECT_EQUAL((uint32_t)ErrorCode::SEQUENCE_ERROR, reply->getError(0).getCode());
- TEST_DONE();
}
+
+TEST_MAIN() { TEST_RUN_ALL(); }
diff --git a/messagebus/src/vespa/messagebus/message.h b/messagebus/src/vespa/messagebus/message.h
index 15e7384707c..22fb1e282b6 100644
--- a/messagebus/src/vespa/messagebus/message.h
+++ b/messagebus/src/vespa/messagebus/message.h
@@ -135,7 +135,7 @@ public:
*
* @return True to enable bucket sequencing.
*/
- virtual bool hasBucketSequence() { return false; }
+ virtual bool hasBucketSequence() const { return false; }
/**
* Obtain the approximate size of this message object in bytes. This enables
diff --git a/messagebus/src/vespa/messagebus/network/rpcsend.cpp b/messagebus/src/vespa/messagebus/network/rpcsend.cpp
index 2422638dc05..dca7f0c997f 100644
--- a/messagebus/src/vespa/messagebus/network/rpcsend.cpp
+++ b/messagebus/src/vespa/messagebus/network/rpcsend.cpp
@@ -114,7 +114,7 @@ RPCSend::send(RoutingNode &recipient, const vespalib::Version &version,
const PayLoadFiller & payload, duration timeRemaining)
{
auto ctx = std::make_unique<SendContext>(recipient, timeRemaining);
- RPCServiceAddress &address = static_cast<RPCServiceAddress&>(recipient.getServiceAddress());
+ auto &address = static_cast<RPCServiceAddress&>(recipient.getServiceAddress());
const Message &msg = recipient.getMessage();
Route route = recipient.getRoute();
Hop hop = route.removeHop(0);
diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.cpp b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
index 5588b6535e2..7f46639d5a5 100644
--- a/storage/src/vespa/storage/storageserver/communicationmanager.cpp
+++ b/storage/src/vespa/storage/storageserver/communicationmanager.cpp
@@ -81,7 +81,7 @@ CommunicationManager::handleMessage(std::unique_ptr<mbus::Message> msg)
if (protocolName == documentapi::DocumentProtocol::NAME) {
std::unique_ptr<documentapi::DocumentMessage> docMsgPtr(static_cast<documentapi::DocumentMessage*>(msg.release()));
- assert(docMsgPtr.get());
+ assert(docMsgPtr);
std::unique_ptr<api::StorageCommand> cmd;
try {
@@ -91,7 +91,7 @@ CommunicationManager::handleMessage(std::unique_ptr<mbus::Message> msg)
return;
}
- if (!cmd.get()) {
+ if ( ! cmd) {
LOGBM(warning, "Unsupported message: StorageApi could not convert message of type %d to a storageapi message",
docMsgPtr->getType());
_metrics.convertToStorageAPIFailures.inc();
@@ -105,7 +105,7 @@ CommunicationManager::handleMessage(std::unique_ptr<mbus::Message> msg)
} else if (protocolName == mbusprot::StorageProtocol::NAME) {
std::unique_ptr<mbusprot::StorageCommand> storMsgPtr(static_cast<mbusprot::StorageCommand*>(msg.release()));
- assert(storMsgPtr.get());
+ assert(storMsgPtr);
//TODO: Can it be moved ?
std::shared_ptr<api::StorageCommand> cmd = storMsgPtr->getCommand();
@@ -136,7 +136,7 @@ CommunicationManager::handleReply(std::unique_ptr<mbus::Reply> reply)
if (reply->getType() == 0) {
std::unique_ptr<mbus::Message> message(reply->getMessage());
- if (message.get()) {
+ if (message) {
std::unique_ptr<mbus::Reply> convertedReply;
const vespalib::string& protocolName = message->getProtocol();
@@ -198,7 +198,7 @@ CommunicationManager::handleReply(std::unique_ptr<mbus::Reply> reply)
std::shared_ptr<api::StorageReply> sar(
_docApiConverter.toStorageAPI(static_cast<documentapi::DocumentReply&>(*reply), *originalCommand));
- if (sar.get()) {
+ if (sar) {
sar->setTrace(reply->getTrace());
receiveStorageReply(sar);
}
@@ -251,7 +251,6 @@ CommunicationManager::CommunicationManager(StorageComponentRegister& compReg, co
_listener(),
_eventQueue(),
_mbus(),
- _count(0),
_configUri(configUri),
_closed(false),
_docApiConverter(configUri, std::make_shared<PlaceHolderBucketResolver>()),
@@ -496,7 +495,7 @@ CommunicationManager::sendMessageBusMessage(const std::shared_ptr<api::StorageCo
if (!result.isAccepted()) {
std::shared_ptr<api::StorageReply> reply(msg->makeReply());
- if (reply.get()) {
+ if (reply) {
if (result.getError().getCode() > mbus::ErrorCode::FATAL_ERROR) {
reply->setResult(api::ReturnCode(api::ReturnCode::ABORTED, result.getError().getMessage()));
} else {
@@ -558,7 +557,7 @@ CommunicationManager::sendCommand(
std::unique_ptr<mbus::Message> mbusMsg(_docApiConverter.toDocumentAPI(*msg));
- if (mbusMsg.get()) {
+ if (mbusMsg) {
MBUS_TRACE(msg->getTrace(), 7, "Communication manager: Converted OK");
mbusMsg->setTrace(msg->getTrace());
mbusMsg->setRetryEnabled(address.retryEnabled());
@@ -649,7 +648,7 @@ CommunicationManager::sendMessageBusReply(
// If this was originally documentapi, create a reply now and transfer the
// state.
- if (context._docAPIMsg.get()) {
+ if (context._docAPIMsg) {
if (reply->getResult().getResult() == api::ReturnCode::WRONG_DISTRIBUTION) {
replyUP = std::make_unique<documentapi::WrongDistributionReply>(reply->getResult().getMessage());
replyUP->swapState(*context._docAPIMsg);
@@ -663,7 +662,7 @@ CommunicationManager::sendMessageBusReply(
replyUP->setMessage(std::move(context._docAPIMsg));
_docApiConverter.transferReplyState(*reply, *replyUP);
}
- } else if (context._storageProtocolMsg.get()) {
+ } else if (context._storageProtocolMsg) {
replyUP = std::make_unique<mbusprot::StorageReply>(reply);
if (reply->getResult().getResult() != api::ReturnCode::OK) {
replyUP->addError(mbus::Error(reply->getResult().getResult(), reply->getResult().getMessage()));
@@ -674,12 +673,12 @@ CommunicationManager::sendMessageBusReply(
replyUP->setMessage(std::move(context._storageProtocolMsg));
}
- if (replyUP.get() != NULL) {
+ if (replyUP) {
// Forward message only if it was successfully stored in storage.
if (!replyUP->hasErrors()) {
mbus::Message::UP messageUP = replyUP->getMessage();
- if (messageUP.get() && messageUP->getRoute().hasHops()) {
+ if (messageUP && messageUP->getRoute().hasHops()) {
messageUP->setContext(mbus::Context(FORWARDED_MESSAGE));
_sourceSession->send(std::move(messageUP));
}
@@ -701,14 +700,14 @@ CommunicationManager::sendReply(
std::unique_ptr<StorageTransportContext> context(static_cast<StorageTransportContext*>(reply->getTransportContext().release()));
- if (!context.get()) {
+ if (!context) {
LOG(spam, "No transport context in reply %s", reply->toString().c_str());
return false;
}
framework::MilliSecTimer startTime(_component.getClock());
- if (context->_request.get()) {
- sendDirectRPCReply(*(context->_request.get()), reply);
+ if (context->_request) {
+ sendDirectRPCReply(*(context->_request), reply);
} else {
sendMessageBusReply(*context, reply);
}
@@ -752,7 +751,7 @@ CommunicationManager::print(std::ostream& out, bool verbose, const std::string&
void CommunicationManager::updateMessagebusProtocol(
const std::shared_ptr<const document::DocumentTypeRepo> &repo) {
- if (_mbus.get()) {
+ if (_mbus) {
framework::SecondTime now(_component.getClock().getTimeInSeconds());
auto newDocumentProtocol = std::make_shared<documentapi::DocumentProtocol>(*_component.getLoadTypes(), repo);
std::lock_guard<std::mutex> guard(_earlierGenerationsLock);
diff --git a/storage/src/vespa/storage/storageserver/communicationmanager.h b/storage/src/vespa/storage/storageserver/communicationmanager.h
index 3fd82f3509d..54c4823717e 100644
--- a/storage/src/vespa/storage/storageserver/communicationmanager.h
+++ b/storage/src/vespa/storage/storageserver/communicationmanager.h
@@ -86,7 +86,7 @@ private:
void process(const std::shared_ptr<api::StorageMessage>& msg);
- using CommunicationManagerConfig= vespa::config::content::core::StorCommunicationmanagerConfig;
+ using CommunicationManagerConfig = vespa::config::content::core::StorCommunicationmanagerConfig;
using BucketspacesConfig = vespa::config::content::core::BucketspacesConfig;
void configureMessageBusLimits(const CommunicationManagerConfig& cfg);
@@ -103,7 +103,6 @@ private:
std::unique_ptr<mbus::RPCMessageBus> _mbus;
std::unique_ptr<mbus::DestinationSession> _messageBusSession;
std::unique_ptr<mbus::SourceSession> _sourceSession;
- uint32_t _count;
vespalib::Lock _messageBusSentLock;
std::map<api::StorageMessage::Id, std::shared_ptr<api::StorageCommand> > _messageBusSent;
diff --git a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h
index 88af61509d5..26c9ef00752 100644
--- a/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h
+++ b/storageapi/src/vespa/storageapi/mbusprot/storagecommand.h
@@ -21,6 +21,8 @@ public:
api::StorageMessage::SP getInternalMessage() override { return _cmd; }
api::StorageMessage::CSP getInternalMessage() const override { return _cmd; }
+ bool hasBucketSequence() const override { return false; }
+
uint8_t priority() const override {
return ((getInternalMessage()->getPriority()) / 255) * 16;
}