java.lang.Object
org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetCache

@Private @Unstable public class FsDatasetCache extends Object
Manages caching for an FsDatasetImpl by using the mmap(2) and mlock(2) system calls to lock blocks into memory. Block checksums are verified upon entry into the cache.
  • Constructor Details

    • FsDatasetCache

      public FsDatasetCache(org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.FsDatasetImpl dataset) throws IOException
      Throws:
      IOException
  • Method Details

    • initCache

      public void initCache(String bpid) throws IOException
      For persistent memory cache, create cache subdirectory specified with blockPoolId to store cache data. Recover the status of cache in persistent memory, if any.
      Throws:
      IOException
    • getMemCacheUsed

      public long getMemCacheUsed()
      Get the approximate amount of DRAM cache space used.
    • getCacheUsed

      public long getCacheUsed()
      Get the approximate amount of cache space used either on DRAM or on persistent memory.
      Returns:
    • getMemCacheCapacity

      public long getMemCacheCapacity()
      Get the maximum amount of bytes we can cache on DRAM. This is a constant.
    • getCacheCapacity

      public long getCacheCapacity()
      Get the maximum amount of bytes we can cache either on DRAM or on persistent memory. This is a constant.
    • getNumBlocksFailedToCache

      public long getNumBlocksFailedToCache()
    • getNumBlocksFailedToUncache

      public long getNumBlocksFailedToUncache()
    • getNumBlocksCached

      public long getNumBlocksCached()
    • isCached

      public boolean isCached(String bpid, long blockId)