Search in sources :

Example 1 with BackupManifest

use of org.apache.hadoop.hbase.backup.impl.BackupManifest in project hbase by apache.

the class BackupUtils method loadBackupInfo.

public static BackupInfo loadBackupInfo(Path backupRootPath, String backupId, FileSystem fs) throws IOException {
    Path backupPath = new Path(backupRootPath, backupId);
    RemoteIterator<LocatedFileStatus> it = fs.listFiles(backupPath, true);
    while (it.hasNext()) {
        LocatedFileStatus lfs = it.next();
        if (lfs.getPath().getName().equals(BackupManifest.MANIFEST_FILE_NAME)) {
            // Load BackupManifest
            BackupManifest manifest = new BackupManifest(fs, lfs.getPath().getParent());
            BackupInfo info = manifest.toBackupInfo();
            return info;
        }
    }
    return null;
}
Also used : Path(org.apache.hadoop.fs.Path) BackupManifest(org.apache.hadoop.hbase.backup.impl.BackupManifest) BackupInfo(org.apache.hadoop.hbase.backup.BackupInfo) LocatedFileStatus(org.apache.hadoop.fs.LocatedFileStatus)

Example 2 with BackupManifest

use of org.apache.hadoop.hbase.backup.impl.BackupManifest in project hbase by apache.

the class BackupUtils method validate.

public static boolean validate(HashMap<TableName, BackupManifest> backupManifestMap, Configuration conf) throws IOException {
    boolean isValid = true;
    for (Entry<TableName, BackupManifest> manifestEntry : backupManifestMap.entrySet()) {
        TableName table = manifestEntry.getKey();
        TreeSet<BackupImage> imageSet = new TreeSet<>();
        ArrayList<BackupImage> depList = manifestEntry.getValue().getDependentListByTable(table);
        if (depList != null && !depList.isEmpty()) {
            imageSet.addAll(depList);
        }
        LOG.info("Dependent image(s) from old to new:");
        for (BackupImage image : imageSet) {
            String imageDir = HBackupFileSystem.getTableBackupDir(image.getRootDir(), image.getBackupId(), table);
            if (!BackupUtils.checkPathExist(imageDir, conf)) {
                LOG.error("ERROR: backup image does not exist: " + imageDir);
                isValid = false;
                break;
            }
            LOG.info("Backup image: " + image.getBackupId() + " for '" + table + "' is available");
        }
    }
    return isValid;
}
Also used : BackupManifest(org.apache.hadoop.hbase.backup.impl.BackupManifest) TableName(org.apache.hadoop.hbase.TableName) TreeSet(java.util.TreeSet) BackupImage(org.apache.hadoop.hbase.backup.impl.BackupManifest.BackupImage)

Example 3 with BackupManifest

use of org.apache.hadoop.hbase.backup.impl.BackupManifest in project hbase by apache.

the class HBackupFileSystem method checkImageManifestExist.

/**
 * Check whether the backup image path and there is manifest file in the path.
 * @param backupManifestMap If all the manifests are found, then they are put into this map
 * @param tableArray the tables involved
 * @throws IOException exception
 */
public static void checkImageManifestExist(HashMap<TableName, BackupManifest> backupManifestMap, TableName[] tableArray, Configuration conf, Path backupRootPath, String backupId) throws IOException {
    for (TableName tableName : tableArray) {
        BackupManifest manifest = getManifest(conf, backupRootPath, backupId);
        backupManifestMap.put(tableName, manifest);
    }
}
Also used : BackupManifest(org.apache.hadoop.hbase.backup.impl.BackupManifest) TableName(org.apache.hadoop.hbase.TableName)

Example 4 with BackupManifest

use of org.apache.hadoop.hbase.backup.impl.BackupManifest in project hbase by apache.

the class MapReduceBackupMergeJob method updateBackupManifest.

protected void updateBackupManifest(String backupRoot, String mergedBackupId, List<String> backupsToDelete) throws IllegalArgumentException, IOException {
    BackupManifest manifest = HBackupFileSystem.getManifest(conf, new Path(backupRoot), mergedBackupId);
    manifest.getBackupImage().removeAncestors(backupsToDelete);
    // save back
    manifest.store(conf);
}
Also used : BackupManifest(org.apache.hadoop.hbase.backup.impl.BackupManifest) Path(org.apache.hadoop.fs.Path)

Aggregations

BackupManifest (org.apache.hadoop.hbase.backup.impl.BackupManifest)4 Path (org.apache.hadoop.fs.Path)2 TableName (org.apache.hadoop.hbase.TableName)2 TreeSet (java.util.TreeSet)1 LocatedFileStatus (org.apache.hadoop.fs.LocatedFileStatus)1 BackupInfo (org.apache.hadoop.hbase.backup.BackupInfo)1 BackupImage (org.apache.hadoop.hbase.backup.impl.BackupManifest.BackupImage)1