You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ec...@apache.org on 2013/12/10 01:55:24 UTC
svn commit: r1549724 -
/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java
Author: eclark
Date: Tue Dec 10 00:55:23 2013
New Revision: 1549724
URL: http://svn.apache.org/r1549724
Log:
HBASE-10043 Fix Potential Resouce Leak in MultiTableInputFormatBase
Modified:
hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java
Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java?rev=1549724&r1=1549723&r2=1549724&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/MultiTableInputFormatBase.java Tue Dec 10 00:55:23 2013
@@ -83,15 +83,24 @@ public abstract class MultiTableInputFor
new HTable(context.getConfiguration(), tSplit.getTableName());
TableRecordReader trr = this.tableRecordReader;
- // if no table record reader was provided use default
- if (trr == null) {
- trr = new TableRecordReader();
+
+ try {
+ // if no table record reader was provided use default
+ if (trr == null) {
+ trr = new TableRecordReader();
+ }
+ Scan sc = tSplit.getScan();
+ sc.setStartRow(tSplit.getStartRow());
+ sc.setStopRow(tSplit.getEndRow());
+ trr.setScan(sc);
+ trr.setHTable(table);
+ } catch (IOException ioe) {
+ // If there is an exception make sure that all
+ // resources are closed and released.
+ table.close();
+ trr.close();
+ throw ioe;
}
- Scan sc = tSplit.getScan();
- sc.setStartRow(tSplit.getStartRow());
- sc.setStopRow(tSplit.getEndRow());
- trr.setScan(sc);
- trr.setHTable(table);
return trr;
}