Skip to content

Commit 3d315d6

Browse files
committed
revert some changes
1 parent e436168 commit 3d315d6

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/SplitTableRegionProcedure.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,8 @@ private Pair<List<Path>, List<Path>> splitStoreFiles(final MasterProcedureEnv en
751751
for (Map.Entry<String, Collection<StoreFileInfo>> e : files.entrySet()) {
752752
byte[] familyName = Bytes.toBytes(e.getKey());
753753
final ColumnFamilyDescriptor hcd = htd.getColumnFamily(familyName);
754-
final Collection<StoreFileInfo> storeFiles = e.getValue();
754+
Collection<StoreFileInfo> storeFileInfos = e.getValue();
755+
final Collection<StoreFileInfo> storeFiles = storeFileInfos;
755756
if (storeFiles != null && storeFiles.size() > 0) {
756757
final Configuration storeConfiguration =
757758
StoreUtils.createStoreConfiguration(env.getMasterConfiguration(), htd, hcd);

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,9 @@ public class HRegionFileSystem {
7979
public final static String REGION_INFO_FILE = ".regioninfo";
8080

8181
/** Temporary subdirectory of the region directory used for merges. */
82-
@Deprecated
8382
public static final String REGION_MERGES_DIR = ".merges";
8483

8584
/** Temporary subdirectory of the region directory used for splits. */
86-
@Deprecated
8785
public static final String REGION_SPLITS_DIR = ".splits";
8886

8987
/** Temporary subdirectory of the region directory used for compaction output. */
@@ -978,6 +976,31 @@ public static void deleteRegionFromFileSystem(final Configuration conf, final Fi
978976
}
979977
}
980978

979+
/**
980+
* Retrieves the Region ID from the given HFile path.
981+
* @param hFilePath The path of the HFile.
982+
* @return The Region ID extracted from the HFile path.
983+
* @throws IOException If an I/O error occurs or if the HFile path is incorrect.
984+
*/
985+
public static String getRegionId(Path hFilePath) throws IOException {
986+
if (hFilePath.getParent() == null || hFilePath.getParent().getParent() == null) {
987+
throw new IOException("Incorrect HFile Path: " + hFilePath);
988+
}
989+
Path dir = hFilePath.getParent().getParent();
990+
if (isTemporaryDirectoryName(dir.getName())) {
991+
if (dir.getParent() == null) {
992+
throw new IOException("Incorrect HFile Path: " + hFilePath);
993+
}
994+
return dir.getParent().getName();
995+
}
996+
return dir.getName();
997+
}
998+
999+
private static boolean isTemporaryDirectoryName(String dirName) {
1000+
return REGION_MERGES_DIR.equals(dirName) || REGION_SPLITS_DIR.equals(dirName)
1001+
|| REGION_TEMP_DIR.equals(dirName);
1002+
}
1003+
9811004
/**
9821005
* Creates a directory. Assumes the user has already checked for this directory existence.
9831006
* @return the result of fs.mkdirs(). In case underlying fs throws an IOException, it checks

0 commit comments

Comments
 (0)