diff options
5 files changed, 18 insertions, 13 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java index 84e6a7f0bfc..2755ead9c3e 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/search/IndexedSearchCluster.java @@ -382,6 +382,7 @@ public abstract class IndexedSearchCluster extends SearchCluster nodeBuilder.group(node.getNodeSpec().groupIndex()); nodeBuilder.host(node.getHostName()); nodeBuilder.port(node.getRpcPort()); + nodeBuilder.fs4port(node.getDispatchPort()); if (tuning.dispatch.minActiveDocsCoverage != null) builder.min_activedocs_coverage(tuning.dispatch.minActiveDocsCoverage); builder.node(nodeBuilder); diff --git a/configdefinitions/src/vespa/dispatch.def b/configdefinitions/src/vespa/dispatch.def index c3effc09e96..29a046a9ee0 100644 --- a/configdefinitions/src/vespa/dispatch.def +++ b/configdefinitions/src/vespa/dispatch.def @@ -16,6 +16,8 @@ node[].group int default=0 # The host name of this search node node[].host string -# The port of this search node +# The rpc port of this search node node[].port int +# The legacy fs4 port of this search node +node[].fs4port int default=0 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); |