diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java index 821f4321c1f..1a03c6ca888 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HFileLink.java @@ -142,50 +142,6 @@ public class HFileLink extends FileLink { return m.groupCount() > 2 && m.group(3) != null && m.group(2) != null && m.group(1) != null; } - /** - * The returned path can be the "original" file path like: /hbase/table/region/cf/hfile - * or a path to the archived file like: /hbase/.archive/table/region/cf/hfile - * - * @param fs {@link FileSystem} on which to check the HFileLink - * @param conf {@link Configuration} from which to extract specific archive locations - * @param path HFileLink path - * @return Referenced path (original path or archived path) - * @throws IOException on unexpected error. - */ - public static Path getReferencedPath(final Configuration conf, final FileSystem fs, - final Path path) throws IOException { - return getReferencedPath(fs, FSUtils.getRootDir(conf), - HFileArchiveUtil.getArchivePath(conf), path); - } - - /** - * The returned path can be the "original" file path like: /hbase/table/region/cf/hfile - * or a path to the archived file like: /hbase/.archive/table/region/cf/hfile - * - * @param fs {@link FileSystem} on which to check the HFileLink - * @param rootDir root hbase directory - * @param archiveDir Path to the hbase archive directory - * @param path HFileLink path - * @return Referenced path (original path or archived path) - * @throws IOException on unexpected error. - */ - public static Path getReferencedPath(final FileSystem fs, final Path rootDir, - final Path archiveDir, final Path path) throws IOException { - Path hfilePath = getRelativeTablePath(path); - - Path originPath = new Path(rootDir, hfilePath); - if (fs.exists(originPath)) { - return originPath; - } - - Path archivePath = new Path(archiveDir, hfilePath); - if (fs.exists(archivePath)) { - return archivePath; - } - - return new Path(new Path(rootDir, HConstants.HBASE_TEMP_DIRECTORY), hfilePath); - } - /** * Convert a HFileLink path to a table relative path. * e.g. the link: /hbase/test/0123/cf/testtb=4567-abcd diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java index 16dce6270b0..f726853735f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/ExportSnapshot.java @@ -304,8 +304,8 @@ public final class ExportSnapshot extends Configured implements Tool { private FileStatus getFileStatus(final FileSystem fs, final Path path) { try { if (HFileLink.isHFileLink(path)) { - Path refPath = HFileLink.getReferencedPath(fs, inputRoot, inputArchive, path); - return fs.getFileStatus(refPath); + HFileLink link = new HFileLink(inputRoot, inputArchive, path); + return link.getFileStatus(fs); } else if (isHLogLinkPath(path)) { String serverName = path.getParent().getName(); String logName = path.getName(); @@ -375,7 +375,7 @@ public final class ExportSnapshot extends Configured implements Tool { public void storeFile (final String region, final String family, final String hfile) throws IOException { Path path = new Path(family, HFileLink.createHFileLinkName(table, region, hfile)); - long size = fs.getFileStatus(HFileLink.getReferencedPath(conf, fs, path)).getLen(); + long size = new HFileLink(conf, path).getFileStatus(fs).getLen(); files.add(new Pair(path, size)); }