summaryrefslogtreecommitdiffstats
path: root/container-search
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-08-18 09:52:08 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-08-18 09:52:08 +0200
commitc5439e4a4a77e4d77c475b79e59d1e6c235ccf5a (patch)
treea1ff61d232d66a165ffd07c9fd0faf66acb07f53 /container-search
parent85b2ed4d1107153e7df43a4e3c94e073770579bb (diff)
Use the right fs4 port when talking to search nodes
Diffstat (limited to 'container-search')
-rw-r--r--container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java2
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java21
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/MockDispatcher.java3
3 files changed, 14 insertions, 12 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java
index 2f10169cbea..34ebd58b4d6 100644
--- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java
+++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java
@@ -258,7 +258,7 @@ public class FastSearcher extends VespaBackEndSearcher {
if ( ! localSearchNode.isWorking()) return dispatchBackend;
query.trace(false, 2, "Dispatching directly to ", localSearchNode);
- return fs4ResourcePool.getBackend(localSearchNode.hostname(), localSearchNode.port());
+ return fs4ResourcePool.getBackend(localSearchNode.hostname(), localSearchNode.fs4port());
}
/**
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java b/container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java
index 52e547cea00..ff0d420027f 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/SearchCluster.java
@@ -82,7 +82,7 @@ public class SearchCluster implements NodeManager<SearchCluster.Node> {
private static ImmutableList<Node> toNodes(DispatchConfig dispatchConfig) {
ImmutableList.Builder<Node> nodesBuilder = new ImmutableList.Builder<>();
for (DispatchConfig.Node node : dispatchConfig.node())
- nodesBuilder.add(new Node(node.host(), node.port(), node.group()));
+ nodesBuilder.add(new Node(node.host(), node.fs4port(), node.group()));
return nodesBuilder.build();
}
@@ -170,8 +170,8 @@ public class SearchCluster implements NodeManager<SearchCluster.Node> {
public Pong call() {
try {
- Pong pong = FastSearcher.ping(new Ping(clusterMonitor.getConfiguration().getRequestTimeout()),
- fs4ResourcePool.getBackend(node.hostname(), node.port()), node.toString());
+ Pong pong = FastSearcher.ping(new Ping(clusterMonitor.getConfiguration().getRequestTimeout()),
+ fs4ResourcePool.getBackend(node.hostname(), node.fs4port()), node.toString());
if (pong.activeDocuments().isPresent())
node.setActiveDocuments(pong.activeDocuments().get());
return pong;
@@ -238,20 +238,21 @@ public class SearchCluster implements NodeManager<SearchCluster.Node> {
public static class Node {
private final String hostname;
- private final int port;
+ private final int fs4port;
private final int group;
private final AtomicBoolean working = new AtomicBoolean(true);
private final AtomicLong activeDocuments = new AtomicLong(0);
- public Node(String hostname, int port, int group) {
+ public Node(String hostname, int fs4port, int group) {
this.hostname = hostname;
- this.port = port;
+ this.fs4port = fs4port;
this.group = group;
}
public String hostname() { return hostname; }
- public int port() { return port; }
+
+ public int fs4port() { return fs4port; }
/** Returns the id of this group this node belongs to */
public int group() { return group; }
@@ -274,7 +275,7 @@ public class SearchCluster implements NodeManager<SearchCluster.Node> {
}
@Override
- public int hashCode() { return Objects.hash(hostname, port); }
+ public int hashCode() { return Objects.hash(hostname, fs4port); }
@Override
public boolean equals(Object o) {
@@ -282,12 +283,12 @@ public class SearchCluster implements NodeManager<SearchCluster.Node> {
if ( ! (o instanceof Node)) return false;
Node other = (Node)o;
if ( ! Objects.equals(this.hostname, other.hostname)) return false;
- if ( ! Objects.equals(this.port, other.port)) return false;
+ if ( ! Objects.equals(this.fs4port, other.fs4port)) return false;
return true;
}
@Override
- public String toString() { return "search node " + hostname + ":" + port + " in group " + group; }
+ public String toString() { return "search node " + hostname + ":" + fs4port + " in group " + group; }
}
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 1de03a5494a..b4a631ff474 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
@@ -24,7 +24,8 @@ class MockDispatcher extends Dispatcher {
for (SearchCluster.Node node : nodes) {
DispatchConfig.Node.Builder dispatchConfigNodeBuilder = new DispatchConfig.Node.Builder();
dispatchConfigNodeBuilder.host(node.hostname());
- dispatchConfigNodeBuilder.port(node.port());
+ dispatchConfigNodeBuilder.fs4port(node.fs4port());
+ dispatchConfigNodeBuilder.port(0); // Mandatory, but currently not used here
dispatchConfigNodeBuilder.group(node.group());
dispatchConfigNodeBuilder.key(key++); // not used
dispatchConfigBuilder.node(dispatchConfigNodeBuilder);