@InterfaceAudience.Private @InterfaceStability.Evolving public final class BackupClientUtil extends Object
Modifier and Type | Field and Description |
---|---|
protected static Log |
LOG |
static String |
LOGNAME_SEPARATOR |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkPathExist(String backupStr,
Configuration conf)
Check whether the backup path exist
|
static void |
checkTargetDir(String backupRootPath,
Configuration conf) |
static void |
cleanupBackupData(BackupInfo context,
Configuration conf) |
static Long |
getCreationTime(Path p)
Given the log file, parse the timestamp from the file name.
|
static List<String> |
getFiles(FileSystem fs,
Path rootDir,
List<String> files,
PathFilter filter) |
static String |
getLogBackupDir(String backupRootDir,
String backupId)
Given the backup root dir and the backup id, return the log file location for an incremental
backup.
|
static <T> Long |
getMinValue(HashMap<T,Long> map)
Get the min value for all the Values a map.
|
static String |
getPath(Path p)
Return the 'path' component of a Path.
|
static String |
getTableBackupDir(String backupRootDir,
String backupId,
TableName tableName)
Given the backup root dir, backup id and the table name, return the backup image location,
which is also where the backup manifest file is.
|
static String |
getUniqueWALFileNamePart(Path p)
Returns WAL file name
|
static String |
getUniqueWALFileNamePart(String walFileName)
Returns WAL file name
|
static FileStatus[] |
listStatus(FileSystem fs,
Path dir,
PathFilter filter)
Calls fs.listStatus() and treats FileNotFoundException as non-fatal
This accommodates differences between hadoop versions, where hadoop 1
does not throw a FileNotFoundException, and return an empty FileStatus[]
while Hadoop 2 will throw FileNotFoundException.
|
static String |
parseHostFromOldLog(Path p)
Parses host name:port from archived WAL path
|
static TableName[] |
parseTableNames(String tables) |
static ArrayList<BackupInfo> |
sortHistoryListDesc(ArrayList<BackupInfo> historyList)
Sort history list by start time in descending order.
|
protected static final Log LOG
public static final String LOGNAME_SEPARATOR
public static boolean checkPathExist(String backupStr, Configuration conf) throws IOException
backupStr
- backupconf
- configurationIOException
- exceptionpublic static void checkTargetDir(String backupRootPath, Configuration conf) throws IOException
IOException
public static <T> Long getMinValue(HashMap<T,Long> map)
map
- mappublic static String parseHostFromOldLog(Path p) throws IOException
p
- pathIOException
- exceptionpublic static Long getCreationTime(Path p) throws IOException
p
- a path to the log fileIOException
- exceptionpublic static List<String> getFiles(FileSystem fs, Path rootDir, List<String> files, PathFilter filter) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public static void cleanupBackupData(BackupInfo context, Configuration conf) throws IOException
IOException
public static String getTableBackupDir(String backupRootDir, String backupId, TableName tableName)
backupRootDir
- backup root directorybackupId
- backup idtable
- table namepublic static ArrayList<BackupInfo> sortHistoryListDesc(ArrayList<BackupInfo> historyList)
historyList
- history listpublic static String getUniqueWALFileNamePart(String walFileName) throws IOException
walFileName
- WAL file nameIOException
- exceptionIllegalArgumentException
- exceptionpublic static String getUniqueWALFileNamePart(Path p) throws IOException
p
- - WAL file pathIOException
- exceptionpublic static FileStatus[] listStatus(FileSystem fs, Path dir, PathFilter filter) throws IOException
fs
- file systemdir
- directoryfilter
- path filterIOException
public static String getPath(Path p)
hdfs://example.org:9000/hbase_trunk/TestTable/compaction.dir
,
this method returns /hbase_trunk/TestTable/compaction.dir
.
This method is useful if you want to print out a Path without qualifying
Filesystem instance.p
- Filesystem Path whose 'path' component we are to return.public static String getLogBackupDir(String backupRootDir, String backupId)
backupRootDir
- backup root directorybackupId
- backup id