Class TestCustomCellDataTieringManager
java.lang.Object
org.apache.hadoop.hbase.regionserver.TestCustomCellDataTieringManager
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 TestCustomCellDataTieringManager#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(package private) static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate 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, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.io.hfile.BlockCache blockCache) private static org.apache.hadoop.hbase.regionserver.HRegioncreateHRegion(String table, org.apache.hadoop.hbase.io.hfile.BlockCache blockCache) 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) 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.ConfigurationgetConfWithCustomCellDataTieringEnabled(long hotDataAge) private static org.apache.hadoop.hbase.io.hfile.BlockCacheprivate static StringReturns the lexicographically larger string every time it's called.private voidprivate voidstatic voidprivate static org.apache.hadoop.hbase.io.hfile.BlockCacheprivate static voidsetupOnlineRegions(org.apache.hadoop.hbase.io.hfile.BlockCache blockCache) voidvoidvoidprivate 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) voidvoidvoidvoidvoidprivate voidtestDataTieringMethodWithKey(TestCustomCellDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private voidtestDataTieringMethodWithKeyExpectingException(TestCustomCellDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private voidtestDataTieringMethodWithKeyNoException(TestCustomCellDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult) private voidtestDataTieringMethodWithPath(TestCustomCellDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private voidtestDataTieringMethodWithPathExpectingException(TestCustomCellDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private voidtestDataTieringMethodWithPathNoException(TestCustomCellDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, boolean expectedResult) voidvoidvoidvoidvoidprivate 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
-
TestCustomCellDataTieringManager
public TestCustomCellDataTieringManager()
-
-
Method Details
-
setupBeforeClass
- Throws:
Exception
-
updateCommonConfigurations
-
testDataTieringEnabledWithKey
- Throws:
IOException
-
testDataTieringEnabledWithPath
- Throws:
IOException
-
testHotDataWithKey
- Throws:
IOException
-
testHotDataWithPath
- Throws:
IOException
-
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) -
testDataTieringMethodWithPath
private void testDataTieringMethodWithPath(TestCustomCellDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithKey
private void testDataTieringMethodWithKey(TestCustomCellDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithPathExpectingException
private void testDataTieringMethodWithPathExpectingException(TestCustomCellDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithPathNoException
private void testDataTieringMethodWithPathNoException(TestCustomCellDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, boolean expectedResult) -
testDataTieringMethodWithKeyExpectingException
private void testDataTieringMethodWithKeyExpectingException(TestCustomCellDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithKeyNoException
private void testDataTieringMethodWithKeyNoException(TestCustomCellDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult) -
initializeTestEnvironment
private static org.apache.hadoop.hbase.io.hfile.BlockCache initializeTestEnvironment() throws IOException- Throws:
IOException
-
setupFileSystemAndCache
private static org.apache.hadoop.hbase.io.hfile.BlockCache setupFileSystemAndCache() throws IOException- Throws:
IOException
-
setupOnlineRegions
private static void setupOnlineRegions(org.apache.hadoop.hbase.io.hfile.BlockCache blockCache) throws IOException - Throws:
IOException
-
createHRegion
private static org.apache.hadoop.hbase.regionserver.HRegion createHRegion(String table, org.apache.hadoop.hbase.io.hfile.BlockCache blockCache) throws IOException - Throws:
IOException
-
createHRegion
private static org.apache.hadoop.hbase.regionserver.HRegion createHRegion(String table, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.io.hfile.BlockCache blockCache) 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
-
createHStoreFile
private 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
-
getConfWithCustomCellDataTieringEnabled
private static org.apache.hadoop.conf.Configuration getConfWithCustomCellDataTieringEnabled(long hotDataAge) -
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.
-