Class SearchCluster

java.lang.Object
com.yahoo.search.dispatch.searchcluster.SearchCluster
All Implemented Interfaces:
NodeManager<Node>

public class SearchCluster extends Object implements NodeManager<Node>
A model of a search cluster we might want to dispatch queries to.
Author:
bratseth
  • Constructor Details

    • SearchCluster

      public SearchCluster(String clusterId, com.yahoo.vespa.config.search.DispatchConfig dispatchConfig, com.yahoo.container.handler.VipStatus vipStatus, PingFactory pingFactory)
  • Method Details

    • name

      public String name()
      Description copied from interface: NodeManager
      Name to identify Nodemanager
      Specified by:
      name in interface NodeManager<Node>
    • addMonitoring

      public void addMonitoring(ClusterMonitor<Node> clusterMonitor)
    • dispatchConfig

      public com.yahoo.vespa.config.search.DispatchConfig dispatchConfig()
    • nodes

      public List<Node> nodes()
      Returns an immutable list of all nodes in this.
    • groups

      public Map<Integer,Group> groups()
      Returns the groups of this cluster as an immutable map indexed by group id
    • orderedGroups

      public List<Group> orderedGroups()
      Returns the groups of this cluster as an immutable list in introduction order
    • group

      public Optional<Group> group(int n)
      Returns the n'th (zero-indexed) group in the cluster if possible
    • allGroupsHaveSize1

      public boolean allGroupsHaveSize1()
    • groupsWithSufficientCoverage

      public int groupsWithSufficientCoverage()
    • localCorpusDispatchTarget

      public 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 interface NodeManager<Node>
    • failed

      public void failed(Node node)
      Called by the cluster monitor when node state changes to failed
      Specified by:
      failed in interface NodeManager<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, Executor executor)
      Used by the cluster monitor to manage node status
      Specified by:
      ping in interface NodeManager<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 interface NodeManager<Node>
    • isPartialGroupCoverageSufficient

      public boolean isPartialGroupCoverageSufficient(List<Node> nodes)
      Calculate whether a subset of nodes in a group has enough coverage