Package org.apache.pinot.broker.routing
Class BrokerRoutingManager
- java.lang.Object
-
- org.apache.pinot.broker.routing.BrokerRoutingManager
-
- All Implemented Interfaces:
ClusterChangeHandler,RoutingManager
public class BrokerRoutingManager extends Object implements RoutingManager, ClusterChangeHandler
TheRoutingManagermanages the routing of all tables hosted by the broker instance. It listens to the cluster changes and updates the routing components accordingly.The following methods are provided:
buildRouting(String): Builds/rebuilds the routing for a tableremoveRouting(String): Removes the routing for a tablerefreshSegment(String, String): Refreshes the metadata for a segmentroutingExists(String): Returns whether the routing exists for a tablegetRoutingTable(BrokerRequest, long): Returns the routing table for a querygetTimeBoundaryInfo(String): Returns the time boundary info for a tablegetQueryTimeoutMs(String): Returns the table-level query timeout in milliseconds for a table
-
-
Constructor Summary
Constructors Constructor Description BrokerRoutingManager(org.apache.pinot.common.metrics.BrokerMetrics brokerMetrics, ServerRoutingStatsManager serverRoutingStatsManager, org.apache.pinot.spi.env.PinotConfiguration pinotConfig)
-
Method Summary
Modifier and Type Method Description voidbuildRouting(String tableNameWithType)Builds/rebuilds the routing for the given table.voidexcludeServerFromRouting(String instanceId)Excludes a server from the routing.Map<String,ServerInstance>getEnabledServerInstanceMap()LonggetQueryTimeoutMs(String tableNameWithType)Returns the table-level query timeout in milliseconds for the given table, ornullif the timeout is not configured in the table config.RoutingTablegetRoutingTable(org.apache.pinot.common.request.BrokerRequest brokerRequest, long requestId)Returns the routing table (a map from server instance to list of segments hosted by the server, and a list of unavailable segments) based on the broker request, ornullif the routing does not exist.TimeBoundaryInfogetTimeBoundaryInfo(String offlineTableName)Returns the time boundary info for the given offline table, ornullif the routing or time boundary does not exist.voidincludeServerToRouting(String instanceId)Includes a previous excluded server to the routing.voidinit(org.apache.helix.HelixManager helixManager)Initializes the cluster change handler with the given connected Helix manager.voidprocessClusterChange(org.apache.helix.HelixConstants.ChangeType changeType)Processes the cluster change of the given type (e.g.voidrefreshSegment(String tableNameWithType, String segment)Refreshes the metadata for the given segment (called when segment is getting refreshed).voidremoveRouting(String tableNameWithType)Removes the routing for the given table.booleanroutingExists(String tableNameWithType)Returnstrueif the routing exists for the given table.
-
-
-
Constructor Detail
-
BrokerRoutingManager
public BrokerRoutingManager(org.apache.pinot.common.metrics.BrokerMetrics brokerMetrics, ServerRoutingStatsManager serverRoutingStatsManager, org.apache.pinot.spi.env.PinotConfiguration pinotConfig)
-
-
Method Detail
-
init
public void init(org.apache.helix.HelixManager helixManager)
Description copied from interface:ClusterChangeHandlerInitializes the cluster change handler with the given connected Helix manager.- Specified by:
initin interfaceClusterChangeHandler
-
processClusterChange
public void processClusterChange(org.apache.helix.HelixConstants.ChangeType changeType)
Description copied from interface:ClusterChangeHandlerProcesses the cluster change of the given type (e.g. EXTERNAL_VIEW, INSTANCE_CONFIG, LIVE_INSTANCE).- Specified by:
processClusterChangein interfaceClusterChangeHandler
-
excludeServerFromRouting
public void excludeServerFromRouting(String instanceId)
Excludes a server from the routing.
-
includeServerToRouting
public void includeServerToRouting(String instanceId)
Includes a previous excluded server to the routing.
-
buildRouting
public void buildRouting(String tableNameWithType)
Builds/rebuilds the routing for the given table.
-
removeRouting
public void removeRouting(String tableNameWithType)
Removes the routing for the given table.
-
refreshSegment
public void refreshSegment(String tableNameWithType, String segment)
Refreshes the metadata for the given segment (called when segment is getting refreshed).
-
routingExists
public boolean routingExists(String tableNameWithType)
Returnstrueif the routing exists for the given table.- Specified by:
routingExistsin interfaceRoutingManager
-
getRoutingTable
@Nullable public RoutingTable getRoutingTable(org.apache.pinot.common.request.BrokerRequest brokerRequest, long requestId)
Returns the routing table (a map from server instance to list of segments hosted by the server, and a list of unavailable segments) based on the broker request, ornullif the routing does not exist.NOTE: The broker request should already have the table suffix (_OFFLINE or _REALTIME) appended.
- Specified by:
getRoutingTablein interfaceRoutingManager
-
getEnabledServerInstanceMap
public Map<String,ServerInstance> getEnabledServerInstanceMap()
- Specified by:
getEnabledServerInstanceMapin interfaceRoutingManager
-
getTimeBoundaryInfo
@Nullable public TimeBoundaryInfo getTimeBoundaryInfo(String offlineTableName)
Returns the time boundary info for the given offline table, ornullif the routing or time boundary does not exist.NOTE: Time boundary info is only available for the offline part of the hybrid table.
- Specified by:
getTimeBoundaryInfoin interfaceRoutingManager
-
-