@InterfaceAudience.Private public class HFileLink extends FileLink
Searches for hfiles in the following order and locations:
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.fs.Path |
archivePath |
static Pattern |
LINK_NAME_PATTERN
Define the HFile Link name parser in the form of: table=region-hfile
|
static String |
LINK_NAME_REGEX
A non-capture group, for HFileLink, so that this can be embedded.
|
private static org.slf4j.Logger |
LOG |
private org.apache.hadoop.fs.Path |
mobPath |
private org.apache.hadoop.fs.Path |
originPath |
private static Pattern |
REF_OR_HFILE_LINK_PATTERN
The pattern should be used for hfile and reference links that can be found in
/hbase/table/region/family/
|
private org.apache.hadoop.fs.Path |
tempPath |
BACK_REFERENCES_DIRECTORY_PREFIX
Constructor and Description |
---|
HFileLink(org.apache.hadoop.fs.Path originPath,
org.apache.hadoop.fs.Path tempPath,
org.apache.hadoop.fs.Path mobPath,
org.apache.hadoop.fs.Path archivePath)
Dead simple hfile link constructor
|
Modifier and Type | Method and Description |
---|---|
static HFileLink |
build(org.apache.hadoop.conf.Configuration conf,
TableName table,
String region,
String family,
String hfile)
Create an HFileLink instance from table/region/family/hfile location
|
static HFileLink |
buildFromHFileLinkPattern(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path hFileLinkPattern) |
static HFileLink |
buildFromHFileLinkPattern(org.apache.hadoop.fs.Path rootDir,
org.apache.hadoop.fs.Path archiveDir,
org.apache.hadoop.fs.Path hFileLinkPattern) |
static String |
create(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dstFamilyPath,
RegionInfo hfileRegionInfo,
String hfileName)
Create a new HFileLink
|
static String |
create(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dstFamilyPath,
RegionInfo hfileRegionInfo,
String hfileName,
boolean createBackRef)
Create a new HFileLink
|
static String |
create(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dstFamilyPath,
String familyName,
String dstTableName,
String dstRegionName,
TableName linkedTable,
String linkedRegion,
String hfileName,
boolean createBackRef)
Create a new HFileLink
|
static String |
create(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dstFamilyPath,
TableName linkedTable,
String linkedRegion,
String hfileName)
Create a new HFileLink
|
static String |
create(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dstFamilyPath,
TableName linkedTable,
String linkedRegion,
String hfileName,
boolean createBackRef)
Create a new HFileLink.
|
(package private) static String |
createBackReferenceName(String tableNameStr,
String regionName)
Create the back reference name
|
static String |
createFromHFileLink(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dstFamilyPath,
String hfileLinkName,
boolean createBackRef)
Create a new HFileLink starting from a hfileLink name
|
static String |
createHFileLinkName(RegionInfo hfileRegionInfo,
String hfileName)
Create a new HFileLink name
|
static String |
createHFileLinkName(TableName tableName,
String regionName,
String hfileName)
Create a new HFileLink name
|
static org.apache.hadoop.fs.Path |
createPath(TableName table,
String region,
String family,
String hfile)
Create an HFileLink relative path for the table/region/family/hfile location
|
org.apache.hadoop.fs.Path |
getArchivePath()
Returns the path of the archived hfile.
|
static org.apache.hadoop.fs.Path |
getHFileFromBackReference(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path linkRefPath)
Get the full path of the HFile referenced by the back reference
|
static org.apache.hadoop.fs.Path |
getHFileFromBackReference(org.apache.hadoop.fs.Path rootDir,
org.apache.hadoop.fs.Path linkRefPath)
Get the full path of the HFile referenced by the back reference
|
private static org.apache.hadoop.fs.Path |
getHFileLinkPatternRelativePath(org.apache.hadoop.fs.Path path)
Convert a HFileLink path to a table relative path.
|
org.apache.hadoop.fs.Path |
getMobPath()
Returns the path of the mob hfiles.
|
org.apache.hadoop.fs.Path |
getOriginPath()
Returns the origin path of the hfile.
|
static String |
getReferencedHFileName(String fileName)
Get the HFile name of the referenced link
|
static String |
getReferencedRegionName(String fileName)
Get the Region name of the referenced link
|
static TableName |
getReferencedTableName(String fileName)
Get the Table name of the referenced link
|
static boolean |
isHFileLink(org.apache.hadoop.fs.Path path) |
static boolean |
isHFileLink(String fileName) |
static Pair<TableName,String> |
parseBackReferenceName(String name) |
equals, exists, getAvailablePath, getBackReferenceFileName, getBackReferencesDir, getFileStatus, getLocations, getUnderlyingFileLinkInputStream, hashCode, isBackReferencesDir, open, open, setLocations, toString
private static final org.slf4j.Logger LOG
public static final String LINK_NAME_REGEX
Table name is ([\p{IsAlphabetic}\p{Digit}][\p{IsAlphabetic}\p{Digit}.-]*), so '=' is an invalid character for the table name. Region name is ([a-f0-9]+), so '-' is an invalid character for the region name. HFile is ([0-9a-f]+(?:_SeqId_[0-9]+_)?) covering the plain hfiles (uuid) and the bulk loaded (_SeqId_[0-9]+_) hfiles.
Here is an example name: /hbase/test/0123/cf/testtb=4567-abcd where 'testtb' is table name and '4567' is region name and 'abcd' is filename.
public static final Pattern LINK_NAME_PATTERN
private static final Pattern REF_OR_HFILE_LINK_PATTERN
private final org.apache.hadoop.fs.Path archivePath
private final org.apache.hadoop.fs.Path originPath
private final org.apache.hadoop.fs.Path mobPath
private final org.apache.hadoop.fs.Path tempPath
public HFileLink(org.apache.hadoop.fs.Path originPath, org.apache.hadoop.fs.Path tempPath, org.apache.hadoop.fs.Path mobPath, org.apache.hadoop.fs.Path archivePath)
public static final HFileLink buildFromHFileLinkPattern(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path hFileLinkPattern) throws IOException
conf
- Configuration
from which to extract specific archive locationshFileLinkPattern
- The path ending with a HFileLink pattern. (table=region-hfile)IOException
- on unexpected error.public static final HFileLink buildFromHFileLinkPattern(org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.Path archiveDir, org.apache.hadoop.fs.Path hFileLinkPattern)
rootDir
- Path to the root directory where hbase files are storedarchiveDir
- Path to the hbase archive directoryhFileLinkPattern
- The path of the HFile Link.public static org.apache.hadoop.fs.Path createPath(TableName table, String region, String family, String hfile)
table
- Table nameregion
- Region Namefamily
- Family Namehfile
- HFile Namepublic static HFileLink build(org.apache.hadoop.conf.Configuration conf, TableName table, String region, String family, String hfile) throws IOException
conf
- Configuration
from which to extract specific archive locationstable
- Table nameregion
- Region Namefamily
- Family Namehfile
- HFile NameIOException
- on unexpected error.public org.apache.hadoop.fs.Path getOriginPath()
public org.apache.hadoop.fs.Path getArchivePath()
public org.apache.hadoop.fs.Path getMobPath()
public static boolean isHFileLink(org.apache.hadoop.fs.Path path)
path
- Path to check.public static boolean isHFileLink(String fileName)
fileName
- File name to check.private static org.apache.hadoop.fs.Path getHFileLinkPatternRelativePath(org.apache.hadoop.fs.Path path)
path
- HFileLink pathIOException
- on unexpected error.public static String getReferencedHFileName(String fileName)
fileName
- HFileLink file namepublic static String getReferencedRegionName(String fileName)
fileName
- HFileLink file namepublic static TableName getReferencedTableName(String fileName)
fileName
- HFileLink file namepublic static String createHFileLinkName(RegionInfo hfileRegionInfo, String hfileName)
hfileRegionInfo
- - Linked HFile Region InfohfileName
- - Linked HFile namepublic static String createHFileLinkName(TableName tableName, String regionName, String hfileName)
tableName
- - Linked HFile table nameregionName
- - Linked HFile region namehfileName
- - Linked HFile namepublic static String create(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dstFamilyPath, RegionInfo hfileRegionInfo, String hfileName) throws IOException
It also adds a back-reference to the hfile back-reference directory to simplify the reference-count and the cleaning process.
conf
- Configuration
to read for the archive directory namefs
- FileSystem
on which to write the HFileLinkdstFamilyPath
- - Destination path (table/region/cf/)hfileRegionInfo
- - Linked HFile Region InfohfileName
- - Linked HFile nameIOException
- on file or parent directory creation failure.public static String create(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dstFamilyPath, RegionInfo hfileRegionInfo, String hfileName, boolean createBackRef) throws IOException
It also adds a back-reference to the hfile back-reference directory to simplify the reference-count and the cleaning process.
conf
- Configuration
to read for the archive directory namefs
- FileSystem
on which to write the HFileLinkdstFamilyPath
- - Destination path (table/region/cf/)hfileRegionInfo
- - Linked HFile Region InfohfileName
- - Linked HFile namecreateBackRef
- - Whether back reference should be created. Defaults to true.IOException
- on file or parent directory creation failure.public static String create(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dstFamilyPath, TableName linkedTable, String linkedRegion, String hfileName) throws IOException
It also adds a back-reference to the hfile back-reference directory to simplify the reference-count and the cleaning process.
conf
- Configuration
to read for the archive directory namefs
- FileSystem
on which to write the HFileLinkdstFamilyPath
- - Destination path (table/region/cf/)linkedTable
- - Linked Table NamelinkedRegion
- - Linked Region NamehfileName
- - Linked HFile nameIOException
- on file or parent directory creation failure.public static String create(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dstFamilyPath, TableName linkedTable, String linkedRegion, String hfileName, boolean createBackRef) throws IOException
It also adds a back-reference to the hfile back-reference directory to simplify the reference-count and the cleaning process.
conf
- Configuration
to read for the archive directory namefs
- FileSystem
on which to write the HFileLinkdstFamilyPath
- - Destination path (table/region/cf/)linkedTable
- - Linked Table NamelinkedRegion
- - Linked Region NamehfileName
- - Linked HFile namecreateBackRef
- - Whether back reference should be created. Defaults to true.IOException
- on file or parent directory creation failure.public static String create(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dstFamilyPath, String familyName, String dstTableName, String dstRegionName, TableName linkedTable, String linkedRegion, String hfileName, boolean createBackRef) throws IOException
It also adds a back-reference to the hfile back-reference directory to simplify the reference-count and the cleaning process.
conf
- Configuration
to read for the archive directory namefs
- FileSystem
on which to write the HFileLinkdstFamilyPath
- - Destination path (table/region/cf/)dstTableName
- - Destination table namedstRegionName
- - Destination region namelinkedTable
- - Linked Table NamelinkedRegion
- - Linked Region NamehfileName
- - Linked HFile namecreateBackRef
- - Whether back reference should be created. Defaults to true.IOException
- on file or parent directory creation failurepublic static String createFromHFileLink(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dstFamilyPath, String hfileLinkName, boolean createBackRef) throws IOException
It also adds a back-reference to the hfile back-reference directory to simplify the reference-count and the cleaning process.
conf
- Configuration
to read for the archive directory namefs
- FileSystem
on which to write the HFileLinkdstFamilyPath
- - Destination path (table/region/cf/)hfileLinkName
- - HFileLink name (it contains hfile-region-table)createBackRef
- - Whether back reference should be created. Defaults to true.IOException
- on file or parent directory creation failure.static String createBackReferenceName(String tableNameStr, String regionName)
public static org.apache.hadoop.fs.Path getHFileFromBackReference(org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.Path linkRefPath)
rootDir
- root hbase directorylinkRefPath
- Link Back Reference pathpublic static Pair<TableName,String> parseBackReferenceName(String name)
public static org.apache.hadoop.fs.Path getHFileFromBackReference(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path linkRefPath) throws IOException
conf
- Configuration
to read for the archive directory namelinkRefPath
- Link Back Reference pathIOException
- on unexpected error.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.