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
(package private) static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static org.apache.hadoop.hbase.io.hfile.BlockCache
private static org.apache.hadoop.hbase.io.hfile.CacheConfig
static final HBaseClassTestRule
private static org.apache.hadoop.hbase.regionserver.DataTieringManager
private static final long
private static org.apache.hadoop.conf.Configuration
private static org.apache.hadoop.fs.FileSystem
private static final List<org.apache.hadoop.hbase.regionserver.HStoreFile>
private static final org.slf4j.Logger
private static String
Represents the current lexicographically increasing string used as a row key when writing HFiles.private static final HBaseTestingUtil
private static org.apache.hadoop.fs.Path
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.apache.hadoop.hbase.regionserver.HRegion
createHRegion
(String table) private static org.apache.hadoop.hbase.regionserver.HRegion
createHRegion
(String table, org.apache.hadoop.conf.Configuration conf) private static org.apache.hadoop.hbase.regionserver.HStore
createHStore
(org.apache.hadoop.hbase.regionserver.HRegion region, String columnFamily) private static org.apache.hadoop.hbase.regionserver.HStore
createHStore
(org.apache.hadoop.hbase.regionserver.HRegion region, String columnFamily, org.apache.hadoop.conf.Configuration conf) (package 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) private void
createTestFilesForCompaction
(org.apache.hadoop.hbase.regionserver.HStore hStore) private static byte[]
generateRandomBytes
(int sizeInBytes) private static org.apache.hadoop.conf.Configuration
getConfWithTimeRangeDataTieringEnabled
(long hotDataAge) private static void
private static String
Returns the lexicographically larger string every time it's called.private void
private void
static void
private static void
private static void
void
void
void
private void
testCacheCompactedBlocksOnWrite
(org.apache.hadoop.hbase.regionserver.HRegion region, boolean expectDataBlocksCached) void
void
void
void
private void
testCacheOnRead
(org.apache.hadoop.hbase.regionserver.HStoreFile hStoreFile, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, long onDiskBlockSize, boolean expectedCached) void
void
void
void
void
private void
testDataTieringMethodWithKey
(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private void
testDataTieringMethodWithKeyExpectingException
(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private void
testDataTieringMethodWithKeyNoException
(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult) private void
testDataTieringMethodWithPath
(TestDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private void
testDataTieringMethodWithPathExpectingException
(TestDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, org.apache.hadoop.hbase.regionserver.DataTieringException exception) private void
testDataTieringMethodWithPathNoException
(TestDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, boolean expectedResult) void
void
void
void
void
private static void
private void
validateBlocks
(Set<org.apache.hadoop.hbase.io.hfile.BlockCacheKey> keys, int expectedTotalKeys, int expectedHotBlocks, int expectedColdBlocks) private static void
writeStoreFileRandomData
(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
-
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(TestDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithKey
private void testDataTieringMethodWithKey(TestDataTieringManager.DataTieringMethodCallerWithKey caller, org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean expectedResult, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithPathExpectingException
private void testDataTieringMethodWithPathExpectingException(TestDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, org.apache.hadoop.hbase.regionserver.DataTieringException exception) -
testDataTieringMethodWithPathNoException
private void testDataTieringMethodWithPathNoException(TestDataTieringManager.DataTieringMethodCallerWithPath caller, org.apache.hadoop.fs.Path path, boolean expectedResult) -
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) -
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.
-