Class TestStoreFileTableSkewCostFunction

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

@Tag("org.apache.hadoop.hbase.testclassification.MasterTests") @Tag("org.apache.hadoop.hbase.testclassification.SmallTests") public class TestStoreFileTableSkewCostFunction extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
    A simplified BalancerClusterState which ensures we provide the intended test RegionMetrics data when balancing this cluster
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.apache.hadoop.hbase.TableName
     
    private static final Map<Long,Integer>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static org.apache.hadoop.hbase.client.RegionInfo
    createMockRegionInfo(int storeFileSizeMb)
    Helper method to create a RegionInfo for the default table with the given store file size.
    private static org.apache.hadoop.hbase.client.RegionInfo
    createMockRegionInfo(org.apache.hadoop.hbase.TableName table, int storeFileSizeMb)
    Helper method to create a RegionInfo for a specified table with the given store file size.
    private static org.apache.hadoop.hbase.RegionMetrics
    createMockRegionMetrics(org.apache.hadoop.hbase.client.RegionInfo regionInfo)
    Creates a mocked RegionMetrics for the given region.
    private static byte[]
     
    void
    Tests that an empty cluster (no servers/regions) is handled gracefully.
    void
    Tests that having multiple tables results in a positive cost when each table's regions are not balanced across servers – even if the overall load per server is balanced.
    void
    Tests that a skewed store file distribution (single table) results in a positive cost.
    void
    Tests that a uniform store file distribution (single table) across servers results in zero cost.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

  • Method Details

    • testUniformDistribution

      @Test public void testUniformDistribution()
      Tests that a uniform store file distribution (single table) across servers results in zero cost.
    • testSkewedDistribution

      @Test public void testSkewedDistribution()
      Tests that a skewed store file distribution (single table) results in a positive cost.
    • testEmptyDistribution

      @Test public void testEmptyDistribution()
      Tests that an empty cluster (no servers/regions) is handled gracefully.
    • testMultipleTablesDistribution

      @Test public void testMultipleTablesDistribution()
      Tests that having multiple tables results in a positive cost when each table's regions are not balanced across servers – even if the overall load per server is balanced.
    • createMockRegionInfo

      private static org.apache.hadoop.hbase.client.RegionInfo createMockRegionInfo(int storeFileSizeMb)
      Helper method to create a RegionInfo for the default table with the given store file size.
    • createMockRegionInfo

      private static org.apache.hadoop.hbase.client.RegionInfo createMockRegionInfo(org.apache.hadoop.hbase.TableName table, int storeFileSizeMb)
      Helper method to create a RegionInfo for a specified table with the given store file size.
    • generateRandomByteArray

      private static byte[] generateRandomByteArray(int n)
    • createMockRegionMetrics

      private static org.apache.hadoop.hbase.RegionMetrics createMockRegionMetrics(org.apache.hadoop.hbase.client.RegionInfo regionInfo)
      Creates a mocked RegionMetrics for the given region.