类 RouteBalancer


  • public class RouteBalancer
    extends java.lang.Object
    The RouteBalancer will maintain cluster RegionRouteMap, which contains:

    1. regionLeaderMap, record the leader for each RegionGroup

    2. regionPriorityMap, record the priority for read/write requests in each RegionGroup

    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      void cacheLeaderSample​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionGroupId, org.apache.iotdb.tsfile.utils.Pair<java.lang.Long,​java.lang.Integer> leaderSample)
      Cache the newest leaderHeartbeatSample
      void changeLeaderForIoTConsensus​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionGroupId, int newLeaderId)  
      java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,​java.lang.Integer> getLatestRegionLeaderMap()  
      java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,​org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> getLatestRegionPriorityMap()  
      RegionRouteMap getRegionRouteMap()  
      void greedySelectLeader​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionGroupId, java.util.List<java.lang.Integer> dataNodeIds)
      Select leader for the specified RegionGroup greedily.
      void initRegionRouteMap()
      Initialize the regionRouteMap when the ConfigNode-Leader is switched
      void startRouteBalancingService()
      Start the route balancing service
      void stopRouteBalancingService()
      Stop the route balancing service
      boolean updateRegionRouteMap()
      Invoking periodically to update the RegionRouteMap
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • RouteBalancer

        public RouteBalancer​(IManager configManager)
    • 方法详细资料

      • cacheLeaderSample

        public void cacheLeaderSample​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionGroupId,
                                      org.apache.iotdb.tsfile.utils.Pair<java.lang.Long,​java.lang.Integer> leaderSample)
        Cache the newest leaderHeartbeatSample
        参数:
        regionGroupId - Corresponding RegionGroup's index
        leaderSample - , The newest HeartbeatSample
      • updateRegionRouteMap

        public boolean updateRegionRouteMap()
        Invoking periodically to update the RegionRouteMap
        返回:
        True if the RegionRouteMap has changed, false otherwise
      • greedySelectLeader

        public void greedySelectLeader​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionGroupId,
                                       java.util.List<java.lang.Integer> dataNodeIds)
        Select leader for the specified RegionGroup greedily. The selected leader will be the DataNode that currently has the fewest leaders
        参数:
        regionGroupId - The specified RegionGroup
        dataNodeIds - The indices of DataNodes where the RegionReplicas reside
      • startRouteBalancingService

        public void startRouteBalancingService()
        Start the route balancing service
      • stopRouteBalancingService

        public void stopRouteBalancingService()
        Stop the route balancing service
      • changeLeaderForIoTConsensus

        public void changeLeaderForIoTConsensus​(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionGroupId,
                                                int newLeaderId)
      • initRegionRouteMap

        public void initRegionRouteMap()
        Initialize the regionRouteMap when the ConfigNode-Leader is switched
      • getLatestRegionLeaderMap

        public java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,​java.lang.Integer> getLatestRegionLeaderMap()
      • getLatestRegionPriorityMap

        public java.util.Map<org.apache.iotdb.common.rpc.thrift.TConsensusGroupId,​org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet> getLatestRegionPriorityMap()