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,12 +582,15 @@ public class HRegionFileSystem {
|
||||||
if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck()) {
|
if (splitPolicy == null || !splitPolicy.skipStoreFileRangeCheck()) {
|
||||||
// Check whether the split row lies in the range of the store file
|
// Check whether the split row lies in the range of the store file
|
||||||
// If it is outside the range, return directly.
|
// If it is outside the range, return directly.
|
||||||
|
try {
|
||||||
if (top) {
|
if (top) {
|
||||||
//check if larger than last key.
|
//check if larger than last key.
|
||||||
KeyValue splitKey = KeyValueUtil.createFirstOnRow(splitRow);
|
KeyValue splitKey = KeyValueUtil.createFirstOnRow(splitRow);
|
||||||
byte[] lastKey = f.createReader().getLastKey();
|
byte[] lastKey = f.createReader().getLastKey();
|
||||||
// If lastKey is null means storefile is empty.
|
// If lastKey is null means storefile is empty.
|
||||||
if (lastKey == null) return null;
|
if (lastKey == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(),
|
if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(),
|
||||||
splitKey.getKeyOffset(), splitKey.getKeyLength(), lastKey, 0, lastKey.length) > 0) {
|
splitKey.getKeyOffset(), splitKey.getKeyLength(), lastKey, 0, lastKey.length) > 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -597,15 +600,18 @@ public class HRegionFileSystem {
|
||||||
KeyValue splitKey = KeyValueUtil.createLastOnRow(splitRow);
|
KeyValue splitKey = KeyValueUtil.createLastOnRow(splitRow);
|
||||||
byte[] firstKey = f.createReader().getFirstKey();
|
byte[] firstKey = f.createReader().getFirstKey();
|
||||||
// If firstKey is null means storefile is empty.
|
// If firstKey is null means storefile is empty.
|
||||||
if (firstKey == null) return null;
|
if (firstKey == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(),
|
if (f.getReader().getComparator().compareFlatKey(splitKey.getBuffer(),
|
||||||
splitKey.getKeyOffset(), splitKey.getKeyLength(), firstKey, 0, firstKey.length) < 0) {
|
splitKey.getKeyOffset(), splitKey.getKeyLength(), firstKey, 0, firstKey.length) < 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} finally {
|
||||||
|
|
||||||
f.closeReader(true);
|
f.closeReader(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Path splitDir = new Path(getSplitsDir(hri), familyName);
|
Path splitDir = new Path(getSplitsDir(hri), familyName);
|
||||||
// A reference to the bottom half of the hsf store file.
|
// A reference to the bottom half of the hsf store file.
|
||||||
|
|
Loading…
Reference in New Issue