Class BackupManager
java.lang.Object
org.apache.hadoop.hbase.backup.impl.BackupManager
- All Implemented Interfaces:
- Closeable,- AutoCloseable
- Direct Known Subclasses:
- IncrementalBackupManager
Handles backup requests, creates backup info records in backup system table to keep track of
 backup sessions, dispatches backup request.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringprotected BackupInfoprotected org.apache.hadoop.conf.Configurationprotected final Connectionprivate static final intprivate static final org.slf4j.Loggerprotected BackupSystemTable
- 
Constructor SummaryConstructorsConstructorDescriptionBackupManager(Connection conn, org.apache.hadoop.conf.Configuration conf) Backup manager constructor.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddIncrementalBackupTableSet(Set<TableName> tables) Adds set of tables to overall incremental backup table setvoidclose()Stop all the work of backup.createBackupInfo(String backupId, BackupType type, List<TableName> tableList, String targetRootDir, int workers, long bandwidth) Creates a backup info based on input backup request.static voiddecorateMasterConfiguration(org.apache.hadoop.conf.Configuration conf) This method modifies the master's configuration in order to inject backup-related features (TESTs only)static voiddecorateRegionServerConfiguration(org.apache.hadoop.conf.Configuration conf) This method modifies the Region Server configuration in order to inject backup-related features TESTs only.voiddeleteBulkLoadedRows(List<byte[]> rows) voidFinishes active backup sessiongetAncestors(BackupInfo backupInfo) Get direct ancestors of the current backup.getAncestors(BackupInfo backupInfo, TableName table) Get the direct ancestors of this backup for one table involved.Get all completed backup information (in desc order by time)getBackupHistory(boolean completed) protected BackupInfoReturns backup info(package private) org.apache.hadoop.conf.ConfigurationgetConf()Get configuration nReturn the current tables covered by incremental backup.private StringCheck if any ongoing backup.voidStart the backup manager service.static booleanisBackupEnabled(org.apache.hadoop.conf.Configuration conf) Read the last backup start code (timestamp) of last successful backup.readBulkloadRows(List<TableName> tableList) Read the timestamp for each region server log after the last successful backup.Get the RS log information after the last log roll from backup system table.voidsetBackupInfo(BackupInfo backupInfo) voidStarts new backup sessionvoidupdateBackupInfo(BackupInfo context) Updates status (state) of a backup session in a persistent storevoidwriteBackupStartCode(Long startCode) Write the start code (timestamp) to backup system table.voidWrite the current timestamps for each regionserver to backup system table after a successful full or incremental backup.
- 
Field Details- 
BACKUP_EXCLUSIVE_OPERATION_TIMEOUT_SECONDS_KEY- See Also:
 
- 
DEFAULT_BACKUP_EXCLUSIVE_OPERATION_TIMEOUT- See Also:
 
- 
LOG
- 
conf
- 
backupInfo
- 
systemTable
- 
conn
 
- 
- 
Constructor Details- 
BackupManagerBackup manager constructor.- Parameters:
- conn- connection
- conf- configuration
- Throws:
- IOException- exception
 
 
- 
- 
Method Details- 
getBackupInfoReturns backup info
- 
decorateMasterConfigurationThis method modifies the master's configuration in order to inject backup-related features (TESTs only)- Parameters:
- conf- configuration
 
- 
decorateRegionServerConfigurationThis method modifies the Region Server configuration in order to inject backup-related features TESTs only.- Parameters:
- conf- configuration
 
- 
isBackupEnabled
- 
getConforg.apache.hadoop.conf.Configuration getConf()Get configuration n
- 
closeStop all the work of backup.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
createBackupInfopublic BackupInfo createBackupInfo(String backupId, BackupType type, List<TableName> tableList, String targetRootDir, int workers, long bandwidth) throws BackupException Creates a backup info based on input backup request.- Parameters:
- backupId- backup id
- type- type
- tableList- table list
- targetRootDir- root dir
- workers- number of parallel workers
- bandwidth- bandwidth per worker in MB per sec n * @throws BackupException exception
- Throws:
- BackupException
 
- 
getOngoingBackupIdCheck if any ongoing backup. Currently, we only reply on checking status in backup system table. We need to consider to handle the case of orphan records in the future. Otherwise, all the coming request will fail.- Returns:
- the ongoing backup id if on going backup exists, otherwise null
- Throws:
- IOException- exception
 
- 
initializeStart the backup manager service.- Throws:
- IOException- exception
 
- 
setBackupInfo
- 
getAncestorsGet direct ancestors of the current backup.- Parameters:
- backupInfo- The backup info for the current backup
- Returns:
- The ancestors for the current backup
- Throws:
- IOException- exception
 
- 
getAncestorspublic ArrayList<BackupManifest.BackupImage> getAncestors(BackupInfo backupInfo, TableName table) throws IOException Get the direct ancestors of this backup for one table involved.- Parameters:
- backupInfo- backup info
- table- table
- Returns:
- backupImages on the dependency list
- Throws:
- IOException- exception
 
- 
updateBackupInfoUpdates status (state) of a backup session in a persistent store- Parameters:
- context- context
- Throws:
- IOException- exception
 
- 
startBackupSessionStarts new backup session- Throws:
- IOException- if active session already exists
 
- 
finishBackupSessionFinishes active backup session- Throws:
- IOException- if no active session
 
- 
readBackupStartCodeRead the last backup start code (timestamp) of last successful backup. Will return null if there is no startcode stored in backup system table or the value is of length 0. These two cases indicate there is no successful backup completed so far.- Returns:
- the timestamp of a last successful backup
- Throws:
- IOException- exception
 
- 
writeBackupStartCodeWrite the start code (timestamp) to backup system table. If passed in null, then write 0 byte.- Parameters:
- startCode- start code
- Throws:
- IOException- exception
 
- 
readRegionServerLastLogRollResultGet the RS log information after the last log roll from backup system table.- Returns:
- RS log info
- Throws:
- IOException- exception
 
- 
readBulkloadRowspublic Pair<Map<TableName,Map<String, readBulkloadRowsMap<String, List<Pair<String, Boolean>>>>>, List<byte[]>> (List<TableName> tableList) throws IOException - Throws:
- IOException
 
- 
deleteBulkLoadedRows- Throws:
- IOException
 
- 
getBackupHistoryGet all completed backup information (in desc order by time)- Returns:
- history info of BackupCompleteData
- Throws:
- IOException- exception
 
- 
getBackupHistory- Throws:
- IOException
 
- 
writeRegionServerLogTimestamppublic void writeRegionServerLogTimestamp(Set<TableName> tables, Map<String, Long> newTimestamps) throws IOExceptionWrite the current timestamps for each regionserver to backup system table after a successful full or incremental backup. Each table may have a different set of log timestamps. The saved timestamp is of the last log file that was backed up already.- Parameters:
- tables- tables
- Throws:
- IOException- exception
 
- 
readLogTimestampMapRead the timestamp for each region server log after the last successful backup. Each table has its own set of the timestamps.- Returns:
- the timestamp for each region server. key: tableName value: RegionServer,PreviousTimeStamp
- Throws:
- IOException- exception
 
- 
getIncrementalBackupTableSetReturn the current tables covered by incremental backup.- Returns:
- set of tableNames
- Throws:
- IOException- exception
 
- 
addIncrementalBackupTableSetAdds set of tables to overall incremental backup table set- Parameters:
- tables- tables
- Throws:
- IOException- exception
 
- 
getConnection
 
-