@InterfaceAudience.Private public class BackupManager extends Object implements Closeable
Modifier and Type | Field and Description |
---|---|
static String |
BACKUP_EXCLUSIVE_OPERATION_TIMEOUT_SECONDS_KEY |
protected BackupInfo |
backupInfo |
protected org.apache.hadoop.conf.Configuration |
conf |
protected Connection |
conn |
private static int |
DEFAULT_BACKUP_EXCLUSIVE_OPERATION_TIMEOUT |
private static org.slf4j.Logger |
LOG |
protected BackupSystemTable |
systemTable |
Constructor and Description |
---|
BackupManager(Connection conn,
org.apache.hadoop.conf.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)
Creates a backup info based on input backup request.
|
static void |
decorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf)
This method modifies the master's configuration in order to inject backup-related features
(TESTs only)
|
static void |
decorateRegionServerConfiguration(org.apache.hadoop.conf.Configuration conf)
This method modifies the Region Server configuration in order to inject backup-related features
TESTs only.
|
void |
deleteBulkLoadedRows(List<byte[]> rows) |
void |
finishBackupSession()
Finishes active backup session
|
ArrayList<BackupManifest.BackupImage> |
getAncestors(BackupInfo backupInfo)
Get direct ancestors of the current backup.
|
ArrayList<BackupManifest.BackupImage> |
getAncestors(BackupInfo backupInfo,
TableName table)
Get the direct ancestors of this backup for one table involved.
|
List<BackupInfo> |
getBackupHistory()
Get all completed backup information (in desc order by time)
|
ArrayList<BackupInfo> |
getBackupHistory(boolean completed) |
protected BackupInfo |
getBackupInfo()
Returns backup info
|
(package private) org.apache.hadoop.conf.Configuration |
getConf()
Get configuration
|
Connection |
getConnection() |
Set<TableName> |
getIncrementalBackupTableSet()
Return the current tables covered by incremental backup.
|
private String |
getOngoingBackupId()
Check if any ongoing backup.
|
void |
initialize()
Start the backup manager service.
|
static boolean |
isBackupEnabled(org.apache.hadoop.conf.Configuration conf) |
String |
readBackupStartCode()
Read the last backup start code (timestamp) of last successful backup.
|
Pair<Map<TableName,Map<String,Map<String,List<Pair<String,Boolean>>>>>,List<byte[]>> |
readBulkloadRows(List<TableName> tableList) |
Map<TableName,Map<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 backup system table.
|
void |
setBackupInfo(BackupInfo backupInfo) |
void |
startBackupSession()
Starts new backup session
|
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 backup system table.
|
void |
writeRegionServerLogTimestamp(Set<TableName> tables,
Map<String,Long> newTimestamps)
Write the current timestamps for each regionserver to backup system table after a successful
full or incremental backup.
|
public static final String BACKUP_EXCLUSIVE_OPERATION_TIMEOUT_SECONDS_KEY
private static final int DEFAULT_BACKUP_EXCLUSIVE_OPERATION_TIMEOUT
private static final org.slf4j.Logger LOG
protected org.apache.hadoop.conf.Configuration conf
protected BackupInfo backupInfo
protected BackupSystemTable systemTable
protected final Connection conn
public BackupManager(Connection conn, org.apache.hadoop.conf.Configuration conf) throws IOException
conn
- connectionconf
- configurationIOException
- exceptionprotected BackupInfo getBackupInfo()
public static void decorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf)
conf
- configurationpublic static void decorateRegionServerConfiguration(org.apache.hadoop.conf.Configuration conf)
conf
- configurationpublic static boolean isBackupEnabled(org.apache.hadoop.conf.Configuration conf)
org.apache.hadoop.conf.Configuration getConf()
public 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 dirworkers
- number of parallel workersbandwidth
- bandwidth per worker in MB per secBackupException
- exceptionprivate String getOngoingBackupId() throws IOException
IOException
- exceptionpublic void initialize() throws IOException
IOException
- exceptionpublic void setBackupInfo(BackupInfo backupInfo)
public ArrayList<BackupManifest.BackupImage> getAncestors(BackupInfo backupInfo) throws IOException
backupInfo
- The backup info for the current backupIOException
- exceptionpublic ArrayList<BackupManifest.BackupImage> getAncestors(BackupInfo backupInfo, TableName table) throws IOException
backupInfo
- backup infotable
- tableIOException
- exceptionpublic void updateBackupInfo(BackupInfo context) throws IOException
context
- contextIOException
- exceptionpublic void startBackupSession() throws IOException
IOException
- if active session already existspublic void finishBackupSession() throws IOException
IOException
- if no active sessionpublic String readBackupStartCode() throws IOException
IOException
- exceptionpublic void writeBackupStartCode(Long startCode) throws IOException
startCode
- start codeIOException
- exceptionpublic HashMap<String,Long> readRegionServerLastLogRollResult() throws IOException
IOException
- exceptionpublic Pair<Map<TableName,Map<String,Map<String,List<Pair<String,Boolean>>>>>,List<byte[]>> readBulkloadRows(List<TableName> tableList) throws IOException
IOException
public void deleteBulkLoadedRows(List<byte[]> rows) throws IOException
IOException
public List<BackupInfo> getBackupHistory() throws IOException
IOException
- exceptionpublic ArrayList<BackupInfo> getBackupHistory(boolean completed) throws IOException
IOException
public void writeRegionServerLogTimestamp(Set<TableName> tables, Map<String,Long> newTimestamps) throws IOException
tables
- tablesIOException
- exceptionpublic Map<TableName,Map<String,Long>> readLogTimestampMap() throws IOException
IOException
- exceptionpublic Set<TableName> getIncrementalBackupTableSet() throws IOException
IOException
- exceptionpublic void addIncrementalBackupTableSet(Set<TableName> tables) throws IOException
tables
- tablesIOException
- exceptionpublic Connection getConnection()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.