public class TestBucketCache extends Object
Tests will ensure that blocks' data correctness under several threads concurrency
| Modifier and Type | Class and Description | 
|---|---|
| private static class  | TestBucketCache.MockedBucketCache | 
| Modifier and Type | Field and Description | 
|---|---|
| (package private) int | BLOCK_SIZE | 
| (package private) org.apache.hadoop.hbase.io.hfile.bucket.BucketCache | cache | 
| (package private) int | CACHE_SIZE | 
| (package private) long | capacitySize | 
| static HBaseClassTestRule | CLASS_RULE | 
| int | constructedBlockSize | 
| int[] | constructedBlockSizes | 
| private static HBaseTestingUtility | HBASE_TESTING_UTILITY | 
| (package private) String | ioEngineName | 
| (package private) int | NUM_BLOCKS | 
| (package private) int | NUM_QUERIES | 
| (package private) int | NUM_THREADS | 
| (package private) String | persistencePath | 
| (package private) int | writerQLen | 
| (package private) int | writeThreads | 
| Constructor and Description | 
|---|
| TestBucketCache() | 
| Modifier and Type | Method and Description | 
|---|---|
| private void | cacheAndWaitUntilFlushedToBucket(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache,
                                org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey,
                                org.apache.hadoop.hbase.io.hfile.Cacheable block) | 
| private void | checkConfigValues(org.apache.hadoop.conf.Configuration conf,
                 Map<String,float[]> configMap,
                 boolean[] expectSuccess) | 
| private org.apache.hadoop.fs.Path | createAndGetTestDir()Test Utility to create test dir and return name | 
| static Iterable<Object[]> | data() | 
| private static <T> T | randFrom(List<T> a)Return a random element from  a. | 
| void | setup() | 
| void | tearDown() | 
| void | testBucketAllocator() | 
| void | testBucketAllocatorLargeBuckets() | 
| void | testCacheBlockNextBlockMetadataMissing() | 
| void | testCacheMultiThreadedSingleKey() | 
| void | testCacheSimple() | 
| void | testEvictionCount() | 
| void | testFreeBlockWhenIOEngineWriteFailure() | 
| void | testFreeBucketEntryRestoredFromFile()This test is for HBASE-26295,  BucketEntrywhich is restored from a persistence file
 could not be freed even if correspondingHFileBlockis evicted fromBucketCache. | 
| void | testGetPartitionSize() | 
| void | testHeapSizeChanges() | 
| void | testInvalidAcceptFactorConfig() | 
| void | testInvalidCacheSplitFactorConfig() | 
| void | testInvalidExtraFreeFactorConfig() | 
| void | testInvalidMinFactorConfig() | 
| void | testMemoryLeak() | 
| void | testOffsetProducesPositiveOutput() | 
| void | testRAMCache() | 
| void | testRetrieveFromFile() | 
| void | testValidBucketCacheConfigs() | 
| private void | validateGetPartitionSize(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache bucketCache,
                        float partitionFactor,
                        float minFactor) | 
| static void | waitUntilAllFlushedToBucket(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache) | 
| static void | waitUntilFlushedToBucket(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache,
                        org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey) | 
public static final HBaseClassTestRule CLASS_RULE
public int constructedBlockSize
public int[] constructedBlockSizes
org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache
final int CACHE_SIZE
final int NUM_BLOCKS
final int BLOCK_SIZE
final int NUM_THREADS
final int NUM_QUERIES
final long capacitySize
final int writeThreads
final int writerQLen
String ioEngineName
String persistencePath
private static final HBaseTestingUtility HBASE_TESTING_UTILITY
public TestBucketCache()
public void setup() throws IOException
IOExceptionpublic void tearDown()
private org.apache.hadoop.fs.Path createAndGetTestDir() throws IOException
IOException - throws IOExceptionpublic void testBucketAllocator() throws org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocatorException
org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocatorExceptionpublic void testCacheSimple() throws Exception
Exceptionpublic void testCacheMultiThreadedSingleKey() throws Exception
Exceptionpublic void testHeapSizeChanges() throws Exception
Exceptionpublic static void waitUntilFlushedToBucket(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache, org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey) throws InterruptedException
InterruptedExceptionpublic static void waitUntilAllFlushedToBucket(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache) throws InterruptedException
InterruptedExceptionprivate void cacheAndWaitUntilFlushedToBucket(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache, org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey, org.apache.hadoop.hbase.io.hfile.Cacheable block) throws InterruptedException
InterruptedExceptionpublic void testMemoryLeak() throws Exception
Exceptionpublic void testRetrieveFromFile() throws Exception
Exceptionpublic void testBucketAllocatorLargeBuckets() throws org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocatorException
org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocatorExceptionpublic void testGetPartitionSize() throws IOException
IOExceptionpublic void testValidBucketCacheConfigs() throws IOException
IOExceptionpublic void testInvalidAcceptFactorConfig() throws IOException
IOExceptionpublic void testInvalidMinFactorConfig() throws IOException
IOExceptionpublic void testInvalidExtraFreeFactorConfig() throws IOException
IOExceptionpublic void testInvalidCacheSplitFactorConfig() throws IOException
IOExceptionprivate void checkConfigValues(org.apache.hadoop.conf.Configuration conf, Map<String,float[]> configMap, boolean[] expectSuccess) throws IOException
IOExceptionprivate void validateGetPartitionSize(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache bucketCache, float partitionFactor, float minFactor)
public void testOffsetProducesPositiveOutput()
public void testEvictionCount() throws InterruptedException
InterruptedExceptionpublic void testCacheBlockNextBlockMetadataMissing() throws Exception
Exceptionpublic void testRAMCache()
public void testFreeBlockWhenIOEngineWriteFailure() throws IOException
IOExceptionpublic void testFreeBucketEntryRestoredFromFile() throws Exception
BucketEntry which is restored from a persistence file
 could not be freed even if corresponding HFileBlock is evicted from
 BucketCache.ExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.