Package org.apache.hadoop.hbase.mob
Class MobFileCache
java.lang.Object
org.apache.hadoop.hbase.mob.MobFileCache
The cache for mob files. This cache doesn't cache the mob file blocks. It only caches the
references of mob files. We are doing this to avoid opening and closing mob files all the time.
We just keep references open.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.apache.hadoop.conf.Configurationprivate final AtomicLongprivate final LongAdderprivate final ReentrantLockprivate floatprivate final booleanprivate final IdLockprivate longprivate longprivate longprivate static final org.slf4j.Loggerprivate Map<String,CachedMobFile> private final LongAdderprivate final intprivate final ScheduledExecutorService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses a mob file.voidevict()Evicts the lru cached mob files when the count of the cached files is larger than the threshold.voidEvicts the cached file by the name.longGets the count of accesses to the mob file cache.intGets the count of cached mob files.longGets the number of items evicted from the mob file cache.doubleGets the hit ratio to the mob file cache.longGets the count of misses to the mob file cache.private longhashFileName(String fileName) Use murmurhash to reduce the conflicts of hashed file names.openFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, CacheConfig cacheConf, StoreContext storeContext) Opens a mob file.voidPrints the statistics.voidshutdown()
-
Field Details
-
LOG
-
map
-
count
-
lastAccess
-
miss
-
lastMiss
-
evictedFileCount
-
lastEvictedFileCount
-
evictionLock
-
keyLock
-
scheduleThreadPool
-
conf
-
mobFileMaxCacheSize
-
isCacheEnabled
-
evictRemainRatio
-
-
Constructor Details
-
MobFileCache
-
-
Method Details
-
evict
Evicts the lru cached mob files when the count of the cached files is larger than the threshold. -
evictFile
Evicts the cached file by the name.- Parameters:
fileName- The name of a cached file.
-
openFile
public MobFile openFile(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, CacheConfig cacheConf, StoreContext storeContext) throws IOException Opens a mob file.- Parameters:
fs- The current file system.path- The file path.cacheConf- The current MobCacheConfig- Returns:
- A opened mob file.
- Throws:
IOException
-
closeFile
Closes a mob file.- Parameters:
file- The mob file that needs to be closed.
-
shutdown
-
getCacheSize
Gets the count of cached mob files.- Returns:
- The count of the cached mob files.
-
getAccessCount
Gets the count of accesses to the mob file cache.- Returns:
- The count of accesses to the mob file cache.
-
getMissCount
Gets the count of misses to the mob file cache.- Returns:
- The count of misses to the mob file cache.
-
getEvictedFileCount
Gets the number of items evicted from the mob file cache.- Returns:
- The number of items evicted from the mob file cache.
-
getHitRatio
Gets the hit ratio to the mob file cache.- Returns:
- The hit ratio to the mob file cache.
-
printStatistics
Prints the statistics. -
hashFileName
Use murmurhash to reduce the conflicts of hashed file names. We should notice that the hash conflicts may bring deadlocks, when opening mob files with evicting some other files, as described in HBASE-28047.
-