Package org.apache.hadoop.hbase.util
Class TestRegionSplitter
java.lang.Object
org.apache.hadoop.hbase.util.TestRegionSplitter
Tests for
RegionSplitter, which can create a pre-split table or do a rolling split of an
existing table.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringstatic final HBaseClassTestRuleprivate static final org.slf4j.Loggerorg.junit.rules.TestNameprivate static final HBaseTestingUtilprivate static final byte -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intindexOfBytes(List<byte[]> list, byte[] compareTo) List.indexOf() doesn't really work for a List<byte[]>, because byte[] doesn't override equals().voidprivate voidpreSplitTableAndVerify(List<byte[]> expectedBounds, String splitClass, org.apache.hadoop.hbase.TableName tableName) 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.private voidrollingSplitAndVerify(org.apache.hadoop.hbase.TableName tableName, String splitClass, List<byte[]> expectedBounds) static voidsetup()private booleansplitFailsPrecondition(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo) private booleansplitFailsPrecondition(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, int numRegions) private booleansplitFailsPrecondition(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, String firstRow, String lastRow) private booleansplitFailsPrecondition(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, String firstRow, String lastRow, int numRegions) static voidteardown()voidTest creating a pre-split table using the HexStringSplit algorithm.voidTest creating a pre-split table using the UniformSplit algorithm.voidTest creating a pre-split table and splitting it again using the HexStringSplit and DecimalStringSplit algorithms.private voidtestSplitPresplitTable(org.apache.hadoop.hbase.util.RegionSplitter.NumberStringSplit splitter) voidvoidUnit tests for the DecimalStringSplit algorithm.voidUnit tests for the HexStringSplit algorithm.voidUnit tests for the UniformSplit algorithm.private voidverifyBounds(List<byte[]> expectedBounds, org.apache.hadoop.hbase.TableName tableName)
-
Field Details
-
CLASS_RULE
-
LOG
-
UTIL
-
CF_NAME
- See Also:
-
xFF
- See Also:
-
name
-
-
Constructor Details
-
TestRegionSplitter
public TestRegionSplitter()
-
-
Method Details
-
setup
- Throws:
Exception
-
teardown
- Throws:
Exception
-
testCreatePresplitTableHex
Test creating a pre-split table using the HexStringSplit algorithm.- Throws:
Exception
-
testSplitPresplitTable
Test creating a pre-split table and splitting it again using the HexStringSplit and DecimalStringSplit algorithms.- Throws:
Exception
-
testSplitPresplitTable
private void testSplitPresplitTable(org.apache.hadoop.hbase.util.RegionSplitter.NumberStringSplit splitter) throws Exception - Throws:
Exception
-
testCreatePresplitTableUniform
Test creating a pre-split table using the UniformSplit algorithm.- Throws:
Exception
-
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
Unit tests for the UniformSplit algorithm. Makes sure it divides up the space of keys in the way that we expect. -
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 assertionsException
-
noopRollingSplit
- 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
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.
-