hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject hbase git commit: HBASE-13585 HRegionFileSystem#splitStoreFile() finishes without closing the file handle in some situation (Stephen Yuan Jiang)
Date Wed, 29 Apr 2015 00:27:55 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 3d22c74cb -> 7348a05e9


HBASE-13585 HRegionFileSystem#splitStoreFile() finishes without closing the file handle in
some situation (Stephen Yuan Jiang)


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

Branch: refs/heads/master
Commit: 7348a05e9959c0891e1baebeef28c3be8feeb172
Parents: 3d22c74
Author: Enis Soztutar <enis@apache.org>
Authored: Tue Apr 28 17:27:46 2015 -0700
Committer: Enis Soztutar <enis@apache.org>
Committed: Tue Apr 28 17:27:46 2015 -0700

----------------------------------------------------------------------
 .../hbase/regionserver/HRegionFileSystem.java   | 48 +++++++++++---------
 1 file changed, 27 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/7348a05e/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 1a95bda..a698609 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
@@ -582,31 +582,37 @@ public class HRegionFileSystem {
     if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck()) {
       // Check whether the split row lies in the range of the store file
       // If it is outside the range, return directly.
-      if (top) {
-        //check if larger than last key.
-        KeyValue splitKey = KeyValueUtil.createFirstOnRow(splitRow);
-        byte[] lastKey = f.createReader().getLastKey();
-        // If lastKey is null means storefile is empty.
-        if (lastKey == null) return null;
-        if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(),
-          splitKey.getKeyOffset(), splitKey.getKeyLength(), lastKey, 0, lastKey.length) >
0) {
-          return null;
-        }
-      } else {
-        //check if smaller than first key
-        KeyValue splitKey = KeyValueUtil.createLastOnRow(splitRow);
-        byte[] firstKey = f.createReader().getFirstKey();
-        // If firstKey is null means storefile is empty.
-        if (firstKey == null) return null;
-        if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(),
-          splitKey.getKeyOffset(), splitKey.getKeyLength(), firstKey, 0, firstKey.length)
< 0) {
-          return null;
+      try {
+        if (top) {
+          //check if larger than last key.
+          KeyValue splitKey = KeyValueUtil.createFirstOnRow(splitRow);
+          byte[] lastKey = f.createReader().getLastKey();
+          // If lastKey is null means storefile is empty.
+          if (lastKey == null) {
+            return null;
+          }
+          if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(),
+            splitKey.getKeyOffset(), splitKey.getKeyLength(), lastKey, 0, lastKey.length)
> 0) {
+            return null;
+          }
+        } else {
+          //check if smaller than first key
+          KeyValue splitKey = KeyValueUtil.createLastOnRow(splitRow);
+          byte[] firstKey = f.createReader().getFirstKey();
+          // If firstKey is null means storefile is empty.
+          if (firstKey == null) {
+            return null;
+          }
+          if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(),
+            splitKey.getKeyOffset(), splitKey.getKeyLength(), firstKey, 0, firstKey.length)
< 0) {
+            return null;
+          }
         }
+      } finally {
+        f.closeReader(true);
       }
     }
 
-    f.closeReader(true);
-
     Path splitDir = new Path(getSplitsDir(hri), familyName);
     // A reference to the bottom half of the hsf store file.
     Reference r =


Mime
View raw message