Class TestRegionSplitter

java.lang.Object
org.apache.hadoop.hbase.util.TestRegionSplitter

public class TestRegionSplitter extends Object
Tests for RegionSplitter, which can create a pre-split table or do a rolling split of an existing table.
  • Field Details

  • Constructor Details

  • Method Details

    • setup

      public static void setup() throws Exception
      Throws:
      Exception
    • teardown

      public static void teardown() throws Exception
      Throws:
      Exception
    • testCreatePresplitTableHex

      public void testCreatePresplitTableHex() throws Exception
      Test creating a pre-split table using the HexStringSplit algorithm.
      Throws:
      Exception
    • testCreatePresplitTableUniform

      Test creating a pre-split table using the UniformSplit algorithm.
      Throws:
      Exception
    • unitTestHexStringSplit

      public void unitTestHexStringSplit()
      Unit tests for the HexStringSplit algorithm. Makes sure it divides up the space of keys in the way that we expect.
    • unitTestDecimalStringSplit

      Unit tests for the DecimalStringSplit algorithm. Makes sure it divides up the space of keys in the way that we expect.
    • unitTestUniformSplit

      public void unitTestUniformSplit()
      Unit tests for the UniformSplit algorithm. Makes sure it divides up the space of keys in the way that we expect.
    • testUserInput

      public void testUserInput()
    • splitFailsPrecondition

      private boolean splitFailsPrecondition(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo)
    • splitFailsPrecondition

      private boolean splitFailsPrecondition(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, String firstRow, String lastRow)
    • splitFailsPrecondition

      private boolean splitFailsPrecondition(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, String firstRow, String lastRow, int numRegions)
    • splitFailsPrecondition

      private boolean splitFailsPrecondition(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, int numRegions)
    • preSplitTableAndVerify

      private void preSplitTableAndVerify(List<byte[]> expectedBounds, String splitClass, org.apache.hadoop.hbase.TableName tableName) throws Exception
      Creates a pre-split table with expectedBounds.size()+1 regions, then verifies that the region boundaries are the same as the expected region boundaries in expectedBounds.
      Throws:
      Various - junit assertions
      Exception
    • noopRollingSplit

      public void noopRollingSplit() throws Exception
      Throws:
      Exception
    • rollingSplitAndVerify

      private void rollingSplitAndVerify(org.apache.hadoop.hbase.TableName tableName, String splitClass, List<byte[]> expectedBounds) throws Exception
      Throws:
      Exception
    • verifyBounds

      private void verifyBounds(List<byte[]> expectedBounds, org.apache.hadoop.hbase.TableName tableName) throws Exception
      Throws:
      Exception
    • indexOfBytes

      private static int indexOfBytes(List<byte[]> list, byte[] compareTo)
      List.indexOf() doesn't really work for a List<byte[]>, because byte[] doesn't override equals(). This method checks whether a list contains a given element by checking each element using the byte array comparator.
      Returns:
      the index of the first element that equals compareTo, or -1 if no elements are equal.