This is an automated email from the ASF dual-hosted git repository.

liuxiaocs7 pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-3 by this push:
     new 5d4dc1c86da HBASE-30217 Remove dead code getRegionId and 
isTemporaryDirectoryName… (#8331)
5d4dc1c86da is described below

commit 5d4dc1c86daddfdb2241b7232036be87f10c752e
Author: Xiao Liu <[email protected]>
AuthorDate: Tue Jun 16 19:06:03 2026 +0800

    HBASE-30217 Remove dead code getRegionId and isTemporaryDirectoryName… 
(#8331)
    
    Signed-off-by: Wellington Chevreuil <[email protected]>
    Signed-off-by: Peng Lu <[email protected]>
---
 .../hbase/regionserver/HRegionFileSystem.java      | 31 ----------------------
 .../regionserver/TestHdfsSnapshotHRegion.java      |  8 ++----
 2 files changed, 2 insertions(+), 37 deletions(-)

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 b02bec8413c..0655a87b260 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";
 
@@ -999,31 +993,6 @@ public class HRegionFileSystem {
     }
   }
 
-  /**
-   * 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 3c86d106926..11eb7bcd3f7 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
@@ -83,8 +83,8 @@ public class TestHdfsSnapshotHRegion {
   }
 
   @Test
-  public void testSnapshottingWithTmpSplitsAndMergeDirectoriesPresent() throws 
Exception {
-    // lets get a region and create those directories and make sure we ignore 
them
+  public void testSnapshottingWithTmpDirectoryPresent() throws Exception {
+    // Create the temp directory and make sure snapshot-open still ignores it.
     RegionInfo firstRegion = 
TEST_UTIL.getConnection().getRegionLocator(table.getName())
       .getAllRegionLocations().stream().findFirst().get().getRegion();
     String encodedName = firstRegion.getEncodedName();
@@ -92,10 +92,6 @@ public class TestHdfsSnapshotHRegion {
     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));
     // now snapshot
     String snapshotDir = client.createSnapshot(baseDir, "foo_snapshot");
     // everything should still open just fine

Reply via email to