hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ssrungar...@apache.org
Subject hbase git commit: HBASE-14394 Properly close the connection after reading records from table.
Date Tue, 15 Sep 2015 18:09:21 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.2 15e75266d -> 0d3f0f64a


HBASE-14394 Properly close the connection after reading records from table.


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

Branch: refs/heads/branch-1.2
Commit: 0d3f0f64a49cbd33f26d7dfd97ec30aa7d78a752
Parents: 15e7526
Author: Srikanth Srungarapu <ssrungarapu@cloudera.com>
Authored: Tue Sep 15 11:02:00 2015 -0700
Committer: Srikanth Srungarapu <ssrungarapu@cloudera.com>
Committed: Tue Sep 15 11:07:14 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/mapreduce/MultiTableInputFormatBase.java |  3 +--
 .../apache/hadoop/hbase/mapreduce/TableRecordReader.java  | 10 +++++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/0d3f0f64/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java
index f4a3eb1..83dca4b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java
@@ -107,11 +107,10 @@ public abstract class MultiTableInputFormatBase extends
       sc.setStopRow(tSplit.getEndRow());
       trr.setScan(sc);
       trr.setTable(table);
+      trr.setConnection(connection);
     } catch (IOException ioe) {
       // If there is an exception make sure that all
       // resources are closed and released.
-      connection.close();
-      table.close();
       trr.close();
       throw ioe;
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/0d3f0f64/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReader.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReader.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReader.java
index f46f1e3..9ff90e7 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReader.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/TableRecordReader.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
+import org.apache.hadoop.hbase.client.Connection;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.Table;
@@ -40,6 +41,7 @@ public class TableRecordReader
 extends RecordReader<ImmutableBytesWritable, Result> {
 
   private TableRecordReaderImpl recordReaderImpl = new TableRecordReaderImpl();
+  private Connection connection = null;
 
   /**
    * Restart from survivable exceptions by creating a new scanner.
@@ -85,8 +87,10 @@ extends RecordReader<ImmutableBytesWritable, Result> {
    * @see org.apache.hadoop.mapreduce.RecordReader#close()
    */
   @Override
-  public void close() {
+  public void close() throws IOException {
     this.recordReaderImpl.close();
+    if (this.connection != null)
+      this.connection.close();
   }
 
   /**
@@ -157,4 +161,8 @@ extends RecordReader<ImmutableBytesWritable, Result> {
   public float getProgress() {
     return this.recordReaderImpl.getProgress();
   }
+
+  public void setConnection(Connection connection) {
+    this.connection = connection;
+  }
 }


Mime
View raw message