aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-10-25 13:33:09 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-10-25 13:33:09 +0200
commitcc7153b5c502bfdfa9603182cfe6848f955075de (patch)
tree2da646cad6d24c5c4c35ef26d6ac1a1940897169 /container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
parent0087412bb6e46c06ba66705a11121f522f0bfc02 (diff)
Create one Dispatcher component per search cluster
This avoids creating an excessive number of connections to search clusters when the application (incorrectly) creates many local provider chains to the same search cluster.
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java')
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java17
1 files changed, 12 insertions, 5 deletions
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 f35d77de01a..6970093fc9d 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
@@ -3,6 +3,7 @@ package com.yahoo.prelude.cluster;
import com.yahoo.cloud.config.ClusterInfoConfig;
import com.yahoo.component.ComponentId;
+import com.yahoo.component.provider.ComponentRegistry;
import com.yahoo.container.QrConfig;
import com.yahoo.container.QrSearchersConfig;
import com.yahoo.container.handler.ClustersStatus;
@@ -19,6 +20,7 @@ import com.yahoo.prelude.fastsearch.test.MockMetric;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.config.ClusterConfig;
+import com.yahoo.search.dispatch.Dispatcher;
import com.yahoo.search.result.Hit;
import com.yahoo.search.searchchain.Execution;
import com.yahoo.vespa.config.search.DispatchConfig;
@@ -492,8 +494,7 @@ public class ClusterSearcherTestCase {
}
private static ClusterSearcher createSearcher(String clusterName, Double maxQueryTimeout, Double maxQueryCacheTimeout,
- boolean streamingMode, VipStatus vipStatus)
- {
+ boolean streamingMode, VipStatus vipStatus) {
QrSearchersConfig.Builder qrSearchersConfig = new QrSearchersConfig.Builder();
QrSearchersConfig.Searchcluster.Builder searchClusterConfig = new QrSearchersConfig.Searchcluster.Builder();
searchClusterConfig.name(clusterName);
@@ -512,13 +513,19 @@ public class ClusterSearcherTestCase {
DocumentdbInfoConfig.Builder documentDbConfig = new DocumentdbInfoConfig.Builder();
documentDbConfig.documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("type1"));
+ Dispatcher dispatcher = new Dispatcher(new ComponentId("test-id"),
+ new DispatchConfig.Builder().build(),
+ createClusterInfoConfig(),
+ vipStatus,
+ new MockMetric());
+ ComponentRegistry<Dispatcher> dispatchers = new ComponentRegistry<>();
+ dispatchers.register(new ComponentId("dispatcher." + clusterName), dispatcher);
+
return new ClusterSearcher(new ComponentId("test-id"),
qrSearchersConfig.build(),
clusterConfig.build(),
documentDbConfig.build(),
- new DispatchConfig.Builder().build(),
- createClusterInfoConfig(),
- new MockMetric(),
+ dispatchers,
new FS4ResourcePool(new QrConfig.Builder().build()),
vipStatus);
}