Class CandidateGeneratorTestUtil

java.lang.Object
org.apache.hadoop.hbase.master.balancer.CandidateGeneratorTestUtil

public final class CandidateGeneratorTestUtil extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static boolean
    areAllReplicasDistributed(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.StochasticLoadBalancer
    buildStochasticLoadBalancer(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster, org.apache.hadoop.conf.Configuration conf)
     
    (package private) static org.apache.hadoop.hbase.master.balancer.BalancerClusterState
    createMockBalancerClusterState(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serverToRegions)
     
    private static String
    generateRegionKey(org.apache.hadoop.hbase.client.RegionInfo regionInfo)
    Generates a unique key for a region based on its start and end keys.
    (package private) 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.
    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 void
    printClusterDistribution(org.apache.hadoop.hbase.master.balancer.BalancerClusterState cluster, long actionsTaken)
    Prints the current cluster distribution of regions per table per server
    (package private) 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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
  • Constructor Details

  • 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)
    • 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,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.
      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

      private static String generateRegionKey(org.apache.hadoop.hbase.client.RegionInfo regionInfo)
      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.