hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-16527 IOExceptions from DFS client still can cause CatalogJanitor to delete referenced files (Vladimir Rodionov)
Date Thu, 01 Sep 2016 19:47:17 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.1 4de27ee31 -> bd61885ba


HBASE-16527 IOExceptions from DFS client still can cause CatalogJanitor to delete referenced
files (Vladimir Rodionov)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bd61885b
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bd61885b
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bd61885b

Branch: refs/heads/branch-1.1
Commit: bd61885ba133999f4bd76fff5ce9950a4d3d0010
Parents: 4de27ee
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Sep 1 12:47:09 2016 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Thu Sep 1 12:47:09 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/master/CatalogJanitor.java     | 20 ++++++++++----------
 .../hbase/regionserver/HRegionFileSystem.java   | 15 ++++++++++++---
 2 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/bd61885b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
index 37779c1..d686d7c 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
@@ -393,27 +393,27 @@ public class CatalogJanitor extends ScheduledChore {
         return new Pair<Boolean, Boolean>(Boolean.FALSE, Boolean.FALSE);
       }
     } catch (IOException ioe) {
-      LOG.warn("Error trying to determine if daughter region exists, " +
+      LOG.error("Error trying to determine if daughter region exists, " +
                "assuming exists and has references", ioe);
       return new Pair<Boolean, Boolean>(Boolean.TRUE, Boolean.TRUE);
     }
 
+    boolean references = false;
+    HTableDescriptor parentDescriptor = getTableDescriptor(parent.getTable());
     try {
       regionFs = HRegionFileSystem.openRegionFromFileSystem(
           this.services.getConfiguration(), fs, tabledir, daughter, true);
+      
+      for (HColumnDescriptor family: parentDescriptor.getFamilies()) {
+        if ((references = regionFs.hasReferences(family.getNameAsString()))) {
+          break;
+        }
+      }
     } catch (IOException e) {
-      LOG.warn("Error trying to determine referenced files from : " + daughter.getEncodedName()
+      LOG.error("Error trying to determine referenced files from : " + daughter.getEncodedName()
           + ", to: " + parent.getEncodedName() + " assuming has references", e);
       return new Pair<Boolean, Boolean>(Boolean.TRUE, Boolean.TRUE);
     }
-
-    boolean references = false;
-    HTableDescriptor parentDescriptor = getTableDescriptor(parent.getTable());
-    for (HColumnDescriptor family: parentDescriptor.getFamilies()) {
-      if ((references = regionFs.hasReferences(family.getNameAsString()))) {
-        break;
-      }
-    }
     return new Pair<Boolean, Boolean>(Boolean.TRUE, Boolean.valueOf(references));
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/bd61885b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
----------------------------------------------------------------------
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 73eb12a..fda955d 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
@@ -249,9 +249,18 @@ public class HRegionFileSystem {
    * @throws IOException
    */
   public boolean hasReferences(final String familyName) throws IOException {
-    FileStatus[] files = FSUtils.listStatus(fs, getStoreDir(familyName),
-        new FSUtils.ReferenceFileFilter(fs));
-    return files != null && files.length > 0;
+    FileStatus[] files = FSUtils.listStatus(fs, getStoreDir(familyName));
+    if (files != null) {
+      for(FileStatus stat: files) {
+        if(stat.isDirectory()) {
+          continue;
+        }
+        if(StoreFileInfo.isReference(stat.getPath())) {
+          return true;
+        }
+      }
+    }
+    return false;
   }
 
   /**


Mime
View raw message