Repository: hbase Updated Branches: refs/heads/0.98 61eab4e10 -> e2ae542a0
HBASE-11335 Fix the TABLE_DIR param in TableSnapshotInputFormat (deepankar) Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/e2ae542a Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/e2ae542a Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/e2ae542a Branch: refs/heads/0.98 Commit: e2ae542a05adad3bd23d4cfae4d878a2a2374052 Parents: 61eab4e Author: Enis Soztutar <e...@apache.org> Authored: Mon Jun 30 13:48:31 2014 -0700 Committer: Enis Soztutar <e...@apache.org> Committed: Mon Jun 30 14:36:02 2014 -0700 ---------------------------------------------------------------------- .../hbase/mapreduce/TableSnapshotInputFormatImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/e2ae542a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java index 62fde27..758c609 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableSnapshotInputFormatImpl.java @@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils; import org.apache.hadoop.hbase.snapshot.SnapshotReferenceUtil; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.FSTableDescriptors; +import org.apache.hadoop.hbase.util.FSUtils; import org.apache.hadoop.io.Writable; import org.apache.hadoop.mapreduce.Job; @@ -65,7 +66,8 @@ public class TableSnapshotInputFormatImpl { // easy way to delegate access. private static final String SNAPSHOT_NAME_KEY = "hbase.TableSnapshotInputFormat.snapshot.name"; - private static final String TABLE_DIR_KEY = "hbase.TableSnapshotInputFormat.table.dir"; + // key for specifying the root dir of the restored snapshot + private static final String RESTORE_DIR_KEY = "hbase.TableSnapshotInputFormat.restore.dir"; /** See {@link #getBestLocations(Configuration, HDFSBlocksDistribution)} */ private static final String LOCALITY_CUTOFF_MULTIPLIER = "hbase.tablesnapshotinputformat.locality.cutoff.multiplier"; @@ -156,7 +158,7 @@ public class TableSnapshotInputFormatImpl { Path rootDir = new Path(conf.get(HConstants.HBASE_DIR)); FileSystem fs = rootDir.getFileSystem(conf); - Path tmpRootDir = new Path(conf.get(TABLE_DIR_KEY)); // This is the user specified root + Path tmpRootDir = new Path(conf.get(RESTORE_DIR_KEY)); // This is the user specified root // directory where snapshot was restored Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir); @@ -263,7 +265,9 @@ public class TableSnapshotInputFormatImpl { } else { throw new IllegalArgumentException("Unable to create scan"); } - Path tableDir = new Path(conf.get(TABLE_DIR_KEY)); + // the temp dir where the snapshot is restored + Path restoreDir = new Path(conf.get(RESTORE_DIR_KEY)); + Path tableDir = FSUtils.getTableDir(restoreDir, htd.getTableName()); List<InputSplit> splits = new ArrayList<InputSplit>(); for (String regionName : snapshotRegionNames) { @@ -358,6 +362,6 @@ public class TableSnapshotInputFormatImpl { // TODO: restore from record readers to parallelize. RestoreSnapshotHelper.copySnapshotForScanner(conf, fs, rootDir, restoreDir, snapshotName); - conf.set(TABLE_DIR_KEY, restoreDir.toString()); + conf.set(RESTORE_DIR_KEY, restoreDir.toString()); } }