protected void incrementalCopyHFiles(String[] files, String backupDest) throws IOException { try { LOG.debug("Incremental copy HFiles is starting. dest=" + backupDest); // set overall backup phase: incremental_copy backupInfo.setPhase(BackupPhase.INCREMENTAL_COPY); // get incremental backup file list and prepare parms for DistCp String[] strArr = new String[files.length + 1]; System.arraycopy(files, 0, strArr, 0, files.length); strArr[strArr.length - 1] = backupDest; String jobname = "Incremental_Backup-HFileCopy-" + backupInfo.getBackupId(); if (LOG.isDebugEnabled()) { LOG.debug("Setting incremental copy HFiles job name to : " + jobname); } conf.set(JOB_NAME_CONF_KEY, jobname); BackupCopyJob copyService = BackupRestoreFactory.getBackupCopyJob(conf); int res = copyService.copy(backupInfo, backupManager, conf, BackupType.INCREMENTAL, strArr); if (res != 0) { LOG.error("Copy incremental HFile files failed with return code: " + res + "."); throw new IOException("Failed copy from " + StringUtils.join(files, ',') + " to " + backupDest); } LOG.debug("Incremental copy HFiles from " + StringUtils.join(files, ',') + " to " + backupDest + " finished."); } finally { deleteBulkLoadDirectory(); } }
backupInfo.setPhase(BackupPhase.SNAPSHOTCOPY);
/** * Begin the overall backup. * @param backupInfo backup info * @throws IOException exception */ protected void beginBackup(BackupManager backupManager, BackupInfo backupInfo) throws IOException { BackupSystemTable.snapshot(conn); backupManager.setBackupInfo(backupInfo); // set the start timestamp of the overall backup long startTs = EnvironmentEdgeManager.currentTime(); backupInfo.setStartTs(startTs); // set overall backup status: ongoing backupInfo.setState(BackupState.RUNNING); backupInfo.setPhase(BackupPhase.REQUEST); LOG.info("Backup " + backupInfo.getBackupId() + " started at " + startTs + "."); backupManager.updateBackupInfo(backupInfo); if (LOG.isDebugEnabled()) { LOG.debug("Backup session " + backupInfo.getBackupId() + " has been started."); } }
Configuration conf) throws IOException { backupInfo.setPhase(BackupPhase.STORE_MANIFEST);
backupInfo.setPhase(BackupPhase.SNAPSHOT); for (TableName tableName : tableList) { String snapshotName =
backupInfo.setPhase(BackupPhase.PREPARE_INCREMENTAL); LOG.debug("For incremental backup, current table set is " + backupManager.getIncrementalBackupTableSet());
backupInfo.setPhase(BackupPhase.SNAPSHOT); for (TableName tableName : tableList) { String snapshotName =
backupInfo.setPhase(BackupPhase.PREPARE_INCREMENTAL); LOG.debug("For incremental backup, current table set is " + backupManager.getIncrementalBackupTableSet());
public static BackupInfo fromProto(BackupProtos.BackupInfo proto) { BackupInfo context = new BackupInfo(); context.setBackupId(proto.getBackupId()); context.setBackupTableInfoMap(toMap(proto.getBackupTableInfoList())); context.setCompleteTs(proto.getCompleteTs()); if (proto.hasFailedMessage()) { context.setFailedMsg(proto.getFailedMessage()); } if (proto.hasBackupState()) { context.setState(BackupInfo.BackupState.valueOf(proto.getBackupState().name())); } context.setHLogTargetDir(BackupUtils.getLogBackupDir(proto.getBackupRootDir(), proto.getBackupId())); if (proto.hasBackupPhase()) { context.setPhase(BackupPhase.valueOf(proto.getBackupPhase().name())); } if (proto.hasProgress()) { context.setProgress(proto.getProgress()); } context.setStartTs(proto.getStartTs()); context.setBackupRootDir(proto.getBackupRootDir()); context.setType(BackupType.valueOf(proto.getBackupType().name())); context.setWorkers(proto.getWorkersNumber()); context.setBandwidth(proto.getBandwidth()); return context; }