summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java4
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/application/TenantApplications.java5
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java8
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/SearchNodeMetricsResponse.java4
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterSearchNodeMetricsRetriever.java (renamed from configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterProtonMetricsRetriever.java)4
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetriever.java6
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/metrics/ClusterSearchNodeMetricsRetrieverTest.java2
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetrieverTest.java4
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java5
-rw-r--r--container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java7
-rw-r--r--vespajlib/abi-spec.json1
-rw-r--r--vespajlib/src/main/java/com/yahoo/data/access/simple/Value.java22
14 files changed, 43 insertions, 33 deletions
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 969b6a8201f..f6988a6b566 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
@@ -945,7 +945,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
// ---------------- SearchNode Metrics ------------------------------------------------------------------------
- public SearchNodeMetricsResponse getProtonMetrics(ApplicationId applicationId) {
+ public SearchNodeMetricsResponse getSearchNodeMetrics(ApplicationId applicationId) {
Application application = getApplication(applicationId);
SearchNodeMetricsRetriever searchNodeMetricsRetriever = new SearchNodeMetricsRetriever();
return searchNodeMetricsRetriever.getMetrics(application);
@@ -992,7 +992,7 @@ public class ApplicationRepository implements com.yahoo.config.provision.Deploye
public ApplicationId getApplicationIdForHostname(String hostname) {
Optional<ApplicationId> applicationId = tenantRepository.getAllTenantNames().stream()
- .map(tenantName -> tenantRepository.getTenant(tenantName).getApplicationRepo().getApplicationIdForHostName(hostname))
+ .map(tenantName -> tenantRepository.getTenant(tenantName).getApplicationRepo().resolveApplicationId(hostname))
.filter(Objects::nonNull)
.findFirst();
return applicationId.orElse(null);
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 09a687657c6..88e3134ccad 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
@@ -401,11 +401,6 @@ public class TenantApplications implements RequestHandler, HostValidator {
hostRegistry.verifyHosts(applicationId, newHosts);
}
- // TODO: Duplicate of resolveApplicationId() above
- public ApplicationId getApplicationIdForHostName(String hostname) {
- return hostRegistry.getApplicationId(hostname);
- }
-
public TenantFileSystemDirs getTenantFileSystemDirs() { return tenantFileSystemDirs; }
public CompletionWaiter createRemoveApplicationWaiter(ApplicationId applicationId) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
index 9619ad69b3c..86c0c90ca12 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/ApplicationHandler.java
@@ -97,7 +97,9 @@ public class ApplicationHandler extends HttpHandler {
if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/filedistributionstatus")) return filedistributionStatus(applicationId(path), request);
if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/logs")) return logs(applicationId(path), request);
if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/metrics/deployment")) return deploymentMetrics(applicationId(path));
- if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/metrics/proton")) return protonMetrics(applicationId(path));
+ // TODO: Remove when all usage has migrated to .../metrics/searchnode
+ if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/metrics/proton")) return searchNodeMetrics(applicationId(path));
+ if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/metrics/searchnode")) return searchNodeMetrics(applicationId(path));
if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/reindexing")) return getReindexingStatus(applicationId(path));
if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/service/{service}/{hostname}/status/{*}")) return serviceStatusPage(applicationId(path), path.get("service"), path.get("hostname"), path.getRest(), request);
if (path.matches("/application/v2/tenant/{tenant}/application/{application}/environment/{ignore}/region/{ignore}/instance/{instance}/service/{service}/{hostname}/state/v1/{*}")) return serviceStateV1(applicationId(path), path.get("service"), path.get("hostname"), path.getRest(), request);
@@ -200,8 +202,8 @@ public class ApplicationHandler extends HttpHandler {
return applicationRepository.getLogs(applicationId, hostname, apiParams);
}
- private HttpResponse protonMetrics(ApplicationId applicationId) {
- return applicationRepository.getProtonMetrics(applicationId);
+ private HttpResponse searchNodeMetrics(ApplicationId applicationId) {
+ return applicationRepository.getSearchNodeMetrics(applicationId);
}
private HttpResponse deploymentMetrics(ApplicationId applicationId) {
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/SearchNodeMetricsResponse.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/SearchNodeMetricsResponse.java
index c9d748a7e4c..311dbccb752 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/SearchNodeMetricsResponse.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v2/response/SearchNodeMetricsResponse.java
@@ -12,13 +12,13 @@ import java.util.Map;
*/
public class SearchNodeMetricsResponse extends SlimeJsonResponse {
- public SearchNodeMetricsResponse(ApplicationId applicationId, Map<String, SearchNodeMetricsAggregator> aggregatedProtonMetrics) {
+ public SearchNodeMetricsResponse(ApplicationId applicationId, Map<String, SearchNodeMetricsAggregator> aggregatedMetrics) {
Cursor application = slime.setObject();
application.setString("applicationId", applicationId.serializedForm());
Cursor clusters = application.setArray("clusters");
- for (var entry : aggregatedProtonMetrics.entrySet()) {
+ for (var entry : aggregatedMetrics.entrySet()) {
Cursor cluster = clusters.addObject();
cluster.setString("clusterId", entry.getKey());
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterProtonMetricsRetriever.java b/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterSearchNodeMetricsRetriever.java
index bbdae8f2318..5b58e79b6d8 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterProtonMetricsRetriever.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/ClusterSearchNodeMetricsRetriever.java
@@ -22,9 +22,9 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Logger;
-public class ClusterProtonMetricsRetriever {
+public class ClusterSearchNodeMetricsRetriever {
- private static final Logger log = Logger.getLogger(ClusterProtonMetricsRetriever.class.getName());
+ private static final Logger log = Logger.getLogger(ClusterSearchNodeMetricsRetriever.class.getName());
private static final CloseableHttpClient httpClient = VespaHttpClientBuilder
.custom()
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetriever.java b/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetriever.java
index d417fb8683d..eb2f4ad37a4 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetriever.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetriever.java
@@ -11,13 +11,13 @@ import java.util.function.Predicate;
public class SearchNodeMetricsRetriever {
- private final ClusterProtonMetricsRetriever metricsRetriever;
+ private final ClusterSearchNodeMetricsRetriever metricsRetriever;
public SearchNodeMetricsRetriever() {
- this( new ClusterProtonMetricsRetriever());
+ this( new ClusterSearchNodeMetricsRetriever());
}
- public SearchNodeMetricsRetriever(ClusterProtonMetricsRetriever metricsRetriever) {
+ public SearchNodeMetricsRetriever(ClusterSearchNodeMetricsRetriever metricsRetriever) {
this.metricsRetriever = metricsRetriever;
}
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/metrics/ClusterSearchNodeMetricsRetrieverTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/metrics/ClusterSearchNodeMetricsRetrieverTest.java
index b9d0be61d65..4690f2eb139 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/metrics/ClusterSearchNodeMetricsRetrieverTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/metrics/ClusterSearchNodeMetricsRetrieverTest.java
@@ -43,7 +43,7 @@ public class ClusterSearchNodeMetricsRetrieverTest {
String expectedClusterNameContent = "content/content/0/0";
String expectedClusterNameMusic = "content/music/0/0";
- Map<String, SearchNodeMetricsAggregator> aggregatorMap = new ClusterProtonMetricsRetriever().requestMetricsGroupedByCluster(hosts);
+ Map<String, SearchNodeMetricsAggregator> aggregatorMap = new ClusterSearchNodeMetricsRetriever().requestMetricsGroupedByCluster(hosts);
compareAggregators(
new SearchNodeMetricsAggregator()
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetrieverTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetrieverTest.java
index f0e6b4171c2..d831b6d78b0 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetrieverTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/metrics/SearchNodeMetricsRetrieverTest.java
@@ -28,7 +28,7 @@ public class SearchNodeMetricsRetrieverTest {
@Test
public void getMetrics() {
SearchNodeMetricsRetrieverTest.MockModel mockModel = new MockModel(mockHosts());
- SearchNodeMetricsRetrieverTest.MockProtonMetricsRetriever mockMetricsRetriever = new MockProtonMetricsRetriever();
+ MockSearchNodeMetricsRetriever mockMetricsRetriever = new MockSearchNodeMetricsRetriever();
Application application = new Application(mockModel, null, 0,
null, null, ApplicationId.fromSerializedForm("tenant:app:instance"));
@@ -53,7 +53,7 @@ public class SearchNodeMetricsRetrieverTest {
return List.of(hostInfo1, hostInfo2, hostInfo3);
}
- static class MockProtonMetricsRetriever extends ClusterProtonMetricsRetriever {
+ static class MockSearchNodeMetricsRetriever extends ClusterSearchNodeMetricsRetriever {
Collection<URI> hosts = new ArrayList<>();
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java
index 47982174d4f..a5fe73dfc5d 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastHit.java
@@ -53,7 +53,7 @@ public class FastHit extends Hit {
* This ensures that values set from code overwrites any value received as
* summary data, and fetching a new summary overrides previous summaries.
*
- * The reason we keep this rather than eagerly decoding into a the field map
+ * The reason we keep this rather than eagerly decoding into a field map
* is to reduce garbage collection and decoding cost, with the assumption
* that most fields passes through the container with no processing most
* of the time.
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java b/container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java
index 30dee0e540e..e56b88c3d3e 100644
--- a/container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java
+++ b/container-search/src/main/java/com/yahoo/search/grouping/result/FlatteningSearcher.java
@@ -45,8 +45,9 @@ public class FlatteningSearcher extends Searcher {
// If we count the number of unique groups, use that as total hit count.
if (level == 0 && (hit instanceof RootGroup)) {
- if (hit.fields().get("count()") != null)
- result.setTotalHitCount((long)hit.fields().get("count()"));
+ Object countField = hit.getField("count()");
+ if (countField != null)
+ result.setTotalHitCount((long)countField);
}
if (hit instanceof HitGroup) {
diff --git a/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java b/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java
index 352a31553e7..44620179c1d 100644
--- a/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java
+++ b/container-search/src/main/java/com/yahoo/search/rendering/JsonRenderer.java
@@ -730,7 +730,7 @@ public class JsonRenderer extends AsynchronousSectionedRenderer<Result> {
if (wset != null) return wset;
}
if (settings.convertDeep()) {
- var array = new Value.ArrayValue();
+ var array = new Value.ArrayValue(data.entryCount());
for (int i = 0; i < data.entryCount(); i++) {
Inspector obj = data.entry(i);
array.add(deepMaybeConvert(obj));
diff --git a/container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java b/container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java
index f8fdfb34ca0..06fa3982b18 100644
--- a/container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java
+++ b/container-search/src/main/java/com/yahoo/search/searchchain/testutil/DocumentSourceSearcher.java
@@ -4,6 +4,7 @@ package com.yahoo.search.searchchain.testutil;
import java.util.Collection;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
@@ -145,9 +146,9 @@ public class DocumentSourceSearcher extends Searcher {
copyFieldValuesThatExist(filledHit,hitToFill,fieldsToFill);
} else {
// TODO: remove this block and update fieldsToFill above to throw an exception if no appropriate summary class is found
- for (Map.Entry<String,Object> propertyEntry : filledHit.fields().entrySet()) {
- hitToFill.setField(propertyEntry.getKey(),
- propertyEntry.getValue());
+ for (var iter = filledHit.fieldIterator(); iter.hasNext();) {
+ var propertyEntry = iter.next();
+ hitToFill.setField(propertyEntry.getKey(), propertyEntry.getValue());
}
}
hitToFill.setFilled(summaryClass == null ? DEFAULT_SUMMARY_CLASS : summaryClass);
diff --git a/vespajlib/abi-spec.json b/vespajlib/abi-spec.json
index 88872fef8a1..48d519b3a62 100644
--- a/vespajlib/abi-spec.json
+++ b/vespajlib/abi-spec.json
@@ -145,6 +145,7 @@
],
"methods" : [
"public void <init>()",
+ "public void <init>(int)",
"public boolean valid()",
"public com.yahoo.data.access.Type type()",
"public int entryCount()",
diff --git a/vespajlib/src/main/java/com/yahoo/data/access/simple/Value.java b/vespajlib/src/main/java/com/yahoo/data/access/simple/Value.java
index 2f4c8c59f1d..c4333ee2c29 100644
--- a/vespajlib/src/main/java/com/yahoo/data/access/simple/Value.java
+++ b/vespajlib/src/main/java/com/yahoo/data/access/simple/Value.java
@@ -1,7 +1,11 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.data.access.simple;
-import com.yahoo.data.access.*;
+import com.yahoo.data.access.ArrayTraverser;
+import com.yahoo.data.access.Inspector;
+import com.yahoo.data.access.ObjectTraverser;
+import com.yahoo.data.access.Type;
+
import java.util.Collections;
import java.util.Map;
import java.util.LinkedHashMap;
@@ -54,7 +58,7 @@ public class Value implements Inspector {
public byte[] asData() { return empty_array; }
}
static public class BoolValue extends Value {
- private boolean value;
+ private final boolean value;
public BoolValue(boolean v) { value = v; }
public boolean valid() { return true; }
public Type type() { return Type.BOOL; }
@@ -62,7 +66,7 @@ public class Value implements Inspector {
public boolean asBool(boolean x) { return value; }
}
static public class LongValue extends Value {
- private long value;
+ private final long value;
public LongValue(long v) { value = v; }
public boolean valid() { return true; }
public Type type() { return Type.LONG; }
@@ -72,7 +76,7 @@ public class Value implements Inspector {
public double asDouble(double x) { return (double)value; }
}
static public class DoubleValue extends Value {
- private double value;
+ private final double value;
public DoubleValue(double v) { value = v; }
public boolean valid() { return true; }
public Type type() { return Type.DOUBLE; }
@@ -129,7 +133,13 @@ public class Value implements Inspector {
public byte[] asData(byte[] x) { return value; }
}
static public class ArrayValue extends Value {
- private List<Inspector> values = new ArrayList<>();
+ private final List<Inspector> values;
+ public ArrayValue() {
+ values = new ArrayList<>();
+ }
+ public ArrayValue(int capacity) {
+ values = new ArrayList<>(capacity);
+ }
public boolean valid() { return true; }
public Type type() { return Type.ARRAY; }
public int entryCount() { return values.size(); }
@@ -169,7 +179,7 @@ public class Value implements Inspector {
}
}
static public class ObjectValue extends Value {
- private Map<java.lang.String,Inspector> values = new LinkedHashMap<>();
+ private final Map<java.lang.String,Inspector> values = new LinkedHashMap<>();
public boolean valid() { return true; }
public Type type() { return Type.OBJECT; }
public int fieldCount() { return values.size(); }