HBASE-5819 SplitLogs function could leak resources
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1327697 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7972efeea8
commit
d91ea129e8
|
@ -260,9 +260,9 @@ public class HLogSplitter {
|
|||
* directory.
|
||||
*/
|
||||
private List<Path> splitLog(final FileStatus[] logfiles) throws IOException {
|
||||
List<Path> processedLogs = new ArrayList<Path>();
|
||||
List<Path> corruptedLogs = new ArrayList<Path>();
|
||||
List<Path> splits = null;
|
||||
List<Path> processedLogs = new ArrayList<Path>(logfiles.length);
|
||||
List<Path> corruptedLogs = new ArrayList<Path>(logfiles.length);
|
||||
List<Path> splits;
|
||||
|
||||
boolean skipErrors = conf.getBoolean("hbase.hlog.split.skip.errors", true);
|
||||
|
||||
|
@ -279,24 +279,25 @@ public class HLogSplitter {
|
|||
splitSize += logLength;
|
||||
logAndReport("Splitting hlog " + (i++ + 1) + " of " + logfiles.length
|
||||
+ ": " + logPath + ", length=" + logLength);
|
||||
Reader in;
|
||||
Reader in = null;
|
||||
try {
|
||||
in = getReader(fs, log, conf, skipErrors);
|
||||
if (in != null) {
|
||||
parseHLog(in, logPath, entryBuffers, fs, conf, skipErrors);
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Close log reader threw exception -- continuing",
|
||||
e);
|
||||
}
|
||||
}
|
||||
processedLogs.add(logPath);
|
||||
} catch (CorruptedLogFileException e) {
|
||||
LOG.info("Got while parsing hlog " + logPath +
|
||||
". Marking as corrupted", e);
|
||||
corruptedLogs.add(logPath);
|
||||
continue;
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Close log reader threw exception -- continuing", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
status.setStatus("Log splits complete. Checking for orphaned logs.");
|
||||
|
@ -619,7 +620,7 @@ public class HLogSplitter {
|
|||
if (!fs.rename(corrupted, p)) {
|
||||
LOG.warn("Unable to move corrupted log " + corrupted + " to " + p);
|
||||
} else {
|
||||
LOG.warn("Moving corrupted log " + corrupted + " to " + p);
|
||||
LOG.warn("Moved corrupted log " + corrupted + " to " + p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue