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
Modifier and TypeFieldDescriptionprivate static final String
static final HBaseClassTestRule
private static final org.slf4j.Logger
org.junit.rules.TestName
private static final HBaseTestingUtil
private static final byte
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static int
indexOfBytes
(List<byte[]> list, byte[] compareTo) List.indexOf() doesn't really work for a List<byte[]>, because byte[] doesn't override equals().void
private void
preSplitTableAndVerify
(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 void
rollingSplitAndVerify
(org.apache.hadoop.hbase.TableName tableName, String splitClass, List<byte[]> expectedBounds) static void
setup()
private boolean
splitFailsPrecondition
(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo) private boolean
splitFailsPrecondition
(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, int numRegions) private boolean
splitFailsPrecondition
(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, String firstRow, String lastRow) private boolean
splitFailsPrecondition
(org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm algo, String firstRow, String lastRow, int numRegions) static void
teardown()
void
Test creating a pre-split table using the HexStringSplit algorithm.void
Test creating a pre-split table using the UniformSplit algorithm.void
void
Unit tests for the DecimalStringSplit algorithm.void
Unit tests for the HexStringSplit algorithm.void
Unit tests for the UniformSplit algorithm.private void
verifyBounds
(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
-
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.
-