Class RSGroupableBalancerTestBase

java.lang.Object
org.apache.hadoop.hbase.master.balancer.BalancerTestBase
org.apache.hadoop.hbase.master.balancer.RSGroupableBalancerTestBase
Direct Known Subclasses:
TestRSGroupBasedLoadBalancer, TestRSGroupBasedLoadBalancerWithStochasticLoadBalancerAsInternal

Base UT of RSGroupableBalancer.
  • Field Details

    • groups

      static String[] groups
    • table0

      static org.apache.hadoop.hbase.TableName table0
    • tables

      static org.apache.hadoop.hbase.TableName[] tables
    • servers

      static List<org.apache.hadoop.hbase.ServerName> servers
    • groupMap

      static Map<String,org.apache.hadoop.hbase.rsgroup.RSGroupInfo> groupMap
    • tableDescs

      static Map<org.apache.hadoop.hbase.TableName,org.apache.hadoop.hbase.client.TableDescriptor> tableDescs
    • regionAssignment

    • regionId

      static int regionId
    • conf

      static org.apache.hadoop.conf.Configuration conf
  • Constructor Details

  • Method Details

    • assertClusterAsBalanced

      protected void assertClusterAsBalanced(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> groupLoadMap)
      Invariant is that all servers of a group have load between floor(avg) and ceiling(avg) number of regions.
    • assertImmediateAssignment

      protected void assertImmediateAssignment(List<org.apache.hadoop.hbase.client.RegionInfo> regions, List<org.apache.hadoop.hbase.ServerName> servers, Map<org.apache.hadoop.hbase.client.RegionInfo,org.apache.hadoop.hbase.ServerName> assignments) throws IOException
      All regions have an assignment.
      Throws:
      IOException
    • assertRetainedAssignment

      protected void assertRetainedAssignment(Map<org.apache.hadoop.hbase.client.RegionInfo,org.apache.hadoop.hbase.ServerName> existing, List<org.apache.hadoop.hbase.ServerName> servers, Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> assignment) throws FileNotFoundException, IOException
      Asserts a valid retained assignment plan.

      Must meet the following conditions:

      • Every input region has an assignment, and to an online server
      • If a region had an existing assignment to a server with the same address a a currently online server, it will be assigned to it
      Throws:
      FileNotFoundException
      IOException
    • printStats

      protected String printStats(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> groupBasedLoad)
    • convertToGroupBasedMap

      protected org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> convertToGroupBasedMap(Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> serversMap) throws IOException
      Throws:
      IOException
    • reconcile

      protected org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> reconcile(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> previousLoad, List<org.apache.hadoop.hbase.master.RegionPlan> plans)
    • updateLoad

      protected void updateLoad(org.apache.hbase.thirdparty.com.google.common.collect.ArrayListMultimap<String,org.apache.hadoop.hbase.master.balancer.ServerAndLoad> previousLoad, org.apache.hadoop.hbase.ServerName sn, int diff)
    • mockClusterServers

      protected Map<org.apache.hadoop.hbase.ServerName,List<org.apache.hadoop.hbase.client.RegionInfo>> mockClusterServers() throws IOException
      Throws:
      IOException
    • randomRegions

      protected List<org.apache.hadoop.hbase.client.RegionInfo> randomRegions(int numRegions)
      Generate a list of regions evenly distributed between the tables.
      Overrides:
      randomRegions in class BalancerTestBase
      Parameters:
      numRegions - The number of regions to be generated.
      Returns:
      List of RegionInfo.
    • assignedRegions

      protected List<org.apache.hadoop.hbase.client.RegionInfo> assignedRegions(int numRegions, org.apache.hadoop.hbase.ServerName sn) throws IOException
      Generate assigned regions to a given server using group information.
      Parameters:
      numRegions - the num regions to generate
      sn - the servername
      Returns:
      the list of regions
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • generateServers

      protected static List<org.apache.hadoop.hbase.ServerName> generateServers(int numServers)
    • constructGroupInfo

      protected static Map<String,org.apache.hadoop.hbase.rsgroup.RSGroupInfo> constructGroupInfo(List<org.apache.hadoop.hbase.ServerName> servers, String[] groups)
      Construct group info, with each group having at least one server.
      Parameters:
      servers - the servers
      groups - the groups
      Returns:
      the map
    • constructTableDesc

      protected static Map<org.apache.hadoop.hbase.TableName,org.apache.hadoop.hbase.client.TableDescriptor> constructTableDesc(boolean hasBogusTable)
      Construct table descriptors evenly distributed between the groups.
      Parameters:
      hasBogusTable - there is a table that does not determine the group
      Returns:
      the list of table descriptors
    • getMockedMaster

      protected static org.apache.hadoop.hbase.master.MasterServices getMockedMaster() throws IOException
      Throws:
      IOException
    • getMockedGroupInfoManager

      protected static org.apache.hadoop.hbase.rsgroup.RSGroupInfoManager getMockedGroupInfoManager() throws IOException
      Throws:
      IOException
    • getTableName

      protected org.apache.hadoop.hbase.TableName getTableName(org.apache.hadoop.hbase.ServerName sn) throws IOException
      Throws:
      IOException