类 RouteBalancer
- java.lang.Object
-
- org.apache.iotdb.confignode.manager.load.balancer.RouteBalancer
-
public class RouteBalancer extends java.lang.ObjectThe 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
-
-
构造器概要
构造器 构造器 说明 RouteBalancer(IManager configManager)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidcacheLeaderSample(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionGroupId, org.apache.iotdb.tsfile.utils.Pair<java.lang.Long,java.lang.Integer> leaderSample)Cache the newest leaderHeartbeatSamplevoidchangeLeaderForIoTConsensus(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()RegionRouteMapgetRegionRouteMap()voidgreedySelectLeader(org.apache.iotdb.common.rpc.thrift.TConsensusGroupId regionGroupId, java.util.List<java.lang.Integer> dataNodeIds)Select leader for the specified RegionGroup greedily.voidinitRegionRouteMap()Initialize the regionRouteMap when the ConfigNode-Leader is switchedvoidstartRouteBalancingService()Start the route balancing servicevoidstopRouteBalancingService()Stop the route balancing servicebooleanupdateRegionRouteMap()Invoking periodically to update the RegionRouteMap
-
-
-
构造器详细资料
-
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 indexleaderSample-, 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 RegionGroupdataNodeIds- 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()
-
getRegionRouteMap
public RegionRouteMap getRegionRouteMap()
-
-