Package org.apache.hadoop.hbase.backup
Class HBackupFileSystem
java.lang.Object
org.apache.hadoop.hbase.backup.HBackupFileSystem
View to an on-disk Backup Image FileSytem Provides the set of methods necessary to interact with
the on-disk Backup Image data.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voiddeleteBackupCompleteMarker(org.apache.hadoop.conf.Configuration conf, String backupRootDir, String backupId) Delete the completion marker file for the given backup, if it exists.static List<BackupManifest.BackupImage>getAllBackupImages(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath) static org.apache.hadoop.fs.PathgetBackupPath(String backupRootDir, String backupId) static org.apache.hadoop.fs.PathgetBackupTmpDirPath(String backupRootDir) Get backup temporary directorystatic org.apache.hadoop.fs.PathgetBackupTmpDirPathForBackupId(String backupRoot, String backupId) Get backup tmp directory for backupIdstatic BackupManifestgetManifest(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath, String backupId) private static org.apache.hadoop.fs.PathgetManifestPath(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath, String backupId) (package private) static org.apache.hadoop.fs.PathgetManifestPath(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath, String backupId, boolean throwIfNotFound) static org.apache.hadoop.fs.PathgetRootDirFromBackupPath(org.apache.hadoop.fs.Path backupPath, String backupId) static StringgetTableBackupDir(String backupRootDir, String backupId, TableName tableName) Given the backup root dir, backup id and the table name, return the backup image location.static org.apache.hadoop.fs.PathgetTableBackupPath(TableName tableName, org.apache.hadoop.fs.Path backupRootPath, String backupId) Given the backup root dir, backup id and the table name, return the backup image location, which is also where the backup manifest file is.private static longgetTimestamp(String backupId) static booleanisBackupComplete(org.apache.hadoop.conf.Configuration conf, String backupRootDir, String backupId) Check whether a backup completion marker file exists for the given backup.static voidwriteBackupCompleteMarker(org.apache.hadoop.conf.Configuration conf, String backupRootDir, String backupId) Write a completion marker file to signal a backup has completed successfully.
-
Field Details
-
LOG
-
BACKUP_COMPLETE_FILE_NAME
- See Also:
-
-
Constructor Details
-
HBackupFileSystem
private HBackupFileSystem()This is utility class.
-
-
Method Details
-
getTableBackupDir
Given the backup root dir, backup id and the table name, return the backup image location. Return value look like: "hdfs://backup.hbase.org:9000/user/biadmin/backup/backup_1396650096738/default/t1_dn/", where "hdfs://backup.hbase.org:9000/user/biadmin/backup" is a backup root directory- Parameters:
backupRootDir- backup root directorybackupId- backup idtableName- table name- Returns:
- backupPath String for the particular table
-
getBackupTmpDirPath
Get backup temporary directory- Parameters:
backupRootDir- backup root- Returns:
- backup tmp directory path
-
getBackupTmpDirPathForBackupId
public static org.apache.hadoop.fs.Path getBackupTmpDirPathForBackupId(String backupRoot, String backupId) Get backup tmp directory for backupId- Parameters:
backupRoot- backup rootbackupId- backup id- Returns:
- backup tmp directory path
-
getBackupPath
-
writeBackupCompleteMarker
public static void writeBackupCompleteMarker(org.apache.hadoop.conf.Configuration conf, String backupRootDir, String backupId) Write a completion marker file to signal a backup has completed successfully. This is a best-effort operation: if the write fails, the backup itself is still considered complete (the system table is the source of truth). The marker file is intended for external consumers (e.g., another cluster) that cannot access the originating cluster's BackupSystemTable. A backup can still be complete even if the completion marker file is missing, but there is no way to verify this without using the originating cluster's BackupSystemTable.The marker is always written last and deleted first: any operation that removes or modifies data in a backup directory (failed-backup cleanup, backup delete, merge, removing a table from a backup image when a dependent backup is deleted) deletes the marker before touching the data. A backup whose image was modified this way may therefore remain COMPLETE in the system table without a marker.
- Parameters:
conf- configurationbackupRootDir- backup root directorybackupId- backup id
-
deleteBackupCompleteMarker
public static void deleteBackupCompleteMarker(org.apache.hadoop.conf.Configuration conf, String backupRootDir, String backupId) throws IOException Delete the completion marker file for the given backup, if it exists. Callers must invoke this before removing or modifying any data in the backup directory, so that the marker is never present on a backup whose data is incomplete.- Parameters:
conf- configurationbackupRootDir- backup root directorybackupId- backup id- Throws:
IOException- if the file system cannot be accessed or the marker could not be deleted
-
isBackupComplete
public static boolean isBackupComplete(org.apache.hadoop.conf.Configuration conf, String backupRootDir, String backupId) throws IOException Check whether a backup completion marker file exists for the given backup.- Parameters:
conf- configurationbackupRootDir- backup root directorybackupId- backup id- Returns:
- true if the marker file exists
- Throws:
IOException- if the file system cannot be accessed
-
getTableBackupPath
public static org.apache.hadoop.fs.Path getTableBackupPath(TableName tableName, org.apache.hadoop.fs.Path backupRootPath, String backupId) Given the backup root dir, backup id and the table name, return the backup image location, which is also where the backup manifest file is. return value look like: "hdfs://backup.hbase.org:9000/user/biadmin/backup/backup_1396650096738/default/t1_dn/", where "hdfs://backup.hbase.org:9000/user/biadmin/backup" is a backup root directory- Parameters:
backupRootPath- backup root pathtableName- table namebackupId- backup Id- Returns:
- backupPath for the particular table
-
getManifestPath
private static org.apache.hadoop.fs.Path getManifestPath(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath, String backupId) throws IOException - Throws:
IOException
-
getManifestPath
static org.apache.hadoop.fs.Path getManifestPath(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath, String backupId, boolean throwIfNotFound) throws IOException - Throws:
IOException
-
getRootDirFromBackupPath
public static org.apache.hadoop.fs.Path getRootDirFromBackupPath(org.apache.hadoop.fs.Path backupPath, String backupId) -
getManifest
public static BackupManifest getManifest(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath, String backupId) throws IOException - Throws:
IOException
-
getAllBackupImages
public static List<BackupManifest.BackupImage> getAllBackupImages(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path backupRootPath) throws IOException - Throws:
IOException
-
getTimestamp
-