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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
protected String
protected BackupInfo
protected BackupManager
protected org.apache.hadoop.conf.Configuration
protected Connection
protected org.apache.hadoop.fs.FileSystem
private static final org.slf4j.Logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addManifest
(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 void
beginBackup
(BackupManager backupManager, BackupInfo backupInfo) Begin the overall backup.static void
cleanupAndRestoreBackupSystem
(Connection conn, BackupInfo backupInfo, org.apache.hadoop.conf.Configuration conf) protected static void
cleanupExportSnapshotLog
(org.apache.hadoop.conf.Configuration conf) Clean up directories with prefix "exportSnapshot-", which are generated when exporting snapshots.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.protected void
completeBackup
(Connection conn, BackupInfo backupInfo, BackupType type, org.apache.hadoop.conf.Configuration conf) Complete the overall backup.protected static void
deleteSnapshots
(Connection conn, BackupInfo backupInfo, org.apache.hadoop.conf.Configuration conf) Delete HBase snapshot for backup.abstract void
execute()
Backup request execution.protected void
failBackup
(Connection conn, BackupInfo backupInfo, BackupManager backupManager, Exception e, String msg, BackupType type, org.apache.hadoop.conf.Configuration conf) Fail the overall backup.protected void
protected List<BackupManifest.BackupImage>
getAncestors
(BackupInfo backupInfo) Gets the direct ancestors of the currently being created backup.protected String
protected TableBackupClient.Stage
void
init
(Connection conn, String backupId, BackupRequest request) protected String
obtainBackupMetaDataStr
(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
-