Class PmemVolumeManager
java.lang.Object
org.apache.hadoop.hdfs.server.datanode.fsdataset.impl.PmemVolumeManager
Manage the persistent memory volumes.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateBlockPoolDir(String bpid) Create cache subdirectory specified with blockPoolId.longgetCachePath(org.apache.hadoop.hdfs.ExtendedBlockId key) The cache file path is pmemVolume/BlockPoolId/subdir#/subdir#/BlockId.longstatic PmemVolumeManagerstatic StringgetRealPmemDir(String rawPmemDir) idToCacheFileName(org.apache.hadoop.hdfs.ExtendedBlockId key) A cache file is named after the corresponding BlockId.idToCacheFilePath(Byte volumeIndex, org.apache.hadoop.hdfs.ExtendedBlockId key) Create and get the directory where a cache file with this key and volumeIndex should be stored.static voidvoidrecoverBlockKeyToVolume(org.apache.hadoop.hdfs.ExtendedBlockId key, byte volumeIndex) Map<org.apache.hadoop.hdfs.ExtendedBlockId,MappableBlock> recoverCache(String bpid, MappableBlockLoader cacheLoader) Recover cache from the cached files in the configured pmem volumes.static voidreset()static voidsetMaxBytes(long maxBytes)
-
Field Details
-
CACHE_DIR
- See Also:
-
-
Method Details
-
init
public static void init(String[] pmemVolumesConfig, boolean cacheRecoveryEnabled) throws IOException - Throws:
IOException
-
getInstance
-
reset
@VisibleForTesting public static void reset() -
setMaxBytes
@VisibleForTesting public static void setMaxBytes(long maxBytes) -
getCacheUsed
public long getCacheUsed() -
getCacheCapacity
public long getCacheCapacity() -
recoverCache
public Map<org.apache.hadoop.hdfs.ExtendedBlockId,MappableBlock> recoverCache(String bpid, MappableBlockLoader cacheLoader) throws IOException Recover cache from the cached files in the configured pmem volumes.- Throws:
IOException
-
recoverBlockKeyToVolume
public void recoverBlockKeyToVolume(org.apache.hadoop.hdfs.ExtendedBlockId key, byte volumeIndex) -
createBlockPoolDir
Create cache subdirectory specified with blockPoolId.- Throws:
IOException
-
getRealPmemDir
-
idToCacheFileName
A cache file is named after the corresponding BlockId. Thus, cache file name can be inferred according to BlockId. -
idToCacheFilePath
public String idToCacheFilePath(Byte volumeIndex, org.apache.hadoop.hdfs.ExtendedBlockId key) throws IOException Create and get the directory where a cache file with this key and volumeIndex should be stored. Use hierarchical strategy of storing blocks to avoid keeping cache files under one directory.- Parameters:
volumeIndex- The index of pmem volume where a replica will be cached to or has been cached to.key- The replica's ExtendedBlockId.- Returns:
- A path to which the block replica is mapped.
- Throws:
IOException
-
getCachePath
The cache file path is pmemVolume/BlockPoolId/subdir#/subdir#/BlockId.- Throws:
IOException
-