public class TestMobCompactor extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TestMobCompactor.CompactTwoLatestHfilesCopro
This copro overwrites the default compaction policy.
|
Modifier and Type | Field and Description |
---|---|
private static org.apache.hadoop.hbase.client.Admin |
admin |
private org.apache.hadoop.hbase.client.BufferedMutator |
bufMut |
private static int |
cellNumPerRow |
static HBaseClassTestRule |
CLASS_RULE |
private static org.apache.hadoop.conf.Configuration |
conf |
private static org.apache.hadoop.hbase.client.Connection |
conn |
private static int |
delCellNum |
private static int |
delRowNum |
private org.apache.hadoop.hbase.HTableDescriptor |
desc |
private static String |
family1 |
private static String |
family2 |
private static org.apache.hadoop.fs.FileSystem |
fs |
private org.apache.hadoop.hbase.HColumnDescriptor |
hcd1 |
private org.apache.hadoop.hbase.HColumnDescriptor |
hcd2 |
private static byte[] |
KEYS |
private static org.slf4j.Logger |
LOG |
private static byte[] |
mobKey01 |
private static byte[] |
mobKey02 |
private static byte[] |
mobKey03 |
private static byte[] |
mobKey04 |
private static byte[] |
mobKey05 |
private static byte[] |
mobKey06 |
private static byte[] |
mobKey1 |
private static byte[] |
mobKey2 |
private static byte[] |
mobKey3 |
private static byte[] |
mobKey4 |
private static byte[] |
mobKey5 |
private static byte[] |
mobKey6 |
private static byte[] |
mobKey7 |
private static byte[] |
mobKey8 |
private static String |
mobValue0 |
private static String |
mobValue1 |
private static String |
mobValue2 |
private static String |
mobValue3 |
private static String |
mobValue4 |
private static String |
mobValue5 |
private static String |
mobValue6 |
private static String |
mobValue7 |
private static String |
mobValue8 |
org.junit.rules.TestName |
name |
private static ExecutorService |
pool |
private static String |
qf1 |
private static String |
qf2 |
private static int |
regionNum |
private static int |
rowNumPerFile |
private org.apache.hadoop.hbase.client.Table |
table |
private org.apache.hadoop.hbase.TableName |
tableName |
private static HBaseTestingUtility |
TEST_UTIL |
private static long |
tsFor20150907Monday |
private static long |
tsFor20151120Sunday |
private static long |
tsFor20151128Saturday |
private static long |
tsFor20151130Monday |
private static long |
tsFor20151201Tuesday |
private static long |
tsFor20151205Saturday |
private static long |
tsFor20151228Monday |
private static long |
tsFor20151231Thursday |
private static long |
tsFor20160101Friday |
private static long |
tsFor20160103Sunday |
Constructor and Description |
---|
TestMobCompactor() |
Modifier and Type | Method and Description |
---|---|
private void |
alterForPolicyTest(org.apache.hadoop.hbase.client.MobCompactPartitionPolicy type) |
private void |
assertRefFileNameEqual(String familyName) |
private void |
commonPolicyTestLogic(String tableNameAsString,
org.apache.hadoop.hbase.client.MobCompactPartitionPolicy pType,
boolean majorCompact,
int expectedFileNumbers,
String[] expectedFileNames,
boolean setupAndLoadData) |
private int |
countFiles(org.apache.hadoop.hbase.TableName tableName,
boolean isMobFile,
String familyName)
Gets the number of files in the mob path.
|
private int |
countHFileLinks(String familyName)
Gets the number of HFileLink in the mob path.
|
private int |
countLargeFiles(int size,
org.apache.hadoop.hbase.TableName tableName,
String familyName)
Gets the number of files.
|
private int |
countMobCells(org.apache.hadoop.hbase.client.Table table)
Gets the number of cells in the given table.
|
private int |
countMobRows(org.apache.hadoop.hbase.client.Table table)
Gets the number of rows in the given table.
|
private void |
createDelFile(org.apache.hadoop.hbase.client.Table table,
org.apache.hadoop.hbase.TableName tableName,
byte[] family,
byte[] qf)
delete the row, family and cell to create the del file
|
private static ExecutorService |
createThreadPool(org.apache.hadoop.conf.Configuration conf) |
private byte[][] |
getSplitKeys()
Gets the split keys
|
private void |
loadData(org.apache.hadoop.hbase.client.Admin admin,
org.apache.hadoop.hbase.client.BufferedMutator table,
org.apache.hadoop.hbase.TableName tableName,
int fileNum,
int rowNumPerFile)
loads some data to the table.
|
private void |
loadData(org.apache.hadoop.hbase.client.Admin admin,
org.apache.hadoop.hbase.client.BufferedMutator table,
org.apache.hadoop.hbase.TableName tableName,
org.apache.hadoop.hbase.client.Put[] puts) |
private void |
loadDataForPartitionPolicy(org.apache.hadoop.hbase.client.Admin admin,
org.apache.hadoop.hbase.client.BufferedMutator table,
org.apache.hadoop.hbase.TableName tableName) |
private byte[] |
makeDummyData(int size)
Creates the dummy data with a specific size.
|
private void |
resetConf()
Resets the configuration.
|
void |
setUp(String tableNameAsString) |
static void |
setUpBeforeClass() |
private void |
setUpForPolicyTest(String tableNameAsString,
org.apache.hadoop.hbase.client.MobCompactPartitionPolicy type) |
static void |
tearDownAfterClass() |
void |
testCompactionWithHFileLink() |
void |
testGetAfterCompaction()
This case tests the following mob compaction and normal compaction scenario,
after mob compaction, the mob reference in new bulkloaded hfile will win even after it
is compacted with some other normal hfiles.
|
void |
testMajorCompactionFromAdmin() |
void |
testMajorCompactionWithMonthlyPolicy() |
void |
testMajorCompactionWithWeeklyFollowedByMonthly() |
void |
testMajorCompactionWithWeeklyFollowedByMonthlyFollowedByDaily() |
void |
testMajorCompactionWithWeeklyFollowedByMonthlyFollowedByWeekly() |
void |
testMajorCompactionWithWeeklyPolicy() |
void |
testMinorCompaction() |
void |
testMinorCompactionWithMonthlyPolicy() |
void |
testMinorCompactionWithWeeklyPolicy() |
void |
testScannerOnBulkLoadRefHFiles() |
private boolean |
verifyEncryption(org.apache.hadoop.hbase.TableName tableName,
String familyName) |
private void |
verifyPolicyValues()
Verify mob partition policy compaction values.
|
private void |
waitUntilFilesShowup(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
int num) |
private void |
waitUntilMobCompactionFinished(org.apache.hadoop.hbase.TableName tableName) |
public static final HBaseClassTestRule CLASS_RULE
private static final org.slf4j.Logger LOG
private static final HBaseTestingUtility TEST_UTIL
private static org.apache.hadoop.conf.Configuration conf
private org.apache.hadoop.hbase.TableName tableName
private static org.apache.hadoop.hbase.client.Connection conn
private org.apache.hadoop.hbase.client.BufferedMutator bufMut
private org.apache.hadoop.hbase.client.Table table
private static org.apache.hadoop.hbase.client.Admin admin
private org.apache.hadoop.hbase.HTableDescriptor desc
private org.apache.hadoop.hbase.HColumnDescriptor hcd1
private org.apache.hadoop.hbase.HColumnDescriptor hcd2
private static org.apache.hadoop.fs.FileSystem fs
private static final String family1
private static final String family2
private static final String qf1
private static final String qf2
private static long tsFor20150907Monday
private static long tsFor20151120Sunday
private static long tsFor20151128Saturday
private static long tsFor20151130Monday
private static long tsFor20151201Tuesday
private static long tsFor20151205Saturday
private static long tsFor20151228Monday
private static long tsFor20151231Thursday
private static long tsFor20160101Friday
private static long tsFor20160103Sunday
private static final byte[] mobKey01
private static final byte[] mobKey02
private static final byte[] mobKey03
private static final byte[] mobKey04
private static final byte[] mobKey05
private static final byte[] mobKey06
private static final byte[] mobKey1
private static final byte[] mobKey2
private static final byte[] mobKey3
private static final byte[] mobKey4
private static final byte[] mobKey5
private static final byte[] mobKey6
private static final byte[] mobKey7
private static final byte[] mobKey8
private static final String mobValue0
private static final String mobValue1
private static final String mobValue2
private static final String mobValue3
private static final String mobValue4
private static final String mobValue5
private static final String mobValue6
private static final String mobValue7
private static final String mobValue8
private static byte[] KEYS
private static int regionNum
private static int delRowNum
private static int delCellNum
private static int cellNumPerRow
private static int rowNumPerFile
private static ExecutorService pool
public org.junit.rules.TestName name
public TestMobCompactor()
public static void setUpBeforeClass() throws Exception
Exception
public static void tearDownAfterClass() throws Exception
Exception
public void setUp(String tableNameAsString) throws IOException
IOException
private void setUpForPolicyTest(String tableNameAsString, org.apache.hadoop.hbase.client.MobCompactPartitionPolicy type) throws IOException
IOException
private void alterForPolicyTest(org.apache.hadoop.hbase.client.MobCompactPartitionPolicy type) throws Exception
Exception
public void testMinorCompaction() throws Exception
Exception
public void testMinorCompactionWithWeeklyPolicy() throws Exception
Exception
public void testMajorCompactionWithWeeklyPolicy() throws Exception
Exception
public void testMinorCompactionWithMonthlyPolicy() throws Exception
Exception
public void testMajorCompactionWithMonthlyPolicy() throws Exception
Exception
public void testMajorCompactionWithWeeklyFollowedByMonthly() throws Exception
Exception
public void testMajorCompactionWithWeeklyFollowedByMonthlyFollowedByWeekly() throws Exception
Exception
public void testMajorCompactionWithWeeklyFollowedByMonthlyFollowedByDaily() throws Exception
Exception
public void testCompactionWithHFileLink() throws IOException, InterruptedException
IOException
InterruptedException
public void testMajorCompactionFromAdmin() throws Exception
Exception
public void testScannerOnBulkLoadRefHFiles() throws Exception
Exception
public void testGetAfterCompaction() throws Exception
Exception
private void waitUntilFilesShowup(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, int num) throws InterruptedException, IOException
InterruptedException
IOException
private void waitUntilMobCompactionFinished(org.apache.hadoop.hbase.TableName tableName) throws IOException, InterruptedException
IOException
InterruptedException
private int countMobRows(org.apache.hadoop.hbase.client.Table table) throws IOException
table
- to get the scannerIOException
private int countMobCells(org.apache.hadoop.hbase.client.Table table) throws IOException
table
- to get the scannerIOException
private int countFiles(org.apache.hadoop.hbase.TableName tableName, boolean isMobFile, String familyName) throws IOException
isMobFile
- gets number of the mob files or del filesfamilyName
- the family nameIOException
private boolean verifyEncryption(org.apache.hadoop.hbase.TableName tableName, String familyName) throws IOException
IOException
private int countHFileLinks(String familyName) throws IOException
familyName
- the family nameIOException
private int countLargeFiles(int size, org.apache.hadoop.hbase.TableName tableName, String familyName) throws IOException
size
- the size of the filetableName
- the current table namefamilyName
- the family nameIOException
private void loadData(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.client.BufferedMutator table, org.apache.hadoop.hbase.TableName tableName, int fileNum, int rowNumPerFile) throws IOException, InterruptedException
IOException
InterruptedException
private void loadData(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.client.BufferedMutator table, org.apache.hadoop.hbase.TableName tableName, org.apache.hadoop.hbase.client.Put[] puts) throws IOException
IOException
private void loadDataForPartitionPolicy(org.apache.hadoop.hbase.client.Admin admin, org.apache.hadoop.hbase.client.BufferedMutator table, org.apache.hadoop.hbase.TableName tableName) throws IOException
IOException
private void createDelFile(org.apache.hadoop.hbase.client.Table table, org.apache.hadoop.hbase.TableName tableName, byte[] family, byte[] qf) throws IOException, InterruptedException
IOException
InterruptedException
private byte[] makeDummyData(int size)
size
- the size of valueprivate byte[][] getSplitKeys()
private static ExecutorService createThreadPool(org.apache.hadoop.conf.Configuration conf)
private void assertRefFileNameEqual(String familyName) throws IOException
IOException
private void resetConf()
private void verifyPolicyValues() throws Exception
Exception
private void commonPolicyTestLogic(String tableNameAsString, org.apache.hadoop.hbase.client.MobCompactPartitionPolicy pType, boolean majorCompact, int expectedFileNumbers, String[] expectedFileNames, boolean setupAndLoadData) throws Exception
Exception
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.