hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-18180 Possible connection leak while closing BufferedMutator in TableOutputFormat
Date Mon, 19 Jun 2017 02:46:53 GMT
Repository: hbase
Updated Branches:
  refs/heads/master c6e71f159 -> ce1ce728c


HBASE-18180 Possible connection leak while closing BufferedMutator in TableOutputFormat

Signed-off-by: tedyu <yuzhihong@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ce1ce728
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ce1ce728
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ce1ce728

Branch: refs/heads/master
Commit: ce1ce728c6daee9e294bf2915e91faaa73428f3d
Parents: c6e71f1
Author: Pankaj Kumar <pankaj.kr@huawei.com>
Authored: Mon Jun 12 19:51:41 2017 +0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sun Jun 18 19:46:47 2017 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hbase/mapred/TableOutputFormat.java | 13 ++++++++-----
 .../hadoop/hbase/mapreduce/TableOutputFormat.java     | 14 ++++++++++----
 2 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ce1ce728/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableOutputFormat.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableOutputFormat.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableOutputFormat.java
index eb4b66f..8878eee 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableOutputFormat.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapred/TableOutputFormat.java
@@ -84,11 +84,14 @@ public class TableOutputFormat extends FileOutputFormat<ImmutableBytesWritable,
     }
 
     public void close(Reporter reporter) throws IOException {
-      if (this.m_mutator != null) {
-        this.m_mutator.close();
-      }
-      if (conn != null) {
-        this.conn.close();
+      try {
+        if (this.m_mutator != null) {
+          this.m_mutator.close();
+        }
+      } finally {
+        if (conn != null) {
+          this.conn.close();
+        }
       }
     }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/ce1ce728/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
index 615999f..5986df8 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableOutputFormat.java
@@ -115,10 +115,16 @@ implements Configurable {
      * @see RecordWriter#close(TaskAttemptContext)
      */
     @Override
-    public void close(TaskAttemptContext context)
-    throws IOException {
-      mutator.close();
-      connection.close();
+    public void close(TaskAttemptContext context) throws IOException {
+      try {
+        if (mutator != null) {
+          mutator.close();
+        }
+      } finally {
+        if (connection != null) {
+          connection.close();
+        }
+      }
     }
 
     /**


Mime
View raw message