diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/BackupInfo.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/BackupInfo.java index 4a06204..d44ba4e 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/BackupInfo.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/backup/BackupInfo.java @@ -52,7 +52,7 @@ public class BackupInfo implements Comparable { private static final Log LOG = LogFactory.getLog(BackupInfo.class); // backup status flag public static enum BackupState { - WAITING, RUNNING, COMPLETE, FAILED, CANCELLED, ANY; + WAITING, RUNNING, COMPLETE, FAILED, ANY; } // backup phase public static enum BackupPhase { @@ -185,10 +185,6 @@ public class BackupInfo implements Comparable { this.totalBytesCopied = totalBytesCopied; } - public void setCancelled(boolean cancelled) { - this.state = BackupState.CANCELLED;; - } - /** * Set progress (0-100%) * @param msg progress value @@ -205,15 +201,6 @@ public class BackupInfo implements Comparable { return progress; } - - /** - * Has been marked as cancelled or not. - * @return True if marked as cancelled - */ - public boolean isCancelled() { - return this.state == BackupState.CANCELLED; - } - public String getBackupId() { return backupId; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManager.java index 00b39c4..3421ce5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupManager.java @@ -89,8 +89,6 @@ public class BackupManager implements Closeable { this.conn = ConnectionFactory.createConnection(conf); this.systemTable = new BackupSystemTable(conn); - Runtime.getRuntime().addShutdownHook(new ExitHandler()); - } /** @@ -167,35 +165,6 @@ public class BackupManager implements Closeable { return conf.getBoolean(HConstants.BACKUP_ENABLE_KEY, HConstants.BACKUP_ENABLE_DEFAULT); } - // TODO: remove this on the server side - private class ExitHandler extends Thread { - public ExitHandler() { - super("Backup Manager Exit Handler"); - } - - @Override - public void run() { - if (backupInfo != null && !backupComplete) { - - // program exit and backup is not complete, then mark as cancelled to avoid submitted backup - // handler's taking further action - backupInfo.setCancelled(true); - - LOG.debug("Backup is cancelled due to force program exiting."); - try { - cancelBackup(backupInfo.getBackupId()); - } catch (Exception e) { - String msg = e.getMessage(); - if (msg == null || msg.equals("")) { - msg = e.getClass().getName(); - } - LOG.error("Failed to cancel backup " + backupInfo.getBackupId() + " due to " + msg); - } - } - close(); - } - } - /** * Get configuration * @return configuration @@ -205,17 +174,6 @@ public class BackupManager implements Closeable { } /** - * Cancel the ongoing backup via backup id. - * @param backupId The id of the ongoing backup to be cancelled - * @throws Exception exception - */ - private void cancelBackup(String backupId) throws Exception { - // TODO: will be implemented in Phase 2: HBASE-14125 - LOG.debug("Try to cancel the backup " + backupId + ". the feature is NOT implemented yet"); - - } - - /** * Stop all the work of backup. */ @Override diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/FullTableBackupProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/FullTableBackupProcedure.java index f338856..d478ec0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/FullTableBackupProcedure.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/FullTableBackupProcedure.java @@ -241,10 +241,6 @@ public class FullTableBackupProcedure LOG.error(msg + getMessage(e), e); // If this is a cancel exception, then we've already cleaned. - if (backupInfo.getState().equals(BackupState.CANCELLED)) { - return; - } - // set the failure timestamp of the overall backup backupInfo.setEndTs(EnvironmentEdgeManager.currentTime()); @@ -289,11 +285,6 @@ public class FullTableBackupProcedure // set overall backup phase: snapshot_copy backupInfo.setPhase(BackupPhase.SNAPSHOTCOPY); - // avoid action if has been cancelled - if (backupInfo.isCancelled()) { - return; - } - // call ExportSnapshot to copy files based on hbase snapshot for backup // ExportSnapshot only support single snapshot export, need loop for multiple tables case BackupCopyService copyService = BackupRestoreServerFactory.getBackupCopyService(conf); @@ -340,11 +331,6 @@ public class FullTableBackupProcedure // set the overall backup phase : store manifest backupInfo.setPhase(BackupPhase.STORE_MANIFEST); - // avoid action if has been cancelled - if (backupInfo.isCancelled()) { - return; - } - BackupManifest manifest; // Since we have each table's backup in its own directory structure, @@ -684,6 +670,13 @@ public class FullTableBackupProcedure sb.append(getClass().getSimpleName()); sb.append(" (targetRootDir="); sb.append(targetRootDir); + sb.append("; backupId=").append(backupId); + sb.append("; tables="); + int len = tableList.size(); + for (int i = 0; i < len-1; i++) { + sb.append(tableList.get(i)).append(","); + } + sb.append(tableList.get(len-1)); sb.append(")"); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/IncrementalTableBackupProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/IncrementalTableBackupProcedure.java index c9aa5ed..02e8962 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/IncrementalTableBackupProcedure.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/master/IncrementalTableBackupProcedure.java @@ -112,11 +112,6 @@ public class IncrementalTableBackupProcedure // set overall backup phase: incremental_copy backupContext.setPhase(BackupPhase.INCREMENTAL_COPY); - // avoid action if has been cancelled - if (backupContext.isCancelled()) { - return; - } - // get incremental backup file list and prepare parms for DistCp List incrBackupFileList = backupContext.getIncrBackupFileList(); // filter missing files out (they have been copied by previous backups) @@ -265,6 +260,13 @@ public class IncrementalTableBackupProcedure sb.append(getClass().getSimpleName()); sb.append(" (targetRootDir="); sb.append(targetRootDir); + sb.append("; backupId=").append(backupId); + sb.append("; tables="); + int len = tableList.size(); + for (int i = 0; i < len-1; i++) { + sb.append(tableList.get(i)).append(","); + } + sb.append(tableList.get(len-1)); sb.append(")"); }