hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject [4/4] hbase git commit: HBASE-13601 Connection leak during log splitting. (Abhishek Singh Chouhan)
Date Fri, 01 May 2015 00:07:11 GMT
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/402840df
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/402840df
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/402840df

Branch: refs/heads/branch-1.0
Commit: 402840dfea7bfbd80f2b2ad987add1efa0189ae6
Parents: 659ff6a
Author: Lars Hofhansl <larsh@apache.org>
Authored: Thu Apr 30 17:05:05 2015 -0700
Committer: Lars Hofhansl <larsh@apache.org>
Committed: Thu Apr 30 17:07:03 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/402840df/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")


Mime
View raw message