Class SearchCluster
- java.lang.Object
-
- com.yahoo.search.dispatch.searchcluster.SearchCluster
-
- All Implemented Interfaces:
NodeManager<Node>
public class SearchCluster extends java.lang.Object implements NodeManager<Node>
A model of a search cluster we might want to dispatch queries to.- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description SearchCluster(java.lang.String clusterId, com.yahoo.vespa.config.search.DispatchConfig dispatchConfig, int containerClusterSize, com.yahoo.container.handler.VipStatus vipStatus, PingFactory pingFactory)
SearchCluster(java.lang.String clusterId, com.yahoo.vespa.config.search.DispatchConfig dispatchConfig, com.yahoo.container.handler.VipStatus vipStatus, PingFactory pingFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMonitoring(ClusterMonitor clusterMonitor)
com.yahoo.vespa.config.search.DispatchConfig
dispatchConfig()
int
estimateHitsToFetch(int wantedHits, int numPartitions)
int
estimateHitsToFetch(int wantedHits, int numPartitions, double topKProbability)
void
failed(Node node)
Called by the cluster monitor when node state changes to failedjava.util.Optional<Group>
group(int n)
Returns the n'th (zero-indexed) group in the cluster if possiblecom.google.common.collect.ImmutableMap<java.lang.Integer,Group>
groups()
Returns the groups of this cluster as an immutable map indexed by group idint
groupSize()
Returns the number of nodes per group - size()/groups.size()int
groupsWithSufficientCoverage()
boolean
hasInformationAboutAllNodes()
boolean
isPartialGroupCoverageSufficient(java.util.OptionalInt knownGroupId, java.util.List<Node> nodes)
Calculate whether a subset of nodes in a group has enough coveragejava.util.Optional<Node>
localCorpusDispatchTarget()
Returns the single, local node we should dispatch queries directly to, or empty if we should not dispatch directly.com.google.common.collect.ImmutableList<Group>
orderedGroups()
Returns the groups of this cluster as an immutable list in introduction ordervoid
ping(ClusterMonitor clusterMonitor, Node node, java.util.concurrent.Executor executor)
Used by the cluster monitor to manage node statusvoid
pingIterationCompleted()
Update statistics after a round of issuing pings.int
size()
Returns the number of nodes in this cluster (across all groups)void
working(Node node)
Called by the cluster monitor when node state changes to working-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.yahoo.search.cluster.NodeManager
ping
-
-
-
-
Constructor Detail
-
SearchCluster
public SearchCluster(java.lang.String clusterId, com.yahoo.vespa.config.search.DispatchConfig dispatchConfig, int containerClusterSize, com.yahoo.container.handler.VipStatus vipStatus, PingFactory pingFactory)
-
SearchCluster
public SearchCluster(java.lang.String clusterId, com.yahoo.vespa.config.search.DispatchConfig dispatchConfig, com.yahoo.container.handler.VipStatus vipStatus, PingFactory pingFactory)
-
-
Method Detail
-
addMonitoring
public void addMonitoring(ClusterMonitor clusterMonitor)
-
dispatchConfig
public com.yahoo.vespa.config.search.DispatchConfig dispatchConfig()
-
size
public int size()
Returns the number of nodes in this cluster (across all groups)
-
groups
public com.google.common.collect.ImmutableMap<java.lang.Integer,Group> groups()
Returns the groups of this cluster as an immutable map indexed by group id
-
orderedGroups
public com.google.common.collect.ImmutableList<Group> orderedGroups()
Returns the groups of this cluster as an immutable list in introduction order
-
group
public java.util.Optional<Group> group(int n)
Returns the n'th (zero-indexed) group in the cluster if possible
-
groupSize
public int groupSize()
Returns the number of nodes per group - size()/groups.size()
-
groupsWithSufficientCoverage
public int groupsWithSufficientCoverage()
-
localCorpusDispatchTarget
public java.util.Optional<Node> localCorpusDispatchTarget()
Returns the single, local node we should dispatch queries directly to, or empty if we should not dispatch directly.
-
working
public void working(Node node)
Called by the cluster monitor when node state changes to working- Specified by:
working
in interfaceNodeManager<Node>
-
failed
public void failed(Node node)
Called by the cluster monitor when node state changes to failed- Specified by:
failed
in interfaceNodeManager<Node>
-
estimateHitsToFetch
public int estimateHitsToFetch(int wantedHits, int numPartitions)
-
estimateHitsToFetch
public int estimateHitsToFetch(int wantedHits, int numPartitions, double topKProbability)
-
hasInformationAboutAllNodes
public boolean hasInformationAboutAllNodes()
-
ping
public void ping(ClusterMonitor clusterMonitor, Node node, java.util.concurrent.Executor executor)
Used by the cluster monitor to manage node status- Specified by:
ping
in interfaceNodeManager<Node>
-
pingIterationCompleted
public void pingIterationCompleted()
Update statistics after a round of issuing pings. Note that this doesn't wait for pings to return, so it will typically accumulate data from last rounds pinging, or potentially (although unlikely) some combination of new and old data.- Specified by:
pingIterationCompleted
in interfaceNodeManager<Node>
-
isPartialGroupCoverageSufficient
public boolean isPartialGroupCoverageSufficient(java.util.OptionalInt knownGroupId, java.util.List<Node> nodes)
Calculate whether a subset of nodes in a group has enough coverage
-
-