Class HBackupFileSystem

java.lang.Object
org.apache.hadoop.hbase.backup.HBackupFileSystem

@Private public final class HBackupFileSystem extends Object
View to an on-disk Backup Image FileSytem Provides the set of methods necessary to interact with the on-disk Backup Image data.
  • Field Details

  • Constructor Details

  • Method Details

    • getTableBackupDir

      public static String getTableBackupDir(String backupRootDir, String backupId, TableName tableName)
      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 directory
      backupId - backup id
      tableName - table name
      Returns:
      backupPath String for the particular table
    • getBackupTmpDirPath

      public static org.apache.hadoop.fs.Path getBackupTmpDirPath(String backupRootDir)
      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 root
      backupId - backup id
      Returns:
      backup tmp directory path
    • getBackupPath

      public static org.apache.hadoop.fs.Path getBackupPath(String backupRootDir, String backupId)
    • 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 - configuration
      backupRootDir - backup root directory
      backupId - 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 - configuration
      backupRootDir - backup root directory
      backupId - 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 - configuration
      backupRootDir - backup root directory
      backupId - 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 path
      tableName - table name
      backupId - 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

      private static long getTimestamp(String backupId)