Class CandidateGeneratorTestUtil
java.lang.Object
org.apache.hadoop.hbase.master.balancer.CandidateGeneratorTestUtil
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static booleanareAllReplicasDistributed(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster) Validates that each replica is isolated from its others.(package private) static org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancerbuildStochasticLoadBalancer(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster, org.apache.hadoop.conf.Configuration conf) (package private) static org.apache.hadoop.hbase.master.balancer.BalancerClusterStatecreateMockBalancerClusterState(Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions) private static StringgenerateRegionKey(org.apache.hadoop.hbase.client.RegionInfo regionInfo) Generates a unique key for a region based on its start and end keys.(package private) static booleanisTableIsolated(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster, org.apache.hadoop.hbase.TableName tableName, String tableType) Generic method to validate table isolation.static Map<org.apache.hadoop.hbase.TableName,Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>>> partitionRegionsByTable(Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions) Partitions the given serverToRegions map by table The tables are derived from the RegionInfo objects found in serverToRegions.(package private) static voidprintClusterDistribution(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster, long actionsTaken) Prints the current cluster distribution of regions per table per server(package private) static voidrunBalancerToExhaustion(org.apache.hadoop.conf.Configuration conf, Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions, Set<Function<org.apache.hadoop.hbase.master.balancer.BalancerClusterState, Boolean>> expectations, float targetMaxBalancerCost) (package private) static voidrunBalancerToExhaustion(org.apache.hadoop.conf.Configuration conf, Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions, Set<Function<org.apache.hadoop.hbase.master.balancer.BalancerClusterState, Boolean>> expectations, float targetMaxBalancerCost, long maxRunningTime, CandidateGeneratorTestUtil.ExhaustionType exhaustionType)
-
Field Details
-
LOG
-
-
Constructor Details
-
CandidateGeneratorTestUtil
private CandidateGeneratorTestUtil()
-
-
Method Details
-
runBalancerToExhaustion
static void runBalancerToExhaustion(org.apache.hadoop.conf.Configuration conf, Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions, Set<Function<org.apache.hadoop.hbase.master.balancer.BalancerClusterState, Boolean>> expectations, float targetMaxBalancerCost) -
runBalancerToExhaustion
static void runBalancerToExhaustion(org.apache.hadoop.conf.Configuration conf, Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions, Set<Function<org.apache.hadoop.hbase.master.balancer.BalancerClusterState, Boolean>> expectations, float targetMaxBalancerCost, long maxRunningTime, CandidateGeneratorTestUtil.ExhaustionType exhaustionType) -
printClusterDistribution
static void printClusterDistribution(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster, long actionsTaken) Prints the current cluster distribution of regions per table per server -
partitionRegionsByTable
public static Map<org.apache.hadoop.hbase.TableName,Map<org.apache.hadoop.hbase.ServerName, partitionRegionsByTableList<org.apache.hadoop.hbase.client.RegionInfo>>> (Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions) Partitions the given serverToRegions map by table The tables are derived from the RegionInfo objects found in serverToRegions.- Parameters:
serverToRegions- The map of servers to their assigned regions.- Returns:
- A map of tables to their server-to-region assignments.
-
buildStochasticLoadBalancer
static org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer buildStochasticLoadBalancer(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster, org.apache.hadoop.conf.Configuration conf) -
createMockBalancerClusterState
static org.apache.hadoop.hbase.master.balancer.BalancerClusterState createMockBalancerClusterState(Map<org.apache.hadoop.hbase.ServerName, List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions) -
areAllReplicasDistributed
static boolean areAllReplicasDistributed(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster) Validates that each replica is isolated from its others. Ensures that no server hosts more than one replica of the same region (i.e., regions with identical start and end keys).- Parameters:
cluster- The current state of the cluster.- Returns:
- true if all replicas are properly isolated, false otherwise.
-
isTableIsolated
static boolean isTableIsolated(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster, org.apache.hadoop.hbase.TableName tableName, String tableType) Generic method to validate table isolation. -
generateRegionKey
Generates a unique key for a region based on its start and end keys. This method ensures that regions with identical start and end keys have the same key.- Parameters:
regionInfo- The RegionInfo object.- Returns:
- A string representing the unique key of the region.
-