aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-11-08 23:41:16 +0100
committerGitHub <noreply@github.com>2022-11-08 23:41:16 +0100
commit02bff3ed6c018cccf5f9c6cc09b3213b31fa7aff (patch)
tree400e97f9fe7c947fe2656933d629484bf4e2d9d0
parent0cc8e2a08cae114d855b2d6dbc4c04877cfa5bff (diff)
parentbd2460881fb71f7a3c61036fddcc5e69ced3e238 (diff)
Merge pull request #24798 from vespa-engine/balder/gc-dispatch-metricv8.81.23
GC metric that has not had any meaning since we removed fdispatch.
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/VespaMetricSet.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java25
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java124
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java2
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockMetric.java21
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java19
6 files changed, 71 insertions, 122 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/VespaMetricSet.java b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/VespaMetricSet.java
index 4d03944c4e9..96a75f0ef3a 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/VespaMetricSet.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/admin/monitoring/VespaMetricSet.java
@@ -339,8 +339,6 @@ public class VespaMetricSet {
metrics.add(new Metric("documents_covered.count"));
metrics.add(new Metric("documents_total.count"));
metrics.add(new Metric("documents_target_total.count"));
- metrics.add(new Metric("dispatch_internal.rate"));
- metrics.add(new Metric("dispatch_fdispatch.rate"));
addMetric(metrics, "jdisc.render.latency", Set.of("min", "max", "count", "sum", "last", "average"));
addMetric(metrics, "query_item_count", Set.of("max", "sum", "count"));
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
index 96a7f341364..11eab6179dc 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/Dispatcher.java
@@ -6,7 +6,6 @@ import com.yahoo.component.AbstractComponent;
import com.yahoo.component.ComponentId;
import com.yahoo.compress.Compressor;
import com.yahoo.container.handler.VipStatus;
-import com.yahoo.jdisc.Metric;
import com.yahoo.prelude.fastsearch.VespaBackEndSearcher;
import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.Query;
@@ -47,9 +46,6 @@ public class Dispatcher extends AbstractComponent {
public static final String DISPATCH = "dispatch";
private static final String TOP_K_PROBABILITY = "topKProbability";
-
- private static final String INTERNAL_METRIC = "dispatch_internal";
-
private static final int MAX_GROUP_SELECTION_ATTEMPTS = 3;
/** If set will control computation of how many hits will be fetched from each partition.*/
@@ -58,14 +54,8 @@ public class Dispatcher extends AbstractComponent {
/** A model of the search cluster this dispatches to */
private final SearchCluster searchCluster;
private final ClusterMonitor<Node> clusterMonitor;
-
private final LoadBalancer loadBalancer;
-
private final InvokerFactory invokerFactory;
-
- private final Metric metric;
- private final Metric.Context metricContext;
-
private final int maxHitsPerNode;
private static final QueryProfileType argumentType;
@@ -84,16 +74,15 @@ public class Dispatcher extends AbstractComponent {
public Dispatcher(RpcResourcePool resourcePool,
ComponentId clusterId,
DispatchConfig dispatchConfig,
- VipStatus vipStatus,
- Metric metric) {
+ VipStatus vipStatus) {
this(resourcePool, new SearchCluster(clusterId.stringValue(), dispatchConfig,
vipStatus, new RpcPingFactory(resourcePool)),
- dispatchConfig, metric);
+ dispatchConfig);
}
- private Dispatcher(RpcResourcePool resourcePool, SearchCluster searchCluster, DispatchConfig dispatchConfig, Metric metric) {
- this(new ClusterMonitor<>(searchCluster, true), searchCluster, dispatchConfig, new RpcInvokerFactory(resourcePool, searchCluster), metric);
+ private Dispatcher(RpcResourcePool resourcePool, SearchCluster searchCluster, DispatchConfig dispatchConfig) {
+ this(new ClusterMonitor<>(searchCluster, true), searchCluster, dispatchConfig, new RpcInvokerFactory(resourcePool, searchCluster));
}
private static LoadBalancer.Policy toLoadBalancerPolicy(DispatchConfig.DistributionPolicy.Enum policy) {
@@ -109,8 +98,7 @@ public class Dispatcher extends AbstractComponent {
protected Dispatcher(ClusterMonitor<Node> clusterMonitor,
SearchCluster searchCluster,
DispatchConfig dispatchConfig,
- InvokerFactory invokerFactory,
- Metric metric) {
+ InvokerFactory invokerFactory) {
if (dispatchConfig.useMultilevelDispatch())
throw new IllegalArgumentException(searchCluster + " is configured with multilevel dispatch, but this is not supported");
@@ -118,8 +106,6 @@ public class Dispatcher extends AbstractComponent {
this.clusterMonitor = clusterMonitor;
this.loadBalancer = new LoadBalancer(searchCluster, toLoadBalancerPolicy(dispatchConfig.distributionPolicy()));
this.invokerFactory = invokerFactory;
- this.metric = metric;
- this.metricContext = metric.createContext(null);
this.maxHitsPerNode = dispatchConfig.maxHitsPerNode();
searchCluster.addMonitoring(clusterMonitor);
Thread warmup = new Thread(() -> warmup(dispatchConfig.warmuptime()));
@@ -169,7 +155,6 @@ public class Dispatcher extends AbstractComponent {
query.setHits(0);
query.setOffset(0);
}
- metric.add(INTERNAL_METRIC, 1, metricContext);
return invoker;
}
diff --git a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
index 2b560713c57..bd60e695a9a 100644
--- a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
@@ -14,7 +14,6 @@ import com.yahoo.prelude.SearchDefinition;
import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
import com.yahoo.prelude.fastsearch.FastHit;
import com.yahoo.prelude.fastsearch.VespaBackEndSearcher;
-import com.yahoo.prelude.fastsearch.test.MockMetric;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.config.ClusterConfig;
@@ -28,15 +27,7 @@ import com.yahoo.search.searchchain.Execution;
import com.yahoo.vespa.config.search.DispatchConfig;
import org.junit.jupiter.api.Test;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import static org.junit.jupiter.api.Assertions.*;
@@ -51,13 +42,13 @@ public class ClusterSearcherTestCase {
@Test
void testNoBackends() {
- ClusterSearcher cluster = new ClusterSearcher(new LinkedHashSet<>(Arrays.asList("dummy")));
+ ClusterSearcher cluster = new ClusterSearcher(new LinkedHashSet<>(List.of("dummy")));
try {
Execution execution = new Execution(cluster, Execution.Context.createContextStub());
Query query = new Query("query=hello");
query.setHits(10);
com.yahoo.search.Result result = execution.search(query);
- assertTrue(result.hits().getError() != null);
+ assertNotNull(result.hits().getError());
assertEquals("No backends in service. Try later", result.hits().getError().getMessage());
} finally {
cluster.deconstruct();
@@ -66,9 +57,9 @@ public class ClusterSearcherTestCase {
private IndexFacts createIndexFacts() {
Map<String, List<String>> clusters = new LinkedHashMap<>();
- clusters.put("cluster1", Arrays.asList("type1", "type2", "type3"));
- clusters.put("cluster2", Arrays.asList("type4", "type5"));
- clusters.put("type1", Arrays.asList("type6"));
+ clusters.put("cluster1", List.of("type1", "type2", "type3"));
+ clusters.put("cluster2", List.of("type4", "type5"));
+ clusters.put("type1", List.of("type6"));
Collection<SearchDefinition> searchDefs = ImmutableList.of(
new SearchDefinition("type1"),
new SearchDefinition("type2"),
@@ -85,34 +76,34 @@ public class ClusterSearcherTestCase {
@Test
void testThatDocumentTypesAreResolved() {
- ClusterSearcher cluster1 = new ClusterSearcher(new LinkedHashSet<>(Arrays.asList("type1", "type2", "type3")));
+ ClusterSearcher cluster1 = new ClusterSearcher(new LinkedHashSet<>(List.of("type1", "type2", "type3")));
try {
- ClusterSearcher type1 = new ClusterSearcher(new LinkedHashSet<>(Arrays.asList("type6")));
+ ClusterSearcher type1 = new ClusterSearcher(new LinkedHashSet<>(List.of("type6")));
try {
- assertEquals(new LinkedHashSet<>(Arrays.asList("type1", "type2", "type3")), resolve(cluster1, ""));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type6")), resolve(type1, ""));
+ assertEquals(new LinkedHashSet<>(List.of("type1", "type2", "type3")), resolve(cluster1, ""));
+ assertEquals(new LinkedHashSet<>(List.of("type6")), resolve(type1, ""));
{ // specify restrict
- assertEquals(new LinkedHashSet<>(Arrays.asList("type1")), resolve(cluster1, "&restrict=type1"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2")), resolve(cluster1, "&restrict=type2"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2", "type3")), resolve(cluster1, "&restrict=type2,type3"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2")), resolve(cluster1, "&restrict=type2,type4"));
- assertEquals(new LinkedHashSet<>(Arrays.asList()), resolve(cluster1, "&restrict=type4"));
+ assertEquals(new LinkedHashSet<>(List.of("type1")), resolve(cluster1, "&restrict=type1"));
+ assertEquals(new LinkedHashSet<>(List.of("type2")), resolve(cluster1, "&restrict=type2"));
+ assertEquals(new LinkedHashSet<>(List.of("type2", "type3")), resolve(cluster1, "&restrict=type2,type3"));
+ assertEquals(new LinkedHashSet<>(List.of("type2")), resolve(cluster1, "&restrict=type2,type4"));
+ assertEquals(new LinkedHashSet<>(List.of()), resolve(cluster1, "&restrict=type4"));
}
{ // specify sources
- assertEquals(new LinkedHashSet<>(Arrays.asList("type1", "type2", "type3")), resolve(cluster1, "&sources=cluster1"));
- assertEquals(new LinkedHashSet<>(Arrays.asList()), resolve(cluster1, "&sources=cluster2"));
- assertEquals(new LinkedHashSet<>(Arrays.asList()), resolve(cluster1, "&sources=type1"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type6")), resolve(type1, "&sources=type1"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2")), resolve(cluster1, "&sources=type2"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2", "type3")), resolve(cluster1, "&sources=type2,type3"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2")), resolve(cluster1, "&sources=type2,type4"));
- assertEquals(new LinkedHashSet<>(Arrays.asList()), resolve(cluster1, "&sources=type4"));
+ assertEquals(new LinkedHashSet<>(List.of("type1", "type2", "type3")), resolve(cluster1, "&sources=cluster1"));
+ assertEquals(new LinkedHashSet<>(List.of()), resolve(cluster1, "&sources=cluster2"));
+ assertEquals(new LinkedHashSet<>(List.of()), resolve(cluster1, "&sources=type1"));
+ assertEquals(new LinkedHashSet<>(List.of("type6")), resolve(type1, "&sources=type1"));
+ assertEquals(new LinkedHashSet<>(List.of("type2")), resolve(cluster1, "&sources=type2"));
+ assertEquals(new LinkedHashSet<>(List.of("type2", "type3")), resolve(cluster1, "&sources=type2,type3"));
+ assertEquals(new LinkedHashSet<>(List.of("type2")), resolve(cluster1, "&sources=type2,type4"));
+ assertEquals(new LinkedHashSet<>(List.of()), resolve(cluster1, "&sources=type4"));
}
{ // specify both
- assertEquals(new LinkedHashSet<>(Arrays.asList("type1")), resolve(cluster1, "&sources=cluster1&restrict=type1"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2")), resolve(cluster1, "&sources=cluster1&restrict=type2"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2", "type3")), resolve(cluster1, "&sources=cluster1&restrict=type2,type3"));
- assertEquals(new LinkedHashSet<>(Arrays.asList("type2")), resolve(cluster1, "&sources=cluster2&restrict=type2"));
+ assertEquals(new LinkedHashSet<>(List.of("type1")), resolve(cluster1, "&sources=cluster1&restrict=type1"));
+ assertEquals(new LinkedHashSet<>(List.of("type2")), resolve(cluster1, "&sources=cluster1&restrict=type2"));
+ assertEquals(new LinkedHashSet<>(List.of("type2", "type3")), resolve(cluster1, "&sources=cluster1&restrict=type2,type3"));
+ assertEquals(new LinkedHashSet<>(List.of("type2")), resolve(cluster1, "&sources=cluster2&restrict=type2"));
}
} finally {
type1.deconstruct();
@@ -181,15 +172,15 @@ public class ClusterSearcherTestCase {
}
private void init() {
- results.put(type1, Arrays.asList(createHit(getId(type1, 0), 9),
+ results.put(type1, List.of(createHit(getId(type1, 0), 9),
createHit(getId(type1, 1), 6),
createHit(getId(type1, 2), 3)));
- results.put(type2, Arrays.asList(createHit(getId(type2, 0), 10),
+ results.put(type2, List.of(createHit(getId(type2, 0), 10),
createHit(getId(type2, 1), 7),
createHit(getId(type2, 2), 4)));
- results.put(type3, Arrays.asList(createHit(getId(type3, 0), 11),
+ results.put(type3, List.of(createHit(getId(type3, 0), 11),
createHit(getId(type3, 1), 8),
createHit(getId(type3, 2), 5)));
}
@@ -253,11 +244,11 @@ public class ClusterSearcherTestCase {
}
private Execution createExecution() {
- return createExecution(Arrays.asList("type1", "type2", "type3"), false);
+ return createExecution(List.of("type1", "type2", "type3"), false);
}
private Execution createExecution(boolean expectAttributePrefetch) {
- return createExecution(Arrays.asList("type1", "type2", "type3"), expectAttributePrefetch);
+ return createExecution(List.of("type1", "type2", "type3"), expectAttributePrefetch);
}
private Execution createExecution(List<String> docTypesList, boolean expectAttributePrefetch) {
@@ -297,7 +288,7 @@ public class ClusterSearcherTestCase {
// NB ! Empty restrict sets does not exist below the cluster searcher.
// restrict set is set by cluster searcher to tell which documentdb is used.
// Modify test to mirror that change.
- Execution execution = createExecution(Arrays.asList("type1"), false);
+ Execution execution = createExecution(List.of("type1"), false);
Query query = new Query("?query=hello");
com.yahoo.search.Result result = execution.search(query);
assertEquals(3, result.getTotalHitCount());
@@ -387,24 +378,24 @@ public class ClusterSearcherTestCase {
Execution ex = createExecution();
// all types
- assertResult(9, Arrays.asList(11.0, 10.0), getResult(0, 2, ex));
- assertResult(9, Arrays.asList(10.0, 9.0), getResult(1, 2, ex));
- assertResult(9, Arrays.asList(9.0, 8.0), getResult(2, 2, ex));
- assertResult(9, Arrays.asList(8.0, 7.0), getResult(3, 2, ex));
- assertResult(9, Arrays.asList(7.0, 6.0), getResult(4, 2, ex));
- assertResult(9, Arrays.asList(6.0, 5.0), getResult(5, 2, ex));
- assertResult(9, Arrays.asList(5.0, 4.0), getResult(6, 2, ex));
- assertResult(9, Arrays.asList(4.0, 3.0), getResult(7, 2, ex));
- assertResult(9, Arrays.asList(3.0), getResult(8, 2, ex));
- assertResult(9, new ArrayList<>(), getResult(9, 2, ex));
- assertResult(9, Arrays.asList(11.0, 10.0, 9.0, 8.0, 7.0), getResult(0, 5, ex));
- assertResult(9, Arrays.asList(6.0, 5.0, 4.0, 3.0), getResult(5, 5, ex));
+ assertResult(9, List.of(11.0, 10.0), getResult(0, 2, ex));
+ assertResult(9, List.of(10.0, 9.0), getResult(1, 2, ex));
+ assertResult(9, List.of(9.0, 8.0), getResult(2, 2, ex));
+ assertResult(9, List.of(8.0, 7.0), getResult(3, 2, ex));
+ assertResult(9, List.of(7.0, 6.0), getResult(4, 2, ex));
+ assertResult(9, List.of(6.0, 5.0), getResult(5, 2, ex));
+ assertResult(9, List.of(5.0, 4.0), getResult(6, 2, ex));
+ assertResult(9, List.of(4.0, 3.0), getResult(7, 2, ex));
+ assertResult(9, List.of(3.0), getResult(8, 2, ex));
+ assertResult(9, List.of(), getResult(9, 2, ex));
+ assertResult(9, List.of(11.0, 10.0, 9.0, 8.0, 7.0), getResult(0, 5, ex));
+ assertResult(9, List.of(6.0, 5.0, 4.0, 3.0), getResult(5, 5, ex));
// restrict=type1
- assertResult(3, Arrays.asList(9.0, 6.0), getResult(0, 2, "&restrict=type1", ex));
- assertResult(3, Arrays.asList(6.0, 3.0), getResult(1, 2, "&restrict=type1", ex));
- assertResult(3, Arrays.asList(3.0), getResult(2, 2, "&restrict=type1", ex));
- assertResult(3, new ArrayList<>(), getResult(3, 2, "&restrict=type1", ex));
+ assertResult(3, List.of(9.0, 6.0), getResult(0, 2, "&restrict=type1", ex));
+ assertResult(3, List.of(6.0, 3.0), getResult(1, 2, "&restrict=type1", ex));
+ assertResult(3, List.of(3.0), getResult(2, 2, "&restrict=type1", ex));
+ assertResult(3, List.of(), getResult(3, 2, "&restrict=type1", ex));
}
@Test
@@ -415,13 +406,13 @@ public class ClusterSearcherTestCase {
com.yahoo.search.Result result = getResult(0, 2, extra, ex);
assertEquals(3.0, result.hits().asList().get(0).getField("asc-score"));
assertEquals(4.0, result.hits().asList().get(1).getField("asc-score"));
- assertResult(6, Arrays.asList(3.0, 4.0), getResult(0, 2, extra, ex));
- assertResult(6, Arrays.asList(4.0, 6.0), getResult(1, 2, extra, ex));
- assertResult(6, Arrays.asList(6.0, 7.0), getResult(2, 2, extra, ex));
- assertResult(6, Arrays.asList(7.0, 9.0), getResult(3, 2, extra, ex));
- assertResult(6, Arrays.asList(9.0, 10.0), getResult(4, 2, extra, ex));
- assertResult(6, Arrays.asList(10.0), getResult(5, 2, extra, ex));
- assertResult(6, new ArrayList<>(), getResult(6, 2, extra, ex));
+ assertResult(6, List.of(3.0, 4.0), getResult(0, 2, extra, ex));
+ assertResult(6, List.of(4.0, 6.0), getResult(1, 2, extra, ex));
+ assertResult(6, List.of(6.0, 7.0), getResult(2, 2, extra, ex));
+ assertResult(6, List.of(7.0, 9.0), getResult(3, 2, extra, ex));
+ assertResult(6, List.of(9.0, 10.0), getResult(4, 2, extra, ex));
+ assertResult(6, List.of(10.0), getResult(5, 2, extra, ex));
+ assertResult(6, List.of(), getResult(6, 2, extra, ex));
}
private static ClusterSearcher createSearcher(String clusterName, Double maxQueryTimeout, Double maxQueryCacheTimeout,
@@ -449,8 +440,7 @@ public class ClusterSearcherTestCase {
Dispatcher dispatcher = new Dispatcher(new RpcResourcePool(dispatchConfig),
ComponentId.createAnonymousComponentId("test-id"),
dispatchConfig,
- vipStatus,
- new MockMetric());
+ vipStatus);
ComponentRegistry<Dispatcher> dispatchers = new ComponentRegistry<>();
dispatchers.register(new ComponentId("dispatcher." + clusterName), dispatcher);
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java
index baa049e8c66..6d2f7efec38 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java
@@ -34,7 +34,7 @@ class MockDispatcher extends Dispatcher {
}
private MockDispatcher(ClusterMonitor clusterMonitor, SearchCluster searchCluster, DispatchConfig dispatchConfig, RpcInvokerFactory invokerFactory) {
- super(clusterMonitor, searchCluster, dispatchConfig, invokerFactory, new MockMetric());
+ super(clusterMonitor, searchCluster, dispatchConfig, invokerFactory);
this.clusterMonitor = clusterMonitor;
}
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockMetric.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockMetric.java
deleted file mode 100644
index 7c1d9c7ae05..00000000000
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockMetric.java
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.prelude.fastsearch.test;
-
-import com.yahoo.jdisc.Metric;
-
-import java.util.Map;
-
-public class MockMetric implements Metric {
- @Override
- public void set(String key, Number val, Context ctx) {
- }
-
- @Override
- public void add(String key, Number val, Context ctx) {
- }
-
- @Override
- public Context createContext(Map<String, ?> properties) {
- return null;
- }
-}
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
index 715154e85ba..b9c724a6e26 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
@@ -2,11 +2,9 @@
package com.yahoo.search.dispatch;
import com.yahoo.prelude.fastsearch.VespaBackEndSearcher;
-import com.yahoo.prelude.fastsearch.test.MockMetric;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.cluster.ClusterMonitor;
-import com.yahoo.search.dispatch.searchcluster.Group;
import com.yahoo.search.dispatch.searchcluster.Node;
import com.yahoo.search.dispatch.searchcluster.PingFactory;
import com.yahoo.search.dispatch.searchcluster.Pinger;
@@ -16,7 +14,6 @@ import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.Optional;
-import java.util.OptionalInt;
import static com.yahoo.search.dispatch.MockSearchCluster.createDispatchConfig;
import static org.junit.jupiter.api.Assertions.*;
@@ -36,7 +33,7 @@ public class DispatcherTest {
assertEquals(1, nodes.get(0).key());
return true;
});
- Dispatcher disp = new Dispatcher(new ClusterMonitor(cl, false), cl, createDispatchConfig(), invokerFactory, new MockMetric());
+ Dispatcher disp = new Dispatcher(new ClusterMonitor(cl, false), cl, createDispatchConfig(), invokerFactory);
SearchInvoker invoker = disp.getSearchInvoker(q, null);
invokerFactory.verifyAllEventsProcessed();
disp.deconstruct();
@@ -51,7 +48,7 @@ public class DispatcherTest {
}
};
MockInvokerFactory invokerFactory = new MockInvokerFactory(cl, (n, a) -> true);
- Dispatcher disp = new Dispatcher(new ClusterMonitor(cl, false), cl, createDispatchConfig(), invokerFactory, new MockMetric());
+ Dispatcher disp = new Dispatcher(new ClusterMonitor(cl, false), cl, createDispatchConfig(), invokerFactory);
SearchInvoker invoker = disp.getSearchInvoker(new Query(), null);
invokerFactory.verifyAllEventsProcessed();
disp.deconstruct();
@@ -68,7 +65,7 @@ public class DispatcherTest {
assertTrue(acceptIncompleteCoverage);
return true;
});
- Dispatcher disp = new Dispatcher(new ClusterMonitor(cl, false), cl, createDispatchConfig(), invokerFactory, new MockMetric());
+ Dispatcher disp = new Dispatcher(new ClusterMonitor(cl, false), cl, createDispatchConfig(), invokerFactory);
SearchInvoker invoker = disp.getSearchInvoker(new Query(), null);
invokerFactory.verifyAllEventsProcessed();
disp.deconstruct();
@@ -80,7 +77,7 @@ public class DispatcherTest {
SearchCluster cl = new MockSearchCluster("1", 2, 1);
MockInvokerFactory invokerFactory = new MockInvokerFactory(cl, (n, a) -> false, (n, a) -> false);
- Dispatcher disp = new Dispatcher(new ClusterMonitor(cl, false), cl, createDispatchConfig(), invokerFactory, new MockMetric());
+ Dispatcher disp = new Dispatcher(new ClusterMonitor(cl, false), cl, createDispatchConfig(), invokerFactory);
disp.getSearchInvoker(new Query(), null);
disp.deconstruct();
fail("Expected exception");
@@ -93,7 +90,7 @@ public class DispatcherTest {
@Test
void testGroup0IsSelected() {
SearchCluster cluster = new MockSearchCluster("1", 3, 1);
- Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true), new MockMetric());
+ Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true));
cluster.pingIterationCompleted();
assertEquals(0,
dispatcher.getSearchInvoker(new Query(), null).distributionKey().get().longValue());
@@ -103,7 +100,7 @@ public class DispatcherTest {
@Test
void testGroup0IsSkippedWhenItIsBlockingFeed() {
SearchCluster cluster = new MockSearchCluster("1", 3, 1);
- Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true), new MockMetric());
+ Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true));
cluster.group(0).get().nodes().get(0).setBlockingWrites(true);
cluster.pingIterationCompleted();
assertEquals(1,
@@ -115,7 +112,7 @@ public class DispatcherTest {
@Test
void testGroup0IsSelectedWhenMoreAreBlockingFeed() {
SearchCluster cluster = new MockSearchCluster("1", 3, 1);
- Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true), new MockMetric());
+ Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true));
cluster.group(0).get().nodes().get(0).setBlockingWrites(true);
cluster.group(1).get().nodes().get(0).setBlockingWrites(true);
cluster.pingIterationCompleted();
@@ -128,7 +125,7 @@ public class DispatcherTest {
@Test
void testGroup0IsSelectedWhenItIsBlockingFeedWhenNoOthers() {
SearchCluster cluster = new MockSearchCluster("1", 1, 1);
- Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true), new MockMetric());
+ Dispatcher dispatcher = new Dispatcher(new ClusterMonitor(cluster, false), cluster, createDispatchConfig(), new MockInvokerFactory(cluster, (n, a) -> true));
cluster.group(0).get().nodes().get(0).setBlockingWrites(true);
cluster.pingIterationCompleted();
assertEquals(0,