infraio commented on a change in pull request #461: HBASE-22807 HBCK Report 
showed wrong orphans regions on FileSystem
URL: https://github.com/apache/hbase/pull/461#discussion_r311810719
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HbckChore.java
 ##########
 @@ -191,27 +194,24 @@ private void loadRegionsFromFS() throws IOException {
     Path rootDir = master.getMasterFileSystem().getRootDir();
     FileSystem fs = master.getMasterFileSystem().getFileSystem();
 
-    // list all tables from HDFS
-    List<FileStatus> tableDirs = Lists.newArrayList();
-    List<Path> paths = FSUtils.getTableDirs(fs, rootDir);
-    for (Path path : paths) {
-      tableDirs.add(fs.getFileStatus(path));
-    }
-
-    for (FileStatus tableDir : tableDirs) {
-      FileStatus[] regionDirs = fs.listStatus(tableDir.getPath());
-      for (FileStatus regionDir : regionDirs) {
-        String encodedRegionName = regionDir.getPath().getName();
+    int numRegions = 0;
+    List<Path> tableDirs = FSUtils.getTableDirs(fs, rootDir);
+    for (Path tableDir : tableDirs) {
+      List<Path> regionDirs = FSUtils.getRegionDirs(fs, tableDir);
+      for (Path regionDir : regionDirs) {
+        String encodedRegionName = regionDir.getName();
         HbckRegionInfo hri = regionInfoMap.get(encodedRegionName);
         if (hri == null) {
           orphanRegionsOnFS.add(encodedRegionName);
           continue;
         }
-        HbckRegionInfo.HdfsEntry hdfsEntry =
 
 Review comment:
   Let me try it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to