diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2018-04-05 22:41:15 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2018-04-05 22:47:25 +0200 |
commit | 8d5749959bb215068541a5abf0b49f4030e44388 (patch) | |
tree | f862e29eb59a54ea62ff0c12ddba54f0f7e0038e /container-search | |
parent | 97874347c52fafaf81f5c51f23816fdd99c7436c (diff) |
Clean out some unknown debug code.
Diffstat (limited to 'container-search')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java | 68 | ||||
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java | 10 |
2 files changed, 22 insertions, 56 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java index 968504ec018..8341cf6884c 100644 --- a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java @@ -10,8 +10,6 @@ import com.yahoo.concurrent.Receiver; import com.yahoo.concurrent.Receiver.MessageState; import com.yahoo.container.QrSearchersConfig; import com.yahoo.container.handler.VipStatus; -import com.yahoo.container.protect.Error; -import com.yahoo.fs4.PacketDumper; import com.yahoo.fs4.mplex.Backend; import com.yahoo.container.search.LegacyEmulationConfig; import com.yahoo.net.HostName; @@ -39,10 +37,18 @@ import com.yahoo.statistics.Value; import com.yahoo.vespa.config.search.DispatchConfig; import com.yahoo.vespa.streamingvisitors.VdsStreamingSearcher; -import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.ScheduledExecutorService; import java.util.logging.Level; @@ -70,8 +76,6 @@ public class ClusterSearcher extends Searcher { private final String clusterModelName; - private final List<Backend> backends = new ArrayList<>(); - // The set of document types contained in this search cluster private final Set<String> documentTypes; @@ -155,7 +159,6 @@ public class ClusterSearcher extends Searcher { FastSearcher searcher = searchDispatch(searchClusterIndex, fs4ResourcePool, searchClusterConfig, cacheParams, emulationConfig, docSumParams, documentDbConfig, b, dispatcher, dispatcherIndex); - backends.add(b); addBackendSearcher(searcher); } } catch (UnknownHostException e) { @@ -163,10 +166,8 @@ public class ClusterSearcher extends Searcher { } } } - if ( backends.size() != 1 ) { - log.log(Level.SEVERE, "ClusterSearcher should have a local top level dispatch." - + " The possibility to configure dispatchers explicitly will be removed" - + " in a future release."); + if ( server == null ) { + log.log(Level.SEVERE, "ClusterSearcher should have a top level dispatch."); } monitor.freeze(); monitor.startPingThread(); @@ -185,10 +186,9 @@ public class ClusterSearcher extends Searcher { * Returns false if this host is local. */ boolean isRemote(String host) throws UnknownHostException { - if (InetAddress.getByName(host).isLoopbackAddress()) - return false; - else - return !host.equals(HostName.getLocalhost()); + return (InetAddress.getByName(host).isLoopbackAddress()) + ? false + : !host.equals(HostName.getLocalhost()); } private static ClusterParams makeClusterParams(int searchclusterIndex, @@ -211,10 +211,8 @@ public class ClusterSearcher extends Searcher { Backend backend, Dispatcher dispatcher, int dispatcherIndex) { - ClusterParams clusterParams = makeClusterParams(searchclusterIndex, - searchClusterConfig, - emulConfig, - dispatcherIndex); + ClusterParams clusterParams = makeClusterParams(searchclusterIndex, searchClusterConfig, + emulConfig, dispatcherIndex); return new FastSearcher(backend, fs4ResourcePool, dispatcher, docSumParams, clusterParams, cacheParams, documentdbInfoConfig); } @@ -225,9 +223,7 @@ public class ClusterSearcher extends Searcher { LegacyEmulationConfig emulConfig, SummaryParameters docSumParams, DocumentdbInfoConfig documentdbInfoConfig) { - ClusterParams clusterParams = makeClusterParams(searchclusterIndex, - searchClusterConfig, - emulConfig, 0); + ClusterParams clusterParams = makeClusterParams(searchclusterIndex, searchClusterConfig, emulConfig, 0); VdsStreamingSearcher searcher = (VdsStreamingSearcher) VespaBackEndSearcher .getSearcher("com.yahoo.vespa.streamingvisitors.VdsStreamingSearcher"); searcher.setSearchClusterConfigId(searchClusterConfig.rankprofiles().configid()); @@ -249,14 +245,6 @@ public class ClusterSearcher extends Searcher { maxQueryCacheTimeout = DEFAULT_MAX_QUERY_CACHE_TIMEOUT; } - public Map<String, Backend.BackendStatistics> getBackendStatistics() { - Map<String, Backend.BackendStatistics> backendStatistics = new TreeMap<>(); - for (Backend backend : backends) { - backendStatistics.put(backend.toString(), backend.getStatistics()); - } - return backendStatistics; - } - private Backend createBackend(QrSearchersConfig.Searchcluster.Dispatcher disp) { return fs4ResourcePool.getBackend(disp.host(), disp.port()); } @@ -472,11 +460,9 @@ public class ClusterSearcher extends Searcher { Set<String> restrict = query.getModel().getRestrict(); if (restrict == null || restrict.isEmpty()) { Set<String> sources = query.getModel().getSources(); - if (sources == null || sources.isEmpty()) { - return documentTypes; - } else { - return new HashSet<>(indexFacts.newSession(sources, Collections.emptyList(), documentTypes).documentTypes()); - } + return (sources == null || sources.isEmpty()) + ? documentTypes + : new HashSet<>(indexFacts.newSession(sources, Collections.emptyList(), documentTypes).documentTypes()); } else { return filterValidDocumentTypes(restrict); } @@ -550,12 +536,6 @@ public class ClusterSearcher extends Searcher { return pong.activeNodes().get() > 0; } - public void dumpPackets(PacketDumper.PacketType packetType, boolean on) throws IOException { - for (Backend b : backends) { - b.dumpPackets(packetType, on); - } - } - @Override public void deconstruct() { monitor.shutdown(); @@ -591,11 +571,7 @@ public class ClusterSearcher extends Searcher { public Pong getPong() throws InterruptedException { Tuple2<MessageState, Pong> reply = pong.get(pingChallenge.getTimeout() + 150); - if (reply.first != MessageState.VALID) { - return null; - } else { - return reply.second; - } + return (reply.first != MessageState.VALID) ? null : reply.second; } } diff --git a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java index 4161f814866..4e8f516c9a1 100644 --- a/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java +++ b/container-search/src/main/java/com/yahoo/search/handler/SearchHandler.java @@ -10,7 +10,6 @@ import com.yahoo.component.chain.ChainsConfigurer; import com.yahoo.component.chain.model.ChainsModel; import com.yahoo.component.chain.model.ChainsModelBuilder; import com.yahoo.component.provider.ComponentRegistry; -import com.yahoo.container.Container; import com.yahoo.container.QrSearchersConfig; import com.yahoo.container.core.ChainsConfig; import com.yahoo.container.core.ContainerHttpConfig; @@ -38,7 +37,6 @@ import com.yahoo.search.Query; import com.yahoo.search.Result; import com.yahoo.search.Searcher; import com.yahoo.search.config.IndexInfoConfig; -import com.yahoo.search.debug.DebugRpcAdaptor; import com.yahoo.search.query.profile.QueryProfileRegistry; import com.yahoo.search.query.profile.compiled.CompiledQueryProfile; import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry; @@ -57,7 +55,6 @@ import com.yahoo.statistics.Value; import com.yahoo.vespa.configdefinition.SpecialtokensConfig; import edu.umd.cs.findbugs.annotations.NonNull; -import java.util.Map; import java.util.Optional; import java.util.concurrent.Executor; import java.util.concurrent.ThreadPoolExecutor; @@ -98,13 +95,6 @@ public class SearchHandler extends LoggingRequestHandler { private static final String fallbackSearchChain = "vespa"; private static final CompoundName FORCE_TIMESTAMPS = new CompoundName("trace.timestamps");; - // This is a hack to add the RPC adaptors for search only once - // TODO: Figure out the correct life cycle and init of RPC adaptors - static { - Container c = Container.get(); - c.addOptionalRpcAdaptor(new DebugRpcAdaptor()); - } - private final Linguistics linguistics; private final CompiledQueryProfileRegistry queryProfileRegistry; |