Class AbstractLeaderBalancer
java.lang.Object
org.apache.iotdb.confignode.manager.load.balancer.router.leader.AbstractLeaderBalancer
- Direct Known Subclasses:
GreedyLeaderBalancer,MinCostFlowLeaderBalancer
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected final Map<String,List<TConsensusGroupId>> protected final Map<Integer,NodeStatistics> static final Stringprotected final Set<TConsensusGroupId>protected final Map<TConsensusGroupId,Integer> protected final Map<TConsensusGroupId,Set<Integer>> protected final Map<TConsensusGroupId,Map<Integer, RegionStatistics>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclear()abstract Map<TConsensusGroupId,Integer> generateOptimalLeaderDistribution(Map<String, List<TConsensusGroupId>> databaseRegionGroupMap, Map<TConsensusGroupId, Set<Integer>> regionLocationMap, Map<TConsensusGroupId, Integer> regionLeaderMap, Map<Integer, NodeStatistics> dataNodeStatisticsMap, Map<TConsensusGroupId, Map<Integer, RegionStatistics>> regionStatisticsMap) Generate an optimal leader distribution.protected voidinitialize(Map<String, List<TConsensusGroupId>> databaseRegionGroupMap, Map<TConsensusGroupId, Set<Integer>> regionLocationMap, Map<TConsensusGroupId, Integer> regionLeaderMap, Map<Integer, NodeStatistics> dataNodeStatisticsMap, Map<TConsensusGroupId, Map<Integer, RegionStatistics>> regionStatisticsMap) protected booleanisDataNodeAvailable(int dataNodeId) protected booleanisRegionAvailable(TConsensusGroupId regionGroupId, int dataNodeId)
-
Field Details
-
GREEDY_POLICY
- See Also:
-
CFD_POLICY
- See Also:
-
regionGroupIntersection
-
databaseRegionGroupMap
-
regionLocationMap
-
regionLeaderMap
-
dataNodeStatisticsMap
-
regionStatisticsMap
-
-
Constructor Details
-
AbstractLeaderBalancer
protected AbstractLeaderBalancer()
-
-
Method Details
-
initialize
protected void initialize(Map<String, List<TConsensusGroupId>> databaseRegionGroupMap, Map<TConsensusGroupId, Set<Integer>> regionLocationMap, Map<TConsensusGroupId, Integer> regionLeaderMap, Map<Integer, NodeStatistics> dataNodeStatisticsMap, Map<TConsensusGroupId, Map<Integer, RegionStatistics>> regionStatisticsMap) -
isDataNodeAvailable
protected boolean isDataNodeAvailable(int dataNodeId) -
isRegionAvailable
-
clear
protected void clear() -
generateOptimalLeaderDistribution
public abstract Map<TConsensusGroupId,Integer> generateOptimalLeaderDistribution(Map<String, List<TConsensusGroupId>> databaseRegionGroupMap, Map<TConsensusGroupId, Set<Integer>> regionLocationMap, Map<TConsensusGroupId, Integer> regionLeaderMap, Map<Integer, NodeStatistics> dataNodeStatisticsMap, Map<TConsensusGroupId, Map<Integer, RegionStatistics>> regionStatisticsMap) Generate an optimal leader distribution.- Parameters:
databaseRegionGroupMap- RegionGroup held by each DatabaseregionLocationMap- All RegionGroups the cluster currently haveregionLeaderMap- The current leader distribution of each RegionGroupdataNodeStatisticsMap- The current statistics of each DataNoderegionStatisticsMap- The current statistics of each Region- Returns:
- Map<TConsensusGroupId, Integer>, The optimal leader distribution
-