Class TableBackupClient
java.lang.Object
org.apache.hadoop.hbase.backup.impl.TableBackupClient
- Direct Known Subclasses:
FullTableBackupClient,IncrementalTableBackupClient
Base class for backup operation. Concrete implementation for full and incremental backup are
delegated to corresponding sub-classes:
FullTableBackupClient and
IncrementalTableBackupClient-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprotected Stringprotected BackupInfoprotected BackupManagerprotected org.apache.hadoop.conf.Configurationprotected Connectionprotected org.apache.hadoop.fs.FileSystemprivate static final org.slf4j.Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddManifest(BackupInfo backupInfo, BackupType type, org.apache.hadoop.conf.Configuration conf) Creates a manifest based on the provided info, and store it in the backup-specific directory.protected voidbeginBackup(BackupManager backupManager, BackupInfo backupInfo) Begin the overall backup.static voidcleanupAndRestoreBackupSystem(Connection conn, BackupInfo backupInfo, org.apache.hadoop.conf.Configuration conf) protected static voidcleanupExportSnapshotLog(org.apache.hadoop.conf.Configuration conf) Clean up directories with prefix "exportSnapshot-", which are generated when exporting snapshots.protected static voidcleanupTargetDir(BackupInfo backupInfo, org.apache.hadoop.conf.Configuration conf) Clean up the uncompleted data at target directory if the ongoing backup has already entered the copy phase.protected voidcompleteBackup(Connection conn, BackupInfo backupInfo, BackupType type, org.apache.hadoop.conf.Configuration conf) Complete the overall backup.protected static voiddeleteSnapshots(Connection conn, BackupInfo backupInfo, org.apache.hadoop.conf.Configuration conf) Delete HBase snapshot for backup.abstract voidexecute()Backup request execution.protected voidfailBackup(Connection conn, BackupInfo backupInfo, BackupManager backupManager, Exception e, String msg, BackupType type, org.apache.hadoop.conf.Configuration conf) Fail the overall backup.protected voidprotected List<BackupManifest.BackupImage>getAncestors(BackupInfo backupInfo) Gets the direct ancestors of the currently being created backup.protected Stringprotected TableBackupClient.Stagevoidinit(Connection conn, String backupId, BackupRequest request) protected StringobtainBackupMetaDataStr(BackupInfo backupInfo) Get backup request meta data dir as string.
-
Field Details
-
BACKUP_CLIENT_IMPL_CLASS
- See Also:
-
BACKUP_TEST_MODE_STAGE
- See Also:
-
LOG
-
conf
-
conn
-
backupId
-
tableList
-
newTimestamps
-
backupManager
-
backupInfo
-
fs
-
-
Constructor Details
-
TableBackupClient
public TableBackupClient() -
TableBackupClient
public TableBackupClient(Connection conn, String backupId, BackupRequest request) throws IOException - Throws:
IOException
-
-
Method Details
-
init
- Throws:
IOException
-
beginBackup
Begin the overall backup.- Parameters:
backupInfo- backup info- Throws:
IOException- exception
-
getMessage
-
deleteSnapshots
protected static void deleteSnapshots(Connection conn, BackupInfo backupInfo, org.apache.hadoop.conf.Configuration conf) throws IOException Delete HBase snapshot for backup.- Parameters:
backupInfo- backup info- Throws:
IOException- exception
-
cleanupExportSnapshotLog
protected static void cleanupExportSnapshotLog(org.apache.hadoop.conf.Configuration conf) throws IOException Clean up directories with prefix "exportSnapshot-", which are generated when exporting snapshots.- Throws:
IOException- exception
-
cleanupTargetDir
protected static void cleanupTargetDir(BackupInfo backupInfo, org.apache.hadoop.conf.Configuration conf) Clean up the uncompleted data at target directory if the ongoing backup has already entered the copy phase. -
failBackup
protected void failBackup(Connection conn, BackupInfo backupInfo, BackupManager backupManager, Exception e, String msg, BackupType type, org.apache.hadoop.conf.Configuration conf) throws IOException Fail the overall backup.- Parameters:
backupInfo- backup infoe- exception- Throws:
IOException- exception
-
cleanupAndRestoreBackupSystem
public static void cleanupAndRestoreBackupSystem(Connection conn, BackupInfo backupInfo, org.apache.hadoop.conf.Configuration conf) throws IOException - Throws:
IOException
-
addManifest
protected void addManifest(BackupInfo backupInfo, BackupType type, org.apache.hadoop.conf.Configuration conf) throws IOException Creates a manifest based on the provided info, and store it in the backup-specific directory.- Parameters:
backupInfo- The current backup info- Throws:
IOException- exception
-
getAncestors
Gets the direct ancestors of the currently being created backup.- Parameters:
backupInfo- The backup info for the backup being created- Throws:
IOException
-
obtainBackupMetaDataStr
Get backup request meta data dir as string.- Parameters:
backupInfo- backup info- Returns:
- meta data dir
-
completeBackup
protected void completeBackup(Connection conn, BackupInfo backupInfo, BackupType type, org.apache.hadoop.conf.Configuration conf) throws IOException Complete the overall backup.- Parameters:
backupInfo- backup info- Throws:
IOException- exception
-
execute
Backup request execution.- Throws:
IOException- if the execution of the backup fails
-
getTestStage
-
failStageIf
- Throws:
IOException
-