Class TestBucketCacheRefCnt.MyBucketCache
java.lang.Object
org.apache.hadoop.hbase.io.hfile.bucket.BucketCache
org.apache.hadoop.hbase.io.hfile.bucket.TestBucketCacheRefCnt.MyBucketCache
- All Implemented Interfaces:
Iterable<org.apache.hadoop.hbase.io.hfile.CachedBlock>,org.apache.hadoop.hbase.conf.ConfigurationObserver,org.apache.hadoop.hbase.io.HeapSize,org.apache.hadoop.hbase.io.hfile.BlockCache
- Enclosing class:
- TestBucketCacheRefCnt
static class TestBucketCacheRefCnt.MyBucketCache
extends org.apache.hadoop.hbase.io.hfile.bucket.BucketCache
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.io.hfile.bucket.BucketCache
org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.CacheState, org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.RAMCache, org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.RAMQueueEntry, org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.WriterThread -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicIntegerprivate static final Stringprivate final CyclicBarrierprivate final AtomicIntegerprivate static final Stringprivate org.apache.hadoop.hbase.nio.ByteBuffprivate final AtomicIntegerFields inherited from class org.apache.hadoop.hbase.io.hfile.bucket.BucketCache
ACCEPT_FACTOR_CONFIG_NAME, BACKING_MAP_PERSISTENCE_CHUNK_SIZE, backingMap, BLOCK_ORPHAN_GRACE_PERIOD, BLOCK_ORPHAN_GRACE_PERIOD_DEFAULT, blocksByHFile, DEFAULT_ACCEPT_FACTOR, DEFAULT_BACKING_MAP_PERSISTENCE_CHUNK_SIZE, DEFAULT_ERROR_TOLERATION_DURATION, DEFAULT_EXTRA_FREE_FACTOR, DEFAULT_FREE_ENTIRE_BLOCK_FACTOR, DEFAULT_MEMORY_FACTOR, DEFAULT_MIN_FACTOR, DEFAULT_MULTI_FACTOR, DEFAULT_SINGLE_FACTOR, DEFAULT_WRITER_QUEUE_ITEMS, DEFAULT_WRITER_THREADS, EXTRA_FREE_FACTOR_CONFIG_NAME, fullyCachedFiles, ioEngine, isCacheInconsistent, MEMORY_FACTOR_CONFIG_NAME, MIN_FACTOR_CONFIG_NAME, MULTI_FACTOR_CONFIG_NAME, offsetLock, QUEUE_ADDITION_WAIT_TIME, ramCache, regionCachedSize, SINGLE_FACTOR_CONFIG_NAME, writerQueues, writerThreads -
Constructor Summary
ConstructorsConstructorDescriptionMyBucketCache(String ioEngineName, long capacity, int blockSize, int[] bucketSizes, int writerThreadNum, int writerQLen, String persistencePath) -
Method Summary
Modifier and TypeMethodDescription(package private) voidblockEvicted(org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey, org.apache.hadoop.hbase.io.hfile.bucket.BucketEntry bucketEntry, boolean decrementBlockNumber, boolean evictedByEvictionProcess) protected voidcacheBlockWithWaitInternal(org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey, org.apache.hadoop.hbase.io.hfile.Cacheable cachedItem, boolean inMemory, boolean wait) (package private) voidfreeBucketEntry(org.apache.hadoop.hbase.io.hfile.bucket.BucketEntry bucketEntry) Overwrite 0xff to theBucketEntrycontent to simulate it would be overwrite after theBucketEntryis freed.org.apache.hadoop.hbase.io.hfile.CacheablegetBlock(org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean caching, boolean repeat, boolean updateCacheMetrics) protected booleanshouldReplaceExistingCacheBlock(org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey, org.apache.hadoop.hbase.io.hfile.Cacheable newBlock) Simulate the Block could be replaced.Methods inherited from class org.apache.hadoop.hbase.io.hfile.bucket.BucketCache
acceptableSize, blockFitsIntoTheCache, cacheBlock, cacheBlock, cacheBlock, cacheBlockWithWait, createRecycler, doDrain, evictBlock, evictBlockIfNoRpcReferenced, evictBlocksByHfileName, evictBlocksRangeByHfileName, evictBucketEntryIfNoRpcReferenced, fileCacheCompleted, finalize, freeSpace, getAcceptableFactor, getAlgorithm, getAllocator, getBackingMap, getBackingMapValidated, getBlockCaches, getBlockCount, getBlockForReference, getBlockSize, getBucketCacheFromCacheConfig, getBucketcachePersistInterval, getCurrentDataSize, getCurrentSize, getDataBlockCount, getExtraFreeFactor, getFreeSize, getFullyCachedFiles, getIoEngine, getMaxSize, getMemoryFactor, getMinFactor, getMultiFactor, getPartitionSize, getPersistenceChunkSize, getPersistencePath, getQueueAdditionWaitTime, getRAMQueueEntries, getRealCacheSize, getRegionCachedInfo, getRpcRefCount, getSingleFactor, getStats, heapSize, isAlreadyCached, isCacheEnabled, isCacheInconsistent, isCacheInitialized, isCachePersistenceEnabled, isCachePersistent, iterator, logStats, notifyFileCachingCompleted, onConfigurationChange, persistToFile, putIntoBackingMap, removeFromRamCache, setCacheInconsistent, setCacheState, shouldCacheBlock, shouldCacheFile, shutdown, size, startBucketCachePersisterThread, startWriterThreads, stopWriterThreads, waitForCacheInitializationMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.io.hfile.BlockCache
getBlock, isMetaBlockMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
GET_BLOCK_THREAD_NAME
- See Also:
-
CACHE_BLOCK_THREAD_NAME
- See Also:
-
cyclicBarrier
-
replaceCounter
-
blockEvictCounter
-
freeBucketEntryCounter
-
overwiteByteBuff
-
-
Constructor Details
-
MyBucketCache
public MyBucketCache(String ioEngineName, long capacity, int blockSize, int[] bucketSizes, int writerThreadNum, int writerQLen, String persistencePath) throws IOException - Throws:
IOException
-
-
Method Details
-
shouldReplaceExistingCacheBlock
protected boolean shouldReplaceExistingCacheBlock(org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey, org.apache.hadoop.hbase.io.hfile.Cacheable newBlock) Simulate the Block could be replaced.- Overrides:
shouldReplaceExistingCacheBlockin classorg.apache.hadoop.hbase.io.hfile.bucket.BucketCache
-
getBlock
public org.apache.hadoop.hbase.io.hfile.Cacheable getBlock(org.apache.hadoop.hbase.io.hfile.BlockCacheKey key, boolean caching, boolean repeat, boolean updateCacheMetrics) - Specified by:
getBlockin interfaceorg.apache.hadoop.hbase.io.hfile.BlockCache- Overrides:
getBlockin classorg.apache.hadoop.hbase.io.hfile.bucket.BucketCache
-
cacheBlockWithWaitInternal
protected void cacheBlockWithWaitInternal(org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey, org.apache.hadoop.hbase.io.hfile.Cacheable cachedItem, boolean inMemory, boolean wait) - Overrides:
cacheBlockWithWaitInternalin classorg.apache.hadoop.hbase.io.hfile.bucket.BucketCache
-
blockEvicted
void blockEvicted(org.apache.hadoop.hbase.io.hfile.BlockCacheKey cacheKey, org.apache.hadoop.hbase.io.hfile.bucket.BucketEntry bucketEntry, boolean decrementBlockNumber, boolean evictedByEvictionProcess) - Overrides:
blockEvictedin classorg.apache.hadoop.hbase.io.hfile.bucket.BucketCache
-
freeBucketEntry
Overwrite 0xff to theBucketEntrycontent to simulate it would be overwrite after theBucketEntryis freed.- Overrides:
freeBucketEntryin classorg.apache.hadoop.hbase.io.hfile.bucket.BucketCache
-