HBASE-5282 Possible file handle leak with truncated HLog file

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1236445 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Hsieh 2012-01-26 23:30:47 +00:00
parent da1443d90a
commit 36788d1cc2
1 changed files with 5 additions and 2 deletions

View File

@ -2739,8 +2739,9 @@ public class HRegion implements HeapSize { // , Writable{
MonitoredTask status = TaskMonitor.get().createStatus(msg);
status.setStatus("Opening logs");
HLog.Reader reader = HLog.getReader(this.fs, edits, conf);
HLog.Reader reader = null;
try {
reader = HLog.getReader(this.fs, edits, conf);
long currentEditSeqId = minSeqId;
long firstSeqIdInLog = -1;
long skippedEdits = 0;
@ -2871,8 +2872,10 @@ public class HRegion implements HeapSize { // , Writable{
LOG.debug(msg);
return currentEditSeqId;
} finally {
reader.close();
status.cleanup();
if (reader != null) {
reader.close();
}
}
}