@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
|
void |
deleteBulkLoadedFiles(Map<byte[],String> map) |
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 int |
getIndex(TableName tbl,
List<TableName> sTableList) |
static HTableDescriptor |
getSystemTableDescriptor()
Get backup system table descriptor
|
static TableName |
getTableName() |
static String |
getTableNameAsString() |
List<TableName> |
getTablesForBackupType(BackupType type) |
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.
|
Map<byte[],String> |
readBulkLoadedFiles(String backupId) |
Map<byte[],List<Path>>[] |
readBulkLoadedFiles(String backupId,
List<TableName> sTableList) |
HashMap<TableName,HashMap<String,Long>> |
readLogTimestampMap(String backupRoot)
Read the timestamp for each region server log after the last successful backup.
|
Pair<Map<TableName,Map<String,Map<String,List<Pair<String,Boolean>>>>>,List<byte[]>> |
readOrigBulkloadRows(List<TableName> tableList) |
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 |
removeOrigBulkLoadedRows(List<TableName> lst,
List<byte[]> rows) |
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 |
writeBulkLoadedFiles(List<TableName> sTableList,
Map<byte[],List<Path>>[] maps,
String backupId) |
void |
writeOrigBulkLoad(TableName tabName,
byte[] region,
byte[] family,
List<Pair<Path,Path>> pairs) |
void |
writeOrigBulkLoad(TableName tabName,
byte[] region,
Map<byte[],List<Path>> finalPaths) |
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 Map<byte[],String> readBulkLoadedFiles(String backupId) throws IOException
IOExceptionpublic Map<byte[],List<Path>>[] readBulkLoadedFiles(String backupId, List<TableName> sTableList) throws IOException
IOExceptionpublic void deleteBulkLoadedFiles(Map<byte[],String> map) throws IOException
IOExceptionpublic void writeBackupStartCode(Long startCode, String backupRoot) throws IOException
startCode - start codebackupRoot - root directory path to backupIOException - exceptionpublic void writeOrigBulkLoad(TableName tabName, byte[] region, Map<byte[],List<Path>> finalPaths) throws IOException
IOExceptionpublic void writeOrigBulkLoad(TableName tabName, byte[] region, byte[] family, List<Pair<Path,Path>> pairs) throws IOException
IOExceptionpublic void removeOrigBulkLoadedRows(List<TableName> lst, List<byte[]> rows) throws IOException
IOExceptionpublic Pair<Map<TableName,Map<String,Map<String,List<Pair<String,Boolean>>>>>,List<byte[]>> readOrigBulkloadRows(List<TableName> tableList) throws IOException
IOExceptionpublic void writeBulkLoadedFiles(List<TableName> sTableList, Map<byte[],List<Path>>[] maps, String backupId) throws IOException
IOExceptionpublic 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 List<TableName> getTablesForBackupType(BackupType type) throws IOException
IOExceptionpublic 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()