Repository: hbase Updated Branches: refs/heads/HBASE-7912 3834f411b -> 909c4efa8
HBASE-16860 BackupCopyService#Type refactoring (Vladimir Rodionov) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/909c4efa Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/909c4efa Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/909c4efa Branch: refs/heads/HBASE-7912 Commit: 909c4efa8ee6aba1004634d099807bca8af4214d Parents: 3834f41 Author: tedyu <yuzhih...@gmail.com> Authored: Mon Oct 17 11:04:15 2016 -0700 Committer: tedyu <yuzhih...@gmail.com> Committed: Mon Oct 17 11:04:15 2016 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/backup/BackupCopyService.java | 5 +---- .../hadoop/hbase/backup/impl/FullTableBackupClient.java | 2 +- .../hbase/backup/impl/IncrementalTableBackupClient.java | 2 +- .../hbase/backup/mapreduce/MapReduceBackupCopyService.java | 9 ++++----- 4 files changed, 7 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/909c4efa/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupCopyService.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupCopyService.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupCopyService.java index 26e20f1..6c70123 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupCopyService.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/BackupCopyService.java @@ -29,9 +29,6 @@ import org.apache.hadoop.hbase.classification.InterfaceStability; @InterfaceAudience.Private @InterfaceStability.Evolving public interface BackupCopyService extends Configurable { - static enum Type { - FULL, INCREMENTAL - } /** * Copy backup data @@ -44,7 +41,7 @@ public interface BackupCopyService extends Configurable { * @throws IOException */ public int copy(BackupInfo backupContext, BackupManager backupManager, Configuration conf, - BackupCopyService.Type copyType, String[] options) throws IOException; + BackupType copyType, String[] options) throws IOException; /** http://git-wip-us.apache.org/repos/asf/hbase/blob/909c4efa/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/FullTableBackupClient.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/FullTableBackupClient.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/FullTableBackupClient.java index 9355d07..5a8b941 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/FullTableBackupClient.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/FullTableBackupClient.java @@ -285,7 +285,7 @@ public class FullTableBackupClient { args[3] = backupContext.getBackupStatus(table).getTargetDir(); LOG.debug("Copy snapshot " + args[1] + " to " + args[3]); - res = copyService.copy(backupContext, backupManager, conf, BackupCopyService.Type.FULL, args); + res = copyService.copy(backupContext, backupManager, conf, BackupType.FULL, args); // if one snapshot export failed, do not continue for remained snapshots if (res != 0) { LOG.error("Exporting Snapshot " + args[1] + " failed with return code: " + res + "."); http://git-wip-us.apache.org/repos/asf/hbase/blob/909c4efa/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalTableBackupClient.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalTableBackupClient.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalTableBackupClient.java index d9610a2..0a8d14d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalTableBackupClient.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalTableBackupClient.java @@ -121,7 +121,7 @@ public class IncrementalTableBackupClient { // We run DistCp maximum 2 times // If it fails on a second time, we throw Exception int res = - copyService.copy(backupContext, backupManager, conf, BackupCopyService.Type.INCREMENTAL, + copyService.copy(backupContext, backupManager, conf, BackupType.INCREMENTAL, strArr); if (res != 0) { http://git-wip-us.apache.org/repos/asf/hbase/blob/909c4efa/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/mapreduce/MapReduceBackupCopyService.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/mapreduce/MapReduceBackupCopyService.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/mapreduce/MapReduceBackupCopyService.java index 152e695..a058ebc 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/mapreduce/MapReduceBackupCopyService.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/backup/mapreduce/MapReduceBackupCopyService.java @@ -28,12 +28,11 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.fs.LocatedFileStatus; import org.apache.hadoop.fs.Path; -import org.apache.hadoop.fs.RemoteIterator; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.backup.BackupCopyService; import org.apache.hadoop.hbase.backup.BackupInfo; +import org.apache.hadoop.hbase.backup.BackupType; import org.apache.hadoop.hbase.backup.impl.BackupManager; import org.apache.hadoop.hbase.backup.util.BackupServerUtil; import org.apache.hadoop.hbase.classification.InterfaceAudience; @@ -289,11 +288,11 @@ public class MapReduceBackupCopyService implements BackupCopyService { */ @Override public int copy(BackupInfo context, BackupManager backupManager, Configuration conf, - BackupCopyService.Type copyType, String[] options) throws IOException { + BackupType copyType, String[] options) throws IOException { int res = 0; try { - if (copyType == Type.FULL) { + if (copyType == BackupType.FULL) { SnapshotCopy snapshotCp = new SnapshotCopy(context, context.getTableBySnapshot(options[1])); LOG.debug("Doing SNAPSHOT_COPY"); @@ -301,7 +300,7 @@ public class MapReduceBackupCopyService implements BackupCopyService { snapshotCp.setConf(new Configuration(conf)); res = snapshotCp.run(options); - } else if (copyType == Type.INCREMENTAL) { + } else if (copyType == BackupType.INCREMENTAL) { LOG.debug("Doing COPY_TYPE_DISTCP"); setSubTaskPercntgInWholeTask(1f);