Class MobFileCache

java.lang.Object
org.apache.hadoop.hbase.mob.MobFileCache

@Private public class MobFileCache extends Object
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.
  • Field Details

  • Constructor Details

    • MobFileCache

      public MobFileCache(org.apache.hadoop.conf.Configuration conf)
  • Method Details

    • evict

      public void evict()
      Evicts the lru cached mob files when the count of the cached files is larger than the threshold.
    • evictFile

      public void evictFile(String fileName)
      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

      public void closeFile(MobFile file)
      Closes a mob file.
      Parameters:
      file - The mob file that needs to be closed.
    • shutdown

      public void shutdown()
    • getCacheSize

      public int getCacheSize()
      Gets the count of cached mob files.
      Returns:
      The count of the cached mob files.
    • getAccessCount

      public long getAccessCount()
      Gets the count of accesses to the mob file cache.
      Returns:
      The count of accesses to the mob file cache.
    • getMissCount

      public long getMissCount()
      Gets the count of misses to the mob file cache.
      Returns:
      The count of misses to the mob file cache.
    • getEvictedFileCount

      public long getEvictedFileCount()
      Gets the number of items evicted from the mob file cache.
      Returns:
      The number of items evicted from the mob file cache.
    • getHitRatio

      public double getHitRatio()
      Gets the hit ratio to the mob file cache.
      Returns:
      The hit ratio to the mob file cache.
    • printStatistics

      public void printStatistics()
      Prints the statistics.
    • hashFileName

      private long hashFileName(String fileName)
      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.