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
-
Field Summary
Modifier and TypeFieldDescriptionprivate final org.apache.hadoop.conf.Configuration
private final AtomicLong
private final LongAdder
private final ReentrantLock
private float
private final boolean
private final IdLock
private long
private long
private long
private static final org.slf4j.Logger
private Map<String,
CachedMobFile> private final LongAdder
private final int
private final ScheduledExecutorService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Closes a mob file.void
evict()
Evicts the lru cached mob files when the count of the cached files is larger than the threshold.void
Evicts the cached file by the name.long
Gets the count of accesses to the mob file cache.int
Gets the count of cached mob files.long
Gets the number of items evicted from the mob file cache.double
Gets the hit ratio to the mob file cache.long
Gets the count of misses to the mob file cache.private long
hashFileName
(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) Opens a mob file.void
Prints the statistics.void
shutdown()
-
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) 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.
-