diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java index ac7a5faa2745..beefa2fa6cde 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java @@ -78,12 +78,6 @@ public class HRegionFileSystem { /** Name of the region info file that resides just under the region directory. */ public final static String REGION_INFO_FILE = ".regioninfo"; - /** Temporary subdirectory of the region directory used for merges. */ - public static final String REGION_MERGES_DIR = ".merges"; - - /** Temporary subdirectory of the region directory used for splits. */ - public static final String REGION_SPLITS_DIR = ".splits"; - /** Temporary subdirectory of the region directory used for compaction output. */ static final String REGION_TEMP_DIR = ".tmp"; @@ -1000,31 +994,6 @@ public static void deleteRegionFromFileSystem(final Configuration conf, final Fi } } - /** - * Retrieves the Region ID from the given HFile path. - * @param hFilePath The path of the HFile. - * @return The Region ID extracted from the HFile path. - * @throws IOException If an I/O error occurs or if the HFile path is incorrect. - */ - public static String getRegionId(Path hFilePath) throws IOException { - if (hFilePath.getParent() == null || hFilePath.getParent().getParent() == null) { - throw new IOException("Incorrect HFile Path: " + hFilePath); - } - Path dir = hFilePath.getParent().getParent(); - if (isTemporaryDirectoryName(dir.getName())) { - if (dir.getParent() == null) { - throw new IOException("Incorrect HFile Path: " + hFilePath); - } - return dir.getParent().getName(); - } - return dir.getName(); - } - - private static boolean isTemporaryDirectoryName(String dirName) { - return REGION_MERGES_DIR.equals(dirName) || REGION_SPLITS_DIR.equals(dirName) - || REGION_TEMP_DIR.equals(dirName); - } - /** * Creates a directory. Assumes the user has already checked for this directory existence. * @return the result of fs.mkdirs(). In case underlying fs throws an IOException, it checks diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHdfsSnapshotHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHdfsSnapshotHRegion.java index 3c86d1069264..650cb24d59d0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHdfsSnapshotHRegion.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHdfsSnapshotHRegion.java @@ -92,10 +92,9 @@ public void testSnapshottingWithTmpSplitsAndMergeDirectoriesPresent() throws Exc Path regionDirectoryPath = new Path(tableDir, encodedName); TEST_UTIL.getTestFileSystem() .create(new Path(regionDirectoryPath, HRegionFileSystem.REGION_TEMP_DIR)); - TEST_UTIL.getTestFileSystem() - .create(new Path(regionDirectoryPath, HRegionFileSystem.REGION_SPLITS_DIR)); - TEST_UTIL.getTestFileSystem() - .create(new Path(regionDirectoryPath, HRegionFileSystem.REGION_MERGES_DIR)); + // Legacy directories created by split/merge before HBASE-26187 + TEST_UTIL.getTestFileSystem().create(new Path(regionDirectoryPath, ".splits")); + TEST_UTIL.getTestFileSystem().create(new Path(regionDirectoryPath, ".merges")); // now snapshot String snapshotDir = client.createSnapshot(baseDir, "foo_snapshot"); // everything should still open just fine