Class TestCompactionState
java.lang.Object
org.apache.hadoop.hbase.regionserver.TestCompactionState
Unit tests to test retrieving table/region compaction state
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HBaseClassTestRuleorg.junit.rules.TestNameprivate static final HBaseTestingUtility -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidcompaction(String tableName, int flushes, org.apache.hadoop.hbase.client.CompactionState expectedState, boolean singleFamily, TestCompactionState.StateSource stateSource) Load data to a table, flush it to disk, trigger compaction, confirm the compaction state is right and wait till it is done.private static intcountStoreFilesInFamilies(List<org.apache.hadoop.hbase.regionserver.HRegion> regions, byte[][] families) private static intcountStoreFilesInFamily(List<org.apache.hadoop.hbase.regionserver.HRegion> regions, byte[] family) private static org.apache.hadoop.hbase.client.CompactionStategetCompactionState(TestCompactionState.StateSource stateSource, org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.TableName table) private static voidloadData(org.apache.hadoop.hbase.client.Table ht, byte[][] families, int rows, int flushes) static voidstatic voidvoidvoidvoidvoidvoidvoidvoidvoidvoid
-
Field Details
-
CLASS_RULE
-
TEST_UTIL
-
name
-
-
Constructor Details
-
TestCompactionState
public TestCompactionState()
-
-
Method Details
-
setUpBeforeClass
- Throws:
Exception
-
tearDownAfterClass
- Throws:
Exception
-
testMajorCompactionStateFromAdmin
- Throws:
IOExceptionInterruptedException
-
testMinorCompactionStateFromAdmin
- Throws:
IOExceptionInterruptedException
-
testMajorCompactionOnFamilyStateFromAdmin
- Throws:
IOExceptionInterruptedException
-
testMinorCompactionOnFamilyStateFromAdmin
- Throws:
IOExceptionInterruptedException
-
testMajorCompactionStateFromMaster
- Throws:
IOExceptionInterruptedException
-
testMinorCompactionStateFromMaster
- Throws:
IOExceptionInterruptedException
-
testMajorCompactionOnFamilyStateFromMaster
- Throws:
IOExceptionInterruptedException
-
testMinorCompactionOnFamilyStateFromMaster
- Throws:
IOExceptionInterruptedException
-
testInvalidColumnFamily
- Throws:
IOExceptionInterruptedException
-
compaction
private void compaction(String tableName, int flushes, org.apache.hadoop.hbase.client.CompactionState expectedState, boolean singleFamily, TestCompactionState.StateSource stateSource) throws IOException, InterruptedException Load data to a table, flush it to disk, trigger compaction, confirm the compaction state is right and wait till it is done.- Parameters:
singleFamily- otherwise, run compaction on all cfsstateSource- get the state by Admin or Master- Throws:
IOExceptionInterruptedException
-
getCompactionState
private static org.apache.hadoop.hbase.client.CompactionState getCompactionState(TestCompactionState.StateSource stateSource, org.apache.hadoop.hbase.master.HMaster master, org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.TableName table) throws IOException - Throws:
IOException
-
countStoreFilesInFamily
private static int countStoreFilesInFamily(List<org.apache.hadoop.hbase.regionserver.HRegion> regions, byte[] family) -
countStoreFilesInFamilies
private static int countStoreFilesInFamilies(List<org.apache.hadoop.hbase.regionserver.HRegion> regions, byte[][] families) -
loadData
private static void loadData(org.apache.hadoop.hbase.client.Table ht, byte[][] families, int rows, int flushes) throws IOException - Throws:
IOException
-