Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down