Package org.apache.hadoop.hbase.util
Class HFileArchiveUtil
java.lang.Object
org.apache.hadoop.hbase.util.HFileArchiveUtil
Helper class for all utilities related to archival/retrieval of HFiles
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.fs.PathgetArchivePath(org.apache.hadoop.conf.Configuration conf) Get the full path to the archive directory on the configuredMasterFileSystemprivate static org.apache.hadoop.fs.PathgetArchivePath(org.apache.hadoop.fs.Path rootdir) Get the full path to the archive directory on the configuredMasterFileSystemstatic org.apache.hadoop.fs.PathgetRegionArchiveDir(org.apache.hadoop.fs.Path rootDir, TableName tableName, String encodedRegionName) Get the archive directory for a given region under the specified tablestatic org.apache.hadoop.fs.PathgetRegionArchiveDir(org.apache.hadoop.fs.Path rootDir, TableName tableName, org.apache.hadoop.fs.Path regiondir) Get the archive directory for a given region under the specified tablestatic org.apache.hadoop.fs.PathgetStoreArchivePath(org.apache.hadoop.conf.Configuration conf, RegionInfo region, byte[] family) Gets the directory to archive a store directory.static org.apache.hadoop.fs.PathgetStoreArchivePath(org.apache.hadoop.conf.Configuration conf, RegionInfo region, org.apache.hadoop.fs.Path tabledir, byte[] family) Get the directory to archive a store directorystatic org.apache.hadoop.fs.PathgetStoreArchivePath(org.apache.hadoop.conf.Configuration conf, TableName tableName, String regionName, String familyName) Get the directory to archive a store directorystatic org.apache.hadoop.fs.PathgetStoreArchivePathForArchivePath(org.apache.hadoop.fs.Path archivePath, RegionInfo region, byte[] family) static org.apache.hadoop.fs.PathgetStoreArchivePathForRootDir(org.apache.hadoop.fs.Path rootDir, RegionInfo region, byte[] family) Gets the archive directory under specified root dir.static org.apache.hadoop.fs.PathgetTableArchivePath(org.apache.hadoop.conf.Configuration conf, TableName tableName) Get the path to the table archive directory based on the configured archive directory.static org.apache.hadoop.fs.PathgetTableArchivePath(org.apache.hadoop.fs.Path rootdir, TableName tableName) Get the path to the table archive directory based on the configured archive directory.static TableNamegetTableName(org.apache.hadoop.fs.Path archivePath)
-
Constructor Details
-
HFileArchiveUtil
private HFileArchiveUtil()
-
-
Method Details
-
getStoreArchivePath
public static org.apache.hadoop.fs.Path getStoreArchivePath(org.apache.hadoop.conf.Configuration conf, TableName tableName, String regionName, String familyName) throws IOException Get the directory to archive a store directory- Parameters:
conf-Configurationto read for the archive directory nametableName- table name under which the store currently livesregionName- region encoded name under which the store currently livesfamilyName- name of the family in the store- Returns:
Pathto the directory to archive the given store or null if it should not be archived- Throws:
IOException
-
getStoreArchivePath
public static org.apache.hadoop.fs.Path getStoreArchivePath(org.apache.hadoop.conf.Configuration conf, RegionInfo region, org.apache.hadoop.fs.Path tabledir, byte[] family) throws IOException Get the directory to archive a store directory- Parameters:
conf-Configurationto read for the archive directory name.region- parent region information under which the store currently livestabledir- directory for the table under which the store currently livesfamily- name of the family in the store- Returns:
Pathto the directory to archive the given store or null if it should not be archived- Throws:
IOException
-
getStoreArchivePath
public static org.apache.hadoop.fs.Path getStoreArchivePath(org.apache.hadoop.conf.Configuration conf, RegionInfo region, byte[] family) throws IOException Gets the directory to archive a store directory.- Parameters:
conf-Configurationto read for the archive directory name.region- parent region information under which the store currently livesfamily- name of the family in the store- Returns:
Pathto the directory to archive the given store or null if it should not be archived- Throws:
IOException
-
getStoreArchivePathForRootDir
public static org.apache.hadoop.fs.Path getStoreArchivePathForRootDir(org.apache.hadoop.fs.Path rootDir, RegionInfo region, byte[] family) Gets the archive directory under specified root dir. One scenario where this is useful is when WAL and root dir are configured under different file systems, i.e. root dir on S3 and WALs on HDFS. This is mostly useful for archiving recovered edits, when hbase.region.archive.recovered.edits is enabled.- Parameters:
rootDir-Paththe root dir under which archive path should be created.region- parent region information under which the store currently livesfamily- name of the family in the store- Returns:
Pathto the WAL FS directory to archive the given store or null if it should not be archived
-
getStoreArchivePathForArchivePath
public static org.apache.hadoop.fs.Path getStoreArchivePathForArchivePath(org.apache.hadoop.fs.Path archivePath, RegionInfo region, byte[] family) -
getRegionArchiveDir
public static org.apache.hadoop.fs.Path getRegionArchiveDir(org.apache.hadoop.fs.Path rootDir, TableName tableName, org.apache.hadoop.fs.Path regiondir) Get the archive directory for a given region under the specified table- Parameters:
tableName- the table name. Cannot be null.regiondir- the path to the region directory. Cannot be null.- Returns:
Pathto the directory to archive the given region, or null if it should not be archived
-
getRegionArchiveDir
public static org.apache.hadoop.fs.Path getRegionArchiveDir(org.apache.hadoop.fs.Path rootDir, TableName tableName, String encodedRegionName) Get the archive directory for a given region under the specified table- Parameters:
rootDir-Pathto the root directory where hbase files are stored (for building the archive path)tableName- name of the table to archive. Cannot be null.- Returns:
Pathto the directory to archive the given region, or null if it should not be archived
-
getTableArchivePath
public static org.apache.hadoop.fs.Path getTableArchivePath(org.apache.hadoop.fs.Path rootdir, TableName tableName) Get the path to the table archive directory based on the configured archive directory.Get the path to the table's archive directory.
Generally of the form: /hbase/.archive/[tablename]
- Parameters:
rootdir-Pathto the root directory where hbase files are stored (for building the archive path)tableName- Name of the table to be archived. Cannot be null.- Returns:
Pathto the archive directory for the table
-
getTableArchivePath
public static org.apache.hadoop.fs.Path getTableArchivePath(org.apache.hadoop.conf.Configuration conf, TableName tableName) throws IOException Get the path to the table archive directory based on the configured archive directory.Assumed that the table should already be archived.
- Parameters:
conf-Configurationto read the archive directory property. Can be nulltableName- Name of the table to be archived. Cannot be null.- Returns:
Pathto the archive directory for the table- Throws:
IOException
-
getArchivePath
public static org.apache.hadoop.fs.Path getArchivePath(org.apache.hadoop.conf.Configuration conf) throws IOException Get the full path to the archive directory on the configuredMasterFileSystem- Parameters:
conf- to look for archive directory name and root directory. Cannot be null. Notes for testing: requires a FileSystem root directory to be specified.- Returns:
- the full
Pathto the archive directory, as defined by the configuration - Throws:
IOException- if an unexpected error occurs
-
getArchivePath
Get the full path to the archive directory on the configuredMasterFileSystem- Parameters:
rootdir-Pathto the root directory where hbase files are stored (for building the archive path)- Returns:
- the full
Pathto the archive directory, as defined by the configuration
-
getTableName
-