Class IncrementalTableBackupClient
java.lang.Object
org.apache.hadoop.hbase.backup.impl.TableBackupClient
org.apache.hadoop.hbase.backup.impl.IncrementalTableBackupClient
Incremental backup implementation. See the
execute method.-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.backup.impl.TableBackupClient
TableBackupClient.Stage -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Stringprivate static final org.slf4j.LoggerFields inherited from class org.apache.hadoop.hbase.backup.impl.TableBackupClient
BACKUP_CLIENT_IMPL_CLASS, BACKUP_TEST_MODE_STAGE, backupId, backupInfo, backupManager, conf, conn, fs, newTimestamps, tableList -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedIncrementalTableBackupClient(Connection conn, String backupId, BackupRequest request) -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanareCfsCompatible(ColumnFamilyDescriptor[] currentCfs, ColumnFamilyDescriptor[] backupCfs) protected voidconvertWALsToHFiles(Map<TableName, List<String>> tablesToWALFileList, Map<TableName, Long> tablesToPrevBackupTs) protected voidprivate voiddeleteDirectory(org.apache.hadoop.fs.Path path) protected voidvoidexecute()Backup request execution.filterMissingFiles(List<String> incrBackupFileList) protected org.apache.hadoop.fs.PathCreates a path to a temporary backup directory.protected org.apache.hadoop.fs.PathCreates a path to the bulk load output directory for a table.protected static intprivate org.apache.hadoop.fs.PathgetTargetDirForTable(TableName table) Creates a path to a destination directory for bulk loaded HFiles.protected org.apache.hadoop.fs.PathCreates a path to the backup root directory's temporary subdirectory.protected org.apache.hadoop.fs.PathgetTmpBackupDirForTable(TableName table) Creates a path to a table's directory within the temporary directory.handleBulkLoad(List<TableName> tablesToBackup, Map<TableName, List<String>> tablesToWALFileList, Map<TableName, Long> tablesToPrevBackupTs) Reads bulk load records from backup table, iterates through the records and forms the paths for bulk loaded hfiles.private voidincrementalCopyBulkloadHFiles(org.apache.hadoop.fs.FileSystem tgtFs, TableName tn) protected voidincrementalCopyHFiles(String[] files, String backupDest) protected booleanisActiveWalPath(org.apache.hadoop.fs.Path p) Check if a given path belongs to active WAL directoryprivate voidmergeSplitAndCopyBulkloadedHFiles(List<String> activeFiles, List<String> archiveFiles, TableName tn, org.apache.hadoop.fs.FileSystem tgtFs) private voidmergeSplitAndCopyBulkloadedHFiles(List<String> files, TableName tn, org.apache.hadoop.fs.FileSystem tgtFs) private voidsetBulkOutputPath(org.apache.hadoop.conf.Configuration conf, List<String> tableList) private voidprotected booleantableExists(TableName table, Connection conn) voidupdateFileLists(List<String> activeFiles, List<String> archiveFiles) private voidVerifies that the current table descriptor CFs matches the descriptor CFs of the last full backup for the tables.protected voidwalToHFiles(List<String> dirPaths, List<String> tableList, long previousBackupTs) Methods inherited from class org.apache.hadoop.hbase.backup.impl.TableBackupClient
addManifest, beginBackup, cleanupAndRestoreBackupSystem, cleanupExportSnapshotLog, cleanupTargetDir, completeBackup, deleteSnapshots, failBackup, failStageIf, getAncestors, getMessage, getTestStage, init, obtainBackupMetaDataStr
-
Field Details
-
LOG
-
BULKLOAD_COLLECTOR_OUTPUT
- See Also:
-
-
Constructor Details
-
IncrementalTableBackupClient
protected IncrementalTableBackupClient() -
IncrementalTableBackupClient
public IncrementalTableBackupClient(Connection conn, String backupId, BackupRequest request) throws IOException - Throws:
IOException
-
-
Method Details
-
filterMissingFiles
- Throws:
IOException
-
isActiveWalPath
Check if a given path belongs to active WAL directory- Parameters:
p- path- Returns:
- true, if yes
-
getIndex
-
handleBulkLoad
protected List<BulkLoad> handleBulkLoad(List<TableName> tablesToBackup, Map<TableName, List<String>> tablesToWALFileList, Map<TableName, throws IOExceptionLong> tablesToPrevBackupTs) Reads bulk load records from backup table, iterates through the records and forms the paths for bulk loaded hfiles. Copies the bulk loaded hfiles to the backup destination. This method does NOT clean up the entries in the bulk load system table. Those entries should not be cleaned until the backup is marked as complete.- Parameters:
tablesToBackup- list of tables to be backed up- Throws:
IOException
-
mergeSplitAndCopyBulkloadedHFiles
private void mergeSplitAndCopyBulkloadedHFiles(List<String> activeFiles, List<String> archiveFiles, TableName tn, org.apache.hadoop.fs.FileSystem tgtFs) throws IOException - Throws:
IOException
-
mergeSplitAndCopyBulkloadedHFiles
private void mergeSplitAndCopyBulkloadedHFiles(List<String> files, TableName tn, org.apache.hadoop.fs.FileSystem tgtFs) throws IOException - Throws:
IOException
-
updateFileLists
- Throws:
IOException
-
execute
Description copied from class:TableBackupClientBackup request execution.- Specified by:
executein classTableBackupClient- Throws:
IOException- If the execution of the backup failsColumnFamilyMismatchException- If the column families of the current table do not match the column families for the last full backup. In which case, a full backup should be taken
-
incrementalCopyHFiles
- Throws:
IOException
-
deleteBulkLoadDirectory
- Throws:
IOException
-
deleteTmpBackupDirectory
- Throws:
IOException
-
deleteDirectory
- Throws:
IOException
-
convertWALsToHFiles
protected void convertWALsToHFiles(Map<TableName, List<String>> tablesToWALFileList, Map<TableName, throws IOExceptionLong> tablesToPrevBackupTs) - Throws:
IOException
-
tableExists
- Throws:
IOException
-
walToHFiles
protected void walToHFiles(List<String> dirPaths, List<String> tableList, long previousBackupTs) throws IOException - Throws:
IOException
-
setBulkOutputPath
-
incrementalCopyBulkloadHFiles
private void incrementalCopyBulkloadHFiles(org.apache.hadoop.fs.FileSystem tgtFs, TableName tn) throws IOException - Throws:
IOException
-
getBulkOutputDirForTable
Creates a path to the bulk load output directory for a table. This directory will look like: .../backupRoot/.tmp/backupId/namespace/table/data- Parameters:
table- The table whose HFiles are being bulk loaded- Returns:
- A Path object representing the directory
-
getTmpBackupDirForTable
Creates a path to a table's directory within the temporary directory. This directory will look like: .../backupRoot/.tmp/backupId/namespace/table- Parameters:
table- The table whose HFiles are being bulk loaded- Returns:
- A Path object representing the directory
-
getBulkOutputDir
Creates a path to a temporary backup directory. This directory will look like: .../backupRoot/.tmp/backupId- Returns:
- A Path object representing the directory
-
getTmpBackupDir
Creates a path to the backup root directory's temporary subdirectory. The directory will look like: .../backupRoot/.tmp- Returns:
- A Path object representing the directory
-
getTargetDirForTable
Creates a path to a destination directory for bulk loaded HFiles. This directory will look like: .../backupRoot/backupID/namespace/table- Parameters:
table- The table whose HFiles are being bulk loaded- Returns:
- A Path object representing the directory
-
setupRegionLocator
- Throws:
IOException
-
getFullBackupIds
- Throws:
IOException
-
verifyCfCompatibility
private void verifyCfCompatibility(Set<TableName> tables, Map<TableName, String> tablesToFullBackupId) throws IOException, ColumnFamilyMismatchExceptionVerifies that the current table descriptor CFs matches the descriptor CFs of the last full backup for the tables. This ensures CF compatibility across incremental backups. If a mismatch is detected, a full table backup should be taken, rather than an incremental one -
areCfsCompatible
private static boolean areCfsCompatible(ColumnFamilyDescriptor[] currentCfs, ColumnFamilyDescriptor[] backupCfs)
-