You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2018/09/21 23:17:55 UTC

[6/7] hbase git commit: Amend HBASE-20704 Sometimes some compacted storefiles are not archived on region close

Amend HBASE-20704 Sometimes some compacted storefiles are not archived on region close

Forward port small logging improvements from branch-1 version of this change.


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

Branch: refs/heads/branch-2.0
Commit: d026f3c5d0af181dfafa4a0672571cdb1ca3700f
Parents: e8da96e
Author: Andrew Purtell <ap...@apache.org>
Authored: Fri Sep 21 12:23:55 2018 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Fri Sep 21 16:12:48 2018 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/regionserver/HStore.java  | 14 +++++++-------
 .../hadoop/hbase/regionserver/StoreFileReader.java    |  8 ++++++++
 2 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/d026f3c5/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
index 01e4457..dae2243 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java
@@ -2558,7 +2558,7 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
           if (storeClosing && !file.isCompactedAway()) {
             String msg =
                 "Region closing but StoreFile is in compacted list but not compacted away: " +
-                file.getPath().getName();
+                file.getPath();
             throw new IllegalStateException(msg);
           }
 
@@ -2566,8 +2566,8 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
           //and remove compacted storefiles from the region directory
           if (file.isCompactedAway() && (!file.isReferencedInReads() || storeClosing)) {
             if (storeClosing && file.isReferencedInReads()) {
-              LOG.debug("Region closing but StoreFile still has references: {}",
-                  file.getPath().getName());
+              LOG.warn("Region closing but StoreFile still has references: file={}, refCount={}",
+                  file.getPath(), r.getRefCount());
             }
             // Even if deleting fails we need not bother as any new scanners won't be
             // able to use the compacted file as the status is already compactedAway
@@ -2578,13 +2578,13 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, Propagat
             filesToRemove.add(file);
           } else {
             LOG.info("Can't archive compacted file " + file.getPath()
-                + " because of either isCompactedAway = " + file.isCompactedAway()
-                + " or file has reference, isReferencedInReads = " + file.isReferencedInReads()
-                + ", skipping for now.");
+                + " because of either isCompactedAway=" + file.isCompactedAway()
+                + " or file has reference, isReferencedInReads=" + file.isReferencedInReads()
+                + ", refCount=" + r.getRefCount() + ", skipping for now.");
           }
         } catch (Exception e) {
           String msg = "Exception while trying to close the compacted store file " +
-              file.getPath().getName();
+              file.getPath();
           if (storeClosing) {
             msg = "Store is closing. " + msg;
           }

http://git-wip-us.apache.org/repos/asf/hbase/blob/d026f3c5/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileReader.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileReader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileReader.java
index 9080c2d..b500abf 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileReader.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileReader.java
@@ -157,6 +157,14 @@ public class StoreFileReader {
   }
 
   /**
+   * Return the ref count associated with the reader whenever a scanner associated with the
+   * reader is opened.
+   */
+  int getRefCount() {
+    return refCount.get();
+  }
+
+  /**
    * Indicate that the scanner has started reading with this reader. We need to increment the ref
    * count so reader is not close until some object is holding the lock
    */