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,
BucketEntry which is restored from a persistence file
could not be freed even if corresponding HFileBlock is evicted from
BucketCache . |
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
IOException
public 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.BucketAllocatorException
public void testCacheSimple() throws Exception
Exception
public void testCacheMultiThreadedSingleKey() throws Exception
Exception
public void testHeapSizeChanges() throws Exception
Exception
public static void waitUntilFlushedToBucket(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache, org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey) throws InterruptedException
InterruptedException
public static void waitUntilAllFlushedToBucket(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache cache) throws InterruptedException
InterruptedException
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) throws InterruptedException
InterruptedException
public void testMemoryLeak() throws Exception
Exception
public void testRetrieveFromFile() throws Exception
Exception
public void testBucketAllocatorLargeBuckets() throws org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocatorException
org.apache.hadoop.hbase.io.hfile.bucket.BucketAllocatorException
public void testGetPartitionSize() throws IOException
IOException
public void testValidBucketCacheConfigs() throws IOException
IOException
public void testInvalidAcceptFactorConfig() throws IOException
IOException
public void testInvalidMinFactorConfig() throws IOException
IOException
public void testInvalidExtraFreeFactorConfig() throws IOException
IOException
public void testInvalidCacheSplitFactorConfig() throws IOException
IOException
private void checkConfigValues(org.apache.hadoop.conf.Configuration conf, Map<String,float[]> configMap, boolean[] expectSuccess) throws IOException
IOException
private void validateGetPartitionSize(org.apache.hadoop.hbase.io.hfile.bucket.BucketCache bucketCache, float partitionFactor, float minFactor)
public void testOffsetProducesPositiveOutput()
public void testEvictionCount() throws InterruptedException
InterruptedException
public void testCacheBlockNextBlockMetadataMissing() throws Exception
Exception
public void testRAMCache()
public void testFreeBlockWhenIOEngineWriteFailure() throws IOException
IOException
public void testFreeBucketEntryRestoredFromFile() throws Exception
BucketEntry
which is restored from a persistence file
could not be freed even if corresponding HFileBlock
is evicted from
BucketCache
.Exception
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.