Interface InstanceSelector

    • Method Summary

      Modifier and Type Method Description
      void init​(Set<String> enabledInstances, org.apache.helix.model.IdealState idealState, org.apache.helix.model.ExternalView externalView, Set<String> onlineSegments)
      Initializes the instance selector with the enabled instances, ideal state, external view and online segments (segments with ONLINE/CONSUMING instances in the ideal state and pre-selected by the SegmentPreSelector).
      void onAssignmentChange​(org.apache.helix.model.IdealState idealState, org.apache.helix.model.ExternalView externalView, Set<String> onlineSegments)
      Processes the segment assignment (ideal state or external view) change based on the given online segments (segments with ONLINE/CONSUMING instances in the ideal state and pre-selected by the SegmentPreSelector).
      void onInstancesChange​(Set<String> enabledInstances, List<String> changedInstances)
      Processes the instances change.
      InstanceSelector.SelectionResult select​(org.apache.pinot.common.request.BrokerRequest brokerRequest, List<String> segments, long requestId)
      Selects the server instances for the given segments queried by the given broker request, returns a map from segment to selected server instance hosting the segment and a set of unavailable segments (no enabled instance or all enabled instances are in ERROR state).
    • Method Detail

      • init

        void init​(Set<String> enabledInstances,
                  org.apache.helix.model.IdealState idealState,
                  org.apache.helix.model.ExternalView externalView,
                  Set<String> onlineSegments)
        Initializes the instance selector with the enabled instances, ideal state, external view and online segments (segments with ONLINE/CONSUMING instances in the ideal state and pre-selected by the SegmentPreSelector). Should be called only once before calling other methods.
      • onInstancesChange

        void onInstancesChange​(Set<String> enabledInstances,
                               List<String> changedInstances)
        Processes the instances change. Changed instances are pre-computed based on the current and previous enabled instances only once on the caller side and passed to all the instance selectors.
      • onAssignmentChange

        void onAssignmentChange​(org.apache.helix.model.IdealState idealState,
                                org.apache.helix.model.ExternalView externalView,
                                Set<String> onlineSegments)
        Processes the segment assignment (ideal state or external view) change based on the given online segments (segments with ONLINE/CONSUMING instances in the ideal state and pre-selected by the SegmentPreSelector).
      • select

        InstanceSelector.SelectionResult select​(org.apache.pinot.common.request.BrokerRequest brokerRequest,
                                                List<String> segments,
                                                long requestId)
        Selects the server instances for the given segments queried by the given broker request, returns a map from segment to selected server instance hosting the segment and a set of unavailable segments (no enabled instance or all enabled instances are in ERROR state).
        Parameters:
        brokerRequest - BrokerRequest for the query
        segments - segments for which instance needs to be selected
        requestId - requestId generated by the Broker for a query
        Returns:
        instance of SelectionResult which describes the instance to pick for a given segment