@InterfaceAudience.Private public class HFileLink extends FileLink
Searches for hfiles in the following order and locations:
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
LINK_NAME_REGEX
A non-capture group, for HFileLink, so that this can be embedded.
|
BACK_REFERENCES_DIRECTORY_PREFIX| Constructor and Description |
|---|
HFileLink(Path originPath,
Path tempPath,
Path mobPath,
Path archivePath)
Dead simple hfile link constructor
|
| Modifier and Type | Method and Description |
|---|---|
static HFileLink |
build(Configuration conf,
TableName table,
java.lang.String region,
java.lang.String family,
java.lang.String hfile)
Create an HFileLink instance from table/region/family/hfile location
|
static HFileLink |
buildFromHFileLinkPattern(Configuration conf,
Path hFileLinkPattern) |
static HFileLink |
buildFromHFileLinkPattern(Path rootDir,
Path archiveDir,
Path hFileLinkPattern) |
static boolean |
create(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
HRegionInfo hfileRegionInfo,
java.lang.String hfileName)
Create a new HFileLink
|
static boolean |
create(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
HRegionInfo hfileRegionInfo,
java.lang.String hfileName,
boolean createBackRef)
Create a new HFileLink
|
static boolean |
create(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
TableName linkedTable,
java.lang.String linkedRegion,
java.lang.String hfileName)
Create a new HFileLink
|
static boolean |
create(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
TableName linkedTable,
java.lang.String linkedRegion,
java.lang.String hfileName,
boolean createBackRef)
Create a new HFileLink
|
static boolean |
createFromHFileLink(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
java.lang.String hfileLinkName)
Create a new HFileLink starting from a hfileLink name
|
static boolean |
createFromHFileLink(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
java.lang.String hfileLinkName,
boolean createBackRef)
Create a new HFileLink starting from a hfileLink name
|
static java.lang.String |
createHFileLinkName(HRegionInfo hfileRegionInfo,
java.lang.String hfileName)
Create a new HFileLink name
|
static java.lang.String |
createHFileLinkName(TableName tableName,
java.lang.String regionName,
java.lang.String hfileName)
Create a new HFileLink name
|
static Path |
createPath(TableName table,
java.lang.String region,
java.lang.String family,
java.lang.String hfile)
Create an HFileLink relative path for the table/region/family/hfile location
|
Path |
getArchivePath() |
static Path |
getHFileFromBackReference(Configuration conf,
Path linkRefPath)
Get the full path of the HFile referenced by the back reference
|
static Path |
getHFileFromBackReference(Path rootDir,
Path linkRefPath)
Get the full path of the HFile referenced by the back reference
|
Path |
getMobPath() |
Path |
getOriginPath() |
static java.lang.String |
getReferencedHFileName(java.lang.String fileName)
Get the HFile name of the referenced link
|
static java.lang.String |
getReferencedRegionName(java.lang.String fileName)
Get the Region name of the referenced link
|
static TableName |
getReferencedTableName(java.lang.String fileName)
Get the Table name of the referenced link
|
static boolean |
isHFileLink(Path path) |
equals, exists, getAvailablePath, getBackReferenceFileName, getBackReferencesDir, getFileStatus, getLocations, hashCode, isBackReferencesDir, open, open, setLocations, toStringpublic static final java.lang.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.
public HFileLink(Path originPath,
Path tempPath,
Path mobPath,
Path archivePath)
public static final HFileLink buildFromHFileLinkPattern(Configuration conf, Path hFileLinkPattern) throws java.io.IOException
conf - Configuration from which to extract specific archive locationshFileLinkPattern - The path ending with a HFileLink pattern. (table=region-hfile)java.io.IOException - on unexpected error.public static final HFileLink buildFromHFileLinkPattern(Path rootDir, Path archiveDir, 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 Path createPath(TableName table, java.lang.String region, java.lang.String family, java.lang.String hfile)
table - Table nameregion - Region Namefamily - Family Namehfile - HFile Namepublic static HFileLink build(Configuration conf, TableName table, java.lang.String region, java.lang.String family, java.lang.String hfile) throws java.io.IOException
conf - Configuration from which to extract specific archive locationstable - Table nameregion - Region Namefamily - Family Namehfile - HFile Namejava.io.IOException - on unexpected error.public Path getOriginPath()
public Path getArchivePath()
public Path getMobPath()
public static boolean isHFileLink(Path path)
path - Path to check.public static java.lang.String getReferencedHFileName(java.lang.String fileName)
fileName - HFileLink file namepublic static java.lang.String getReferencedRegionName(java.lang.String fileName)
fileName - HFileLink file namepublic static TableName getReferencedTableName(java.lang.String fileName)
fileName - HFileLink file namepublic static java.lang.String createHFileLinkName(HRegionInfo hfileRegionInfo, java.lang.String hfileName)
hfileRegionInfo - - Linked HFile Region InfohfileName - - Linked HFile namepublic static java.lang.String createHFileLinkName(TableName tableName, java.lang.String regionName, java.lang.String hfileName)
tableName - - Linked HFile table nameregionName - - Linked HFile region namehfileName - - Linked HFile namepublic static boolean create(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
HRegionInfo hfileRegionInfo,
java.lang.String hfileName)
throws java.io.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 namejava.io.IOException - on file or parent directory creation failurepublic static boolean create(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
HRegionInfo hfileRegionInfo,
java.lang.String hfileName,
boolean createBackRef)
throws java.io.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.java.io.IOException - on file or parent directory creation failurepublic static boolean create(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
TableName linkedTable,
java.lang.String linkedRegion,
java.lang.String hfileName)
throws java.io.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 namejava.io.IOException - on file or parent directory creation failurepublic static boolean create(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
TableName linkedTable,
java.lang.String linkedRegion,
java.lang.String hfileName,
boolean createBackRef)
throws java.io.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.java.io.IOException - on file or parent directory creation failurepublic static boolean createFromHFileLink(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
java.lang.String hfileLinkName)
throws java.io.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)java.io.IOException - on file or parent directory creation failurepublic static boolean createFromHFileLink(Configuration conf,
FileSystem fs,
Path dstFamilyPath,
java.lang.String hfileLinkName,
boolean createBackRef)
throws java.io.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.java.io.IOException - on file or parent directory creation failurepublic static Path getHFileFromBackReference(Path rootDir,
Path linkRefPath)
rootDir - root hbase directorylinkRefPath - Link Back Reference pathjava.io.IOException - on unexpected error.public static Path getHFileFromBackReference(Configuration conf,
Path linkRefPath)
throws java.io.IOException
conf - Configuration to read for the archive directory namelinkRefPath - Link Back Reference pathjava.io.IOException - on unexpected error.