HBASE-13585 HRegionFileSystem#splitStoreFile() finishes without closing the file handle in some situation (Stephen Yuan Jiang)
This commit is contained in:
parent
3d22c74cb4
commit
7348a05e99
|
@ -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 =
|
||||
|
|
Loading…
Reference in New Issue