@InterfaceAudience.Private @InterfaceStability.Evolving public class BackupManager extends Object implements Closeable
Constructor and Description |
---|
BackupManager(Configuration conf)
Backup manager constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addIncrementalBackupTableSet(Set<TableName> tables)
Adds set of tables to overall incremental backup table set
|
void |
close()
Stop all the work of backup.
|
BackupInfo |
createBackupInfo(String backupId,
BackupType type,
List<TableName> tableList,
String targetRootDir,
int workers,
long bandwidth)
Create a BackupContext based on input backup request.
|
static void |
decorateMasterConfiguration(Configuration conf)
This method modifies the master's configuration in order to inject backup-related features
|
static void |
decorateRSConfiguration(Configuration conf)
This method modifies the RS configuration in order to inject backup-related features
|
ArrayList<BackupManifest.BackupImage> |
getAncestors(BackupInfo backupCtx)
Get direct ancestors of the current backup.
|
ArrayList<BackupManifest.BackupImage> |
getAncestors(BackupInfo backupContext,
TableName table)
Get the direct ancestors of this backup for one table involved.
|
protected BackupInfo |
getBackupContext()
Return backup context
|
ArrayList<BackupInfo> |
getBackupHistory()
Get all completed backup information (in desc order by time)
|
ArrayList<BackupInfo> |
getBackupHistory(boolean completed) |
Connection |
getConnection() |
Set<TableName> |
getIncrementalBackupTableSet()
Return the current tables covered by incremental backup.
|
Iterator<org.apache.hadoop.hbase.backup.impl.BackupSystemTable.WALItem> |
getWALFilesFromBackupSystem()
Get WAL files iterator
|
void |
initialize()
Start the backup manager service.
|
String |
readBackupStartCode()
Read the last backup start code (timestamp) of last successful backup.
|
HashMap<TableName,HashMap<String,Long>> |
readLogTimestampMap()
Read the timestamp for each region server log after the last successful backup.
|
HashMap<String,Long> |
readRegionServerLastLogRollResult()
Get the RS log information after the last log roll from hbase:backup.
|
void |
recordWALFiles(List<String> files)
Saves list of WAL files after incremental backup operation.
|
void |
setBackupInfo(BackupInfo backupInfo) |
void |
updateBackupInfo(BackupInfo context)
Updates status (state) of a backup session in a persistent store
|
void |
writeBackupStartCode(Long startCode)
Write the start code (timestamp) to hbase:backup.
|
void |
writeRegionServerLogTimestamp(Set<TableName> tables,
HashMap<String,Long> newTimestamps)
Write the current timestamps for each regionserver to hbase:backup after a successful full or
incremental backup.
|
public BackupManager(Configuration conf) throws IOException
conf
- configurationIOException
- exceptionprotected BackupInfo getBackupContext()
public static void decorateMasterConfiguration(Configuration conf)
conf
- configurationpublic static void decorateRSConfiguration(Configuration conf)
conf
- configurationpublic void close()
close
in interface Closeable
close
in interface AutoCloseable
public BackupInfo createBackupInfo(String backupId, BackupType type, List<TableName> tableList, String targetRootDir, int workers, long bandwidth) throws BackupException
backupId
- backup idtype
- typetablelist
- table listtargetRootDir
- root dirsnapshot
- snapshot nameBackupException
- exceptionpublic void initialize() throws IOException
IOException
- exceptionpublic void setBackupInfo(BackupInfo backupInfo)
public ArrayList<BackupManifest.BackupImage> getAncestors(BackupInfo backupCtx) throws IOException, BackupException
backupCtx
- The backup context for the current backupIOException
- exceptionBackupException
- exceptionpublic ArrayList<BackupManifest.BackupImage> getAncestors(BackupInfo backupContext, TableName table) throws BackupException, IOException
backupContext
- backup contexttable
- tableBackupException
- exceptionIOException
- exceptionpublic void updateBackupInfo(BackupInfo context) throws IOException
context
- contextIOException
- exceptionpublic String readBackupStartCode() throws IOException
IOException
- exceptionpublic void writeBackupStartCode(Long startCode) throws IOException
startCode
- start codeIOException
- exceptionpublic HashMap<String,Long> readRegionServerLastLogRollResult() throws IOException
IOException
- exceptionpublic ArrayList<BackupInfo> getBackupHistory() throws IOException
IOException
- exceptionpublic ArrayList<BackupInfo> getBackupHistory(boolean completed) throws IOException
IOException
public void writeRegionServerLogTimestamp(Set<TableName> tables, HashMap<String,Long> newTimestamps) throws IOException
tables
- tablesIOException
- exceptionpublic HashMap<TableName,HashMap<String,Long>> readLogTimestampMap() throws IOException
IOException
- exceptionpublic Set<TableName> getIncrementalBackupTableSet() throws IOException
IOException
- exceptionpublic void addIncrementalBackupTableSet(Set<TableName> tables) throws IOException
tables
- tablesIOException
- exceptionpublic void recordWALFiles(List<String> files) throws IOException
IOException
public Iterator<org.apache.hadoop.hbase.backup.impl.BackupSystemTable.WALItem> getWALFilesFromBackupSystem() throws IOException
IOException
public Connection getConnection()