You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2015/05/01 02:11:38 UTC
hbase git commit: HBASE-13601 Connection leak during log splitting.
(Abhishek Singh Chouhan)
Repository: hbase
Updated Branches:
refs/heads/0.98 bd3f2fb89 -> dc7db384e
HBASE-13601 Connection leak during log splitting. (Abhishek Singh Chouhan)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/dc7db384
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/dc7db384
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/dc7db384
Branch: refs/heads/0.98
Commit: dc7db384e1d8c0dedc3f83d7be3211b178b6c128
Parents: bd3f2fb
Author: Lars Hofhansl <la...@apache.org>
Authored: Thu Apr 30 17:11:40 2015 -0700
Committer: Lars Hofhansl <la...@apache.org>
Committed: Thu Apr 30 17:11:40 2015 -0700
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/wal/HLogFactory.java | 11 ++++++++++-
.../hadoop/hbase/regionserver/wal/HLogSplitter.java | 10 +++++++++-
2 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/dc7db384/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogFactory.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogFactory.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogFactory.java
index 7b99b58..e6107bf 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogFactory.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogFactory.java
@@ -107,6 +107,7 @@ public class HLogFactory {
long startWaiting = EnvironmentEdgeManager.currentTimeMillis();
long openTimeout = conf.getInt("hbase.hlog.open.timeout", 300000) + startWaiting;
int nbAttempt = 0;
+ FSDataInputStream stream = null;
while (true) {
try {
if (lrClass != ProtobufLogReader.class) {
@@ -115,7 +116,7 @@ public class HLogFactory {
reader.init(fs, path, conf, null);
return reader;
} else {
- FSDataInputStream stream = fs.open(path);
+ stream = fs.open(path);
// Note that zero-length file will fail to read PB magic, and attempt to create
// a non-PB reader and fail the same way existing code expects it to. If we get
// rid of the old reader entirely, we need to handle 0-size files differently from
@@ -129,6 +130,14 @@ public class HLogFactory {
return reader;
}
} catch (IOException e) {
+ try {
+ if (stream != null) {
+ stream.close();
+ }
+ } catch (IOException exception) {
+ LOG.warn("Could not close FSDataInputStream" + exception.getMessage());
+ LOG.debug("exception details", exception);
+ }
String msg = e.getMessage();
if (msg != null && (msg.contains("Cannot obtain block length")
|| msg.contains("Could not obtain the last block")
http://git-wip-us.apache.org/repos/asf/hbase/blob/dc7db384/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
index 43af953..d0ba44e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLogSplitter.java
@@ -264,6 +264,7 @@ public class HLogSplitter {
boolean progress_failed = false;
int editsCount = 0;
int editsSkipped = 0;
+ Reader in = null;
status =
TaskMonitor.get().createStatus(
@@ -277,7 +278,6 @@ public class HLogSplitter {
progress_failed = true;
return false;
}
- Reader in = null;
try {
in = getReader(fs, logfile, conf, skipErrors, reporter);
} catch (CorruptedLogFileException e) {
@@ -358,6 +358,14 @@ public class HLogSplitter {
} finally {
LOG.debug("Finishing writing output logs and closing down.");
try {
+ if (null != in) {
+ in.close();
+ }
+ } catch (IOException exception) {
+ LOG.warn("Could not close wal reader: " + exception.getMessage());
+ LOG.debug("exception details", exception);
+ }
+ try {
if (outputSinkStarted) {
// Set progress_failed to true as the immediate following statement will reset its value
// when finishWritingAndClose() throws exception, progress_failed has the right value