diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-03 09:39:05 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-03 09:39:05 +0100 |
commit | 0414eda77c5afd8c90a0f90cde25e2c356a5cca1 (patch) | |
tree | 9da2358bf1c7f38fcf4818b593fcc18aaa081bda | |
parent | b18b79462651ff94daa9de70040961d838803157 (diff) |
- Name the monitor thread and make it a daemon.
6 files changed, 17 insertions, 12 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java b/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java index 016e22839c1..360dcd38d3b 100644 --- a/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java +++ b/container-search/src/main/java/com/yahoo/search/cluster/ClusterMonitor.java @@ -47,7 +47,7 @@ public class ClusterMonitor<T> { public ClusterMonitor(NodeManager<T> manager, boolean startPingThread) { nodeManager = manager; - monitorThread = new MonitorThread("search.clustermonitor"); + monitorThread = new MonitorThread("search.clustermonitor." + manager.name()); if (startPingThread) { monitorThread.start(); } @@ -81,7 +81,9 @@ public class ClusterMonitor<T> { /** * Returns the monitor of the given node, or null if this node has not been added + * @deprecated Will be removed in Vespa 8. */ + @Deprecated(forRemoval = true, since = "7.537") public BaseNodeMonitor<T> getNodeMonitor(T node) { return nodeMonitors.get(node); } @@ -147,6 +149,7 @@ public class ClusterMonitor<T> { private class MonitorThread extends Thread { MonitorThread(String name) { super(name); + setDaemon(true); } public void run() { diff --git a/container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java b/container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java index 51ae2ee432d..097d714b47b 100644 --- a/container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java +++ b/container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java @@ -51,7 +51,7 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod * @param internal whether or not this cluster is internal (part of the same installation) */ public ClusterSearcher(ComponentId id, List<T> connections, boolean internal) { - this(id, connections, new Hasher<T>(), internal); + this(id, connections, new Hasher<>(), internal); } public ClusterSearcher(ComponentId id, List<T> connections, Hasher<T> hasher, boolean internal) { @@ -68,6 +68,9 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod } } + @Override + public String name() { return getIdString(); } + /** Pinging a node, called from ClusterMonitor */ @Override public final void ping(ClusterMonitor<T> clusterMonitor, T p, Executor executor) { @@ -112,7 +115,7 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod if (k == null) { b.append("null\n"); } else { - b.append(k.toString()).append('\n'); + b.append(k).append('\n'); } } traceAsString = b.toString(); @@ -303,7 +306,7 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod private class Pinger implements Callable<Pong> { - private T connection; + private final T connection; public Pinger(T connection) { this.connection = connection; diff --git a/container-search/src/main/java/com/yahoo/search/cluster/NodeManager.java b/container-search/src/main/java/com/yahoo/search/cluster/NodeManager.java index 1a74194d694..db583a65606 100644 --- a/container-search/src/main/java/com/yahoo/search/cluster/NodeManager.java +++ b/container-search/src/main/java/com/yahoo/search/cluster/NodeManager.java @@ -11,6 +11,9 @@ import java.util.concurrent.Executor; */ public interface NodeManager<T> { + /** Name to identify Nodemanager */ + default String name() { return ""; } + /** Called when a failed node is working (ready for production) again */ void working(T node); 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 3cf2903b88f..e09b1d51733 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 @@ -46,17 +46,12 @@ import java.util.stream.Collectors; public class Dispatcher extends AbstractComponent { public static final String DISPATCH = "dispatch"; - private static final String INTERNAL = "internal"; - private static final String PROTOBUF = "protobuf"; 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 enabled, search queries will use protobuf rpc */ - public static final CompoundName dispatchProtobuf = CompoundName.fromComponents(DISPATCH, PROTOBUF); - /** If set will control computation of how many hits will be fetched from each partition.*/ public static final CompoundName topKProbability = CompoundName.fromComponents(DISPATCH, TOP_K_PROBABILITY); @@ -79,8 +74,6 @@ public class Dispatcher extends AbstractComponent { argumentType = new QueryProfileType(DISPATCH); argumentType.setStrict(true); argumentType.setBuiltin(true); - argumentType.addField(new FieldDescription(INTERNAL, FieldType.booleanType)); - argumentType.addField(new FieldDescription(PROTOBUF, FieldType.booleanType)); argumentType.addField(new FieldDescription(TOP_K_PROBABILITY, FieldType.doubleType)); argumentType.freeze(); } diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java index f90abba330a..36d7e7a85a9 100644 --- a/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java +++ b/container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java @@ -84,6 +84,9 @@ public class SearchCluster implements NodeManager<Node> { this.localCorpusDispatchTarget = findLocalCorpusDispatchTarget(HostName.getLocalhost(), nodesByHost, groups); } + @Override + public String name() { return clusterId; } + public void addMonitoring(ClusterMonitor<Node> clusterMonitor) { for (var group : orderedGroups()) { for (var node : group.nodes()) diff --git a/container-search/src/test/java/com/yahoo/search/cluster/test/ClusteredConnectionTestCase.java b/container-search/src/test/java/com/yahoo/search/cluster/test/ClusteredConnectionTestCase.java index 1e35b6447ff..fa8d237aee0 100644 --- a/container-search/src/test/java/com/yahoo/search/cluster/test/ClusteredConnectionTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/cluster/test/ClusteredConnectionTestCase.java @@ -133,7 +133,7 @@ public class ClusteredConnectionTestCase { /** Represents a connection, e.g over http, in this test */ private static class Connection { - private String id; + private final String id; private boolean inService = true; |