@InterfaceAudience.Private @InterfaceStability.Evolving public final class BackupSystemTable extends Object implements Closeable
| Constructor and Description |
|---|
BackupSystemTable(Connection conn) |
| Modifier and Type | Method and Description |
|---|---|
void |
addIncrementalBackupTableSet(Set<TableName> tables,
String backupRoot)
Add tables to global incremental backup set
|
void |
addToBackupSet(String name,
String[] newTables)
Add backup set (list of tables)
|
void |
addWALFiles(List<String> files,
String backupId,
String backupRoot)
Register WAL files as eligible for deletion
|
void |
close() |
void |
deleteBackupInfo(String backupId)
Deletes backup status from hbase:backup table
|
void |
deleteBackupSet(String name)
Delete backup set
|
List<TableName> |
describeBackupSet(String name)
Get backup set description (list of tables)
|
ArrayList<BackupInfo> |
getBackupContexts(BackupInfo.BackupState status)
Get all backup session with a given status (in desc order by time)
|
ArrayList<BackupInfo> |
getBackupHistory() |
ArrayList<BackupInfo> |
getBackupHistory(boolean onlyCompleted)
Get all completed backup information (in desc order by time)
|
Set<TableName> |
getIncrementalBackupTableSet(String backupRoot)
Return the current tables covered by incremental backup.
|
static HTableDescriptor |
getSystemTableDescriptor()
Get backup system table descriptor
|
static TableName |
getTableName() |
static String |
getTableNameAsString() |
Iterator<org.apache.hadoop.hbase.backup.impl.BackupSystemTable.WALItem> |
getWALFilesIterator(String backupRoot)
Register WAL files as eligible for deletion
|
boolean |
hasBackupSessions()
Checks if we have at least one backup session in hbase:backup This API is used by
BackupLogCleaner
|
boolean |
isWALFileDeletable(String file)
Check if WAL file is eligible for deletion
Future: to support all backup destinations
|
List<String> |
listBackupSets()
Get backup set list
|
BackupInfo |
readBackupInfo(String backupId)
Reads backup status object (instance of BackupContext) from hbase:backup table
|
String |
readBackupStartCode(String backupRoot)
Read the last backup start code (timestamp) of last successful backup.
|
HashMap<TableName,HashMap<String,Long>> |
readLogTimestampMap(String backupRoot)
Read the timestamp for each region server log after the last successful backup.
|
HashMap<String,Long> |
readRegionServerLastLogRollResult(String backupRoot)
Get the Region Servers log information after the last log roll from hbase:backup.
|
void |
removeFromBackupSet(String name,
String[] toRemove)
Remove tables from backup set (list of tables)
|
void |
updateBackupInfo(BackupInfo context)
Updates status (state) of a backup session in hbase:backup table
|
void |
writeBackupStartCode(Long startCode,
String backupRoot)
Write the start code (timestamp) to hbase:backup.
|
void |
writeRegionServerLastLogRollResult(String server,
Long ts,
String backupRoot)
Writes Region Server last roll log result (timestamp) to hbase:backup table
|
void |
writeRegionServerLogTimestamp(Set<TableName> tables,
HashMap<String,Long> newTimestamps,
String backupRoot)
Write the current timestamps for each regionserver to hbase:backup
after a successful full or incremental backup.
|
public BackupSystemTable(Connection conn) throws IOException
IOExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic void updateBackupInfo(BackupInfo context) throws IOException
context - contextIOException - exceptionpublic void deleteBackupInfo(String backupId) throws IOException
backupId - backup idIOException - exceptionpublic BackupInfo readBackupInfo(String backupId) throws IOException
backupId - - backupIdIOExceptionpublic String readBackupStartCode(String backupRoot) throws IOException
backupRoot - root directory path to backupIOException - exceptionpublic void writeBackupStartCode(Long startCode, String backupRoot) throws IOException
startCode - start codebackupRoot - root directory path to backupIOException - exceptionpublic HashMap<String,Long> readRegionServerLastLogRollResult(String backupRoot) throws IOException
backupRoot - root directory path to backupIOException - exceptionpublic void writeRegionServerLastLogRollResult(String server, Long ts, String backupRoot) throws IOException
server - - Region Server nametimestamp - - last log timestampbackupRoot - root directory path to backupIOException - exceptionpublic ArrayList<BackupInfo> getBackupHistory(boolean onlyCompleted) throws IOException
onlyCompeleted, - true, if only successfully completed sessionsIOException - exceptionpublic ArrayList<BackupInfo> getBackupHistory() throws IOException
IOExceptionpublic ArrayList<BackupInfo> getBackupContexts(BackupInfo.BackupState status) throws IOException
status - statusIOException - exceptionpublic void writeRegionServerLogTimestamp(Set<TableName> tables, HashMap<String,Long> newTimestamps, String backupRoot) throws IOException
tables - tablesnewTimestamps - timestampsbackupRoot - root directory path to backupIOException - exceptionpublic HashMap<TableName,HashMap<String,Long>> readLogTimestampMap(String backupRoot) throws IOException
backupRoot - root directory path to backupIOException - exceptionpublic Set<TableName> getIncrementalBackupTableSet(String backupRoot) throws IOException
backupRoot - root directory path to backupIOException - exceptionpublic void addIncrementalBackupTableSet(Set<TableName> tables, String backupRoot) throws IOException
tables - - set of tablesbackupRoot - root directory path to backupIOException - exceptionpublic void addWALFiles(List<String> files, String backupId, String backupRoot) throws IOException
files - filesbackupId - backup idbackupRoot - root directory path to backupIOException - exceptionpublic Iterator<org.apache.hadoop.hbase.backup.impl.BackupSystemTable.WALItem> getWALFilesIterator(String backupRoot) throws IOException
backupRoot - root directory path to backupIOException - exceptionpublic boolean isWALFileDeletable(String file) throws IOException
file - fileIOException - exceptionpublic boolean hasBackupSessions()
throws IOException
IOException - exceptionpublic List<String> listBackupSets() throws IOException
IOExceptionpublic List<TableName> describeBackupSet(String name) throws IOException
name - - set's nameIOExceptionpublic void addToBackupSet(String name, String[] newTables) throws IOException
name - - set nametables - - list of tables, comma-separatedIOExceptionpublic void removeFromBackupSet(String name, String[] toRemove) throws IOException
name - - set nametables - - list of tables, comma-separatedIOExceptionpublic void deleteBackupSet(String name) throws IOException
name - set's nameIOExceptionpublic static HTableDescriptor getSystemTableDescriptor()
public static String getTableNameAsString()
public static TableName getTableName()