Interface InstanceSelector
-
- All Known Implementing Classes:
BalancedInstanceSelector,MultiStageReplicaGroupSelector,ReplicaGroupInstanceSelector,StrictReplicaGroupInstanceSelector
public interface InstanceSelectorThe instance selector selects server instances to serve the query based on the selected segments.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classInstanceSelector.SelectionResult
-
Method Summary
Modifier and Type Method Description voidinit(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 theSegmentPreSelector).voidonAssignmentChange(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 theSegmentPreSelector).voidonInstancesChange(Set<String> enabledInstances, List<String> changedInstances)Processes the instances change.InstanceSelector.SelectionResultselect(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 theSegmentPreSelector). 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 theSegmentPreSelector).
-
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 querysegments- segments for which instance needs to be selectedrequestId- requestId generated by the Broker for a query- Returns:
- instance of SelectionResult which describes the instance to pick for a given segment
-
-