Class TestDataTieringManager
java.lang.Object
org.apache.hadoop.hbase.regionserver.TestDataTieringManager
This class is used to test the functionality of the DataTieringManager.
The mock online regions are stored in
testOnlineRegions.
For all tests, the setup of testOnlineRegions occurs only once.
Please refer to setupOnlineRegions() for the structure.
Additionally, a list of all store files is maintained in hStoreFiles.
The characteristics of these store files are listed below:-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static org.apache.hadoop.hbase.io.hfile.BlockCacheprivate static org.apache.hadoop.hbase.io.hfile.CacheConfigstatic final HBaseClassTestRuleprivate static org.apache.hadoop.hbase.regionserver.DataTieringManagerprivate static final longprivate static org.apache.hadoop.conf.Configurationprivate static org.apache.hadoop.fs.FileSystemprivate static final List<org.apache.hadoop.hbase.regionserver.HStoreFile>private static final org.slf4j.Loggerprivate static StringRepresents the current lexicographically increasing string used as a row key when writing HFiles.private static final HBaseTestingUtilprivate static org.apache.hadoop.fs.Path -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.apache.hadoop.hbase.regionserver.HRegioncreateHRegion(String table) private static org.apache.hadoop.hbase.regionserver.HRegioncreateHRegion(String table, org.apache.hadoop.conf.Configuration conf) private static org.apache.hadoop.hbase.regionserver.HStorecreateHStore(org.apache.hadoop.hbase.regionserver.HRegion region, String columnFamily) private static org.apache.hadoop.hbase.regionserver.HStorecreateHStore(org.apache.hadoop.hbase.regionserver.HRegion region, String columnFamily, org.apache.hadoop.conf.Configuration conf) (package private) static org.apache.hadoop.hbase.regionserver.HStoreFilecreateHStoreFile(org.apache.hadoop.fs.Path storeDir, org.apache.hadoop.conf.Configuration conf, long timestamp, org.apache.hadoop.hbase.regionserver.HRegionFileSystem regionFs) private voidcreateTestFilesForCompaction(org.apache.hadoop.hbase.regionserver.HStore hStore) private static byte[]generateRandomBytes(int sizeInBytes) private static org.apache.hadoop.conf.ConfigurationgetConfWithGracePeriod(long hotDataAge, long gracePeriod) private static org.apache.hadoop.conf.ConfigurationgetConfWithTimeRangeDataTieringEnabled(long hotDataAge) private static voidprivate static StringReturns the lexicographically larger string every time it's called.private voidprivate voidstatic voidprivate static voidprivate static voidvoidvoidvoidprivate voidtestCacheCompactedBlocksOnWrite(org.apache.hadoop.hbase.regionserver.HRegion region, boolean expectDataBlocksCached) voidvoidvoidvoidprivate voidtestCacheOnRead(org.apache.hadoop.hbase.regionserver.HStoreFile hStoreFile, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, long onDiskBlockSize, boolean expectedCached) voidvoidvoidvoidprivate voidtestDataTieringMethodWithKey(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private voidtestDataTieringMethodWithKeyExpectingException(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private voidtestDataTieringMethodWithKeyNoException(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult) voidvoidvoidvoidvoidvoidprivate static voidprivate voidvalidateBlocks(Set<org.apache.hadoop.hbase.io.hfile.BlockCacheKey> keys, int expectedTotalKeys, int expectedHotBlocks, int expectedColdBlocks) private static voidwriteStoreFileRandomData(org.apache.hadoop.hbase.regionserver.StoreFileWriter writer, byte[] columnFamily, long timestamp) Writes random data to a store file with rows arranged in lexicographically increasing order.
-
Field Details
-
CLASS_RULE
-
LOG
-
TEST_UTIL
-
DAY
- See Also:
-
defaultConf
-
fs
-
blockCache
-
cacheConf
-
testDir
-
testOnlineRegions
-
dataTieringManager
-
hStoreFiles
-
rowKeyString
Represents the current lexicographically increasing string used as a row key when writing HFiles. It is incremented each timenextString()is called to generate unique row keys.
-
-
Constructor Details
-
TestDataTieringManager
public TestDataTieringManager()
-
-
Method Details
-
setupBeforeClass
- Throws:
Exception
-
updateCommonConfigurations
-
testDataTieringEnabledWithKey
- Throws:
IOException
-
testHotDataWithKey
- Throws:
IOException
-
testGracePeriodMakesColdFileHot
public void testGracePeriodMakesColdFileHot() throws IOException, org.apache.hadoop.hbase.regionserver.DataTieringException- Throws:
IOExceptionorg.apache.hadoop.hbase.regionserver.DataTieringException
-
testFileIsColdWithoutGracePeriod
public void testFileIsColdWithoutGracePeriod() throws IOException, org.apache.hadoop.hbase.regionserver.DataTieringException- Throws:
IOExceptionorg.apache.hadoop.hbase.regionserver.DataTieringException
-
testPrefetchWhenDataTieringEnabled
- Throws:
IOException
-
setPrefetchBlocksOnOpen
-
testColdDataFiles
- Throws:
IOException
-
testCacheCompactedBlocksOnWriteDataTieringDisabled
- Throws:
IOException
-
testCacheCompactedBlocksOnWriteWithHotData
- Throws:
IOException
-
testCacheCompactedBlocksOnWriteWithColdData
- Throws:
IOException
-
setCacheCompactBlocksOnWrite
-
testCacheCompactedBlocksOnWrite
private void testCacheCompactedBlocksOnWrite(org.apache.hadoop.hbase.regionserver.HRegion region, boolean expectDataBlocksCached) throws IOException - Throws:
IOException
-
createTestFilesForCompaction
private void createTestFilesForCompaction(org.apache.hadoop.hbase.regionserver.HStore hStore) throws IOException - Throws:
IOException
-
testPickColdDataFiles
- Throws:
IOException
-
testBlockEvictions
- Throws:
Exception
-
testBlockEvictionsAllColdBlocks
- Throws:
Exception
-
testBlockEvictionsHotBlocks
- Throws:
Exception
-
testFeatureKeyDisabled
- Throws:
Exception
-
testCacheConfigShouldCacheFile
- Throws:
Exception
-
testCacheOnReadColdFile
- Throws:
Exception
-
testCacheOnReadHotFile
- Throws:
Exception
-
testCacheOnRead
private void testCacheOnRead(org.apache.hadoop.hbase.regionserver.HStoreFile hStoreFile, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, long onDiskBlockSize, boolean expectedCached) throws Exception - Throws:
Exception
-
validateBlocks
private void validateBlocks(Set<org.apache.hadoop.hbase.io.hfile.BlockCacheKey> keys, int expectedTotalKeys, int expectedHotBlocks, int expectedColdBlocks) -
testDataTieringMethodWithKey
private void testDataTieringMethodWithKey(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithKeyExpectingException
private void testDataTieringMethodWithKeyExpectingException(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithKeyNoException
private void testDataTieringMethodWithKeyNoException(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult) -
initializeTestEnvironment
- Throws:
IOException
-
setupFileSystemAndCache
- Throws:
IOException
-
setupOnlineRegions
- Throws:
IOException
-
createHRegion
private static org.apache.hadoop.hbase.regionserver.HRegion createHRegion(String table) throws IOException - Throws:
IOException
-
createHRegion
private static org.apache.hadoop.hbase.regionserver.HRegion createHRegion(String table, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
createHStore
private static org.apache.hadoop.hbase.regionserver.HStore createHStore(org.apache.hadoop.hbase.regionserver.HRegion region, String columnFamily) throws IOException - Throws:
IOException
-
createHStore
private static org.apache.hadoop.hbase.regionserver.HStore createHStore(org.apache.hadoop.hbase.regionserver.HRegion region, String columnFamily, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
getConfWithTimeRangeDataTieringEnabled
private static org.apache.hadoop.conf.Configuration getConfWithTimeRangeDataTieringEnabled(long hotDataAge) -
getConfWithGracePeriod
private static org.apache.hadoop.conf.Configuration getConfWithGracePeriod(long hotDataAge, long gracePeriod) -
createHStoreFile
static org.apache.hadoop.hbase.regionserver.HStoreFile createHStoreFile(org.apache.hadoop.fs.Path storeDir, org.apache.hadoop.conf.Configuration conf, long timestamp, org.apache.hadoop.hbase.regionserver.HRegionFileSystem regionFs) throws IOException - Throws:
IOException
-
writeStoreFileRandomData
private static void writeStoreFileRandomData(org.apache.hadoop.hbase.regionserver.StoreFileWriter writer, byte[] columnFamily, long timestamp) throws IOException Writes random data to a store file with rows arranged in lexicographically increasing order. Each row is generated using thenextString()method, ensuring that each subsequent row is lexicographically larger than the previous one.- Throws:
IOException
-
generateRandomBytes
-
nextString
Returns the lexicographically larger string every time it's called.
-