diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-04-11 13:50:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-11 13:50:26 +0200 |
commit | edd602076f3e9ce8d904811c309b4512a7f94741 (patch) | |
tree | 419b743252cd8b24ef93fb146024821cf42f5ddc /container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java | |
parent | f9ce8b229aed278a94c5425272a42ace6884bb73 (diff) |
Revert "Revert "Direct dispatch by default when group size is 1""
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/fastsearch/FastSearcher.java | 11 |
1 files changed, 2 insertions, 9 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 7b5ded6a9d6..7d822fd603b 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 @@ -66,8 +66,6 @@ public class FastSearcher extends VespaBackEndSearcher { private final FS4ResourcePool fs4ResourcePool; - private final String selfHostname; - /** * Creates a Fastsearcher. * @@ -91,7 +89,6 @@ public class FastSearcher extends VespaBackEndSearcher { this.dispatchBackend = dispatchBackend; this.fs4ResourcePool = fs4ResourcePool; this.dispatcher = dispatcher; - this.selfHostname = HostName.getLocalhost(); } private int countFastHits(Result result) { @@ -221,16 +218,12 @@ public class FastSearcher extends VespaBackEndSearcher { * for efficiency. */ private Backend chooseBackend(Query query) { - // TODO 2016-08-16: Turn this on by default (by changing the 'false' below to 'true') - if ( ! query.properties().getBoolean(dispatchDirect, false)) return dispatchBackend; - - // Don't use direct dispatch if the upstream ClusterSearcher did not chose the local dispatch - // as that probably means that we are in a failover situation - if ( ! dispatchBackend.getHost().equals(selfHostname)) return dispatchBackend; + if ( ! query.properties().getBoolean(dispatchDirect, true)) return dispatchBackend; Optional<SearchCluster.Node> directDispatchRecipient = dispatcher.searchCluster().directDispatchTarget(); if ( ! directDispatchRecipient.isPresent()) return dispatchBackend; + // Dispatch directly to the single, local search node query.trace(false, 2, "Dispatching directly to ", directDispatchRecipient.get()); return fs4ResourcePool.getBackend(directDispatchRecipient.get().hostname(), directDispatchRecipient.get().fs4port()); |