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:07:09 UTC
[2/4] hbase git commit: HBASE-13601 Connection leak during log
splitting. (Abhishek Singh Chouhan)
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/62c55a63
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/62c55a63
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/62c55a63
Branch: refs/heads/branch-1
Commit: 62c55a6350ac751969221aead51b0e758617c1b2
Parents: dc28ded
Author: Lars Hofhansl <la...@apache.org>
Authored: Thu Apr 30 17:05:05 2015 -0700
Committer: Lars Hofhansl <la...@apache.org>
Committed: Thu Apr 30 17:05:24 2015 -0700
----------------------------------------------------------------------
.../java/org/apache/hadoop/hbase/wal/WALFactory.java | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/62c55a63/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java
index b8dee83..4ef320a 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/WALFactory.java
@@ -279,6 +279,7 @@ public class WALFactory {
long startWaiting = EnvironmentEdgeManager.currentTime();
long openTimeout = timeoutMillis + startWaiting;
int nbAttempt = 0;
+ FSDataInputStream stream = null;
while (true) {
try {
if (lrClass != ProtobufLogReader.class) {
@@ -287,7 +288,7 @@ public class WALFactory {
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
@@ -301,6 +302,14 @@ public class WALFactory {
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")