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 a3897fab7a8..ede23887d60 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 @@ -62,7 +62,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 = @@ -162,7 +163,7 @@ public class TableSnapshotInputFormatImpl { HRegionInfo hri = this.split.getRegionInfo(); FileSystem fs = FSUtils.getCurrentFileSystem(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 // create scan @@ -257,7 +258,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 splits = new ArrayList(); for (SnapshotRegionManifest regionManifest : regionManifests) { @@ -351,6 +354,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()); } }