You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by en...@apache.org on 2015/04/29 02:27:55 UTC
hbase git commit: HBASE-13585 HRegionFileSystem#splitStoreFile()
finishes without closing the file handle in some situation (Stephen Yuan
Jiang)
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 <en...@apache.org>
Authored: Tue Apr 28 17:27:46 2015 -0700
Committer: Enis Soztutar <en...@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 =