Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.3 7b5bd5da9 -> 814afcb93


PHOENIX-4635 HBase Connection leak in 
org.apache.phoenix.hive.mapreduce.PhoenixInputFormat

Signed-off-by: Geoffrey Jacoby <gjac...@apache.org>


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

Branch: refs/heads/4.x-HBase-1.3
Commit: 814afcb93fce729fcf49f050cf15cd56897eec8a
Parents: 7b5bd5d
Author: Yechao Chen <chenyec...@gmail.com>
Authored: Fri Mar 2 09:53:04 2018 +0800
Committer: Geoffrey Jacoby <gjac...@apache.org>
Committed: Fri Mar 2 11:00:50 2018 -0800

----------------------------------------------------------------------
 .../org/apache/phoenix/hive/mapreduce/PhoenixInputFormat.java     | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/814afcb9/phoenix-hive/src/main/java/org/apache/phoenix/hive/mapreduce/PhoenixInputFormat.java
----------------------------------------------------------------------
diff --git 
a/phoenix-hive/src/main/java/org/apache/phoenix/hive/mapreduce/PhoenixInputFormat.java
 
b/phoenix-hive/src/main/java/org/apache/phoenix/hive/mapreduce/PhoenixInputFormat.java
index f0a5dd6..b550e32 100644
--- 
a/phoenix-hive/src/main/java/org/apache/phoenix/hive/mapreduce/PhoenixInputFormat.java
+++ 
b/phoenix-hive/src/main/java/org/apache/phoenix/hive/mapreduce/PhoenixInputFormat.java
@@ -150,7 +150,7 @@ public class PhoenixInputFormat<T extends DBWritable> 
implements InputFormat<Wri
         setScanCacheSize(jobConf);
 
         // Adding Localization
-        HConnection connection = 
HConnectionManager.createConnection(PhoenixConnectionUtil.getConfiguration(jobConf));
+        try (HConnection connection = 
HConnectionManager.createConnection(PhoenixConnectionUtil.getConfiguration(jobConf)))
 {
         RegionLocator regionLocator = 
connection.getRegionLocator(TableName.valueOf(qplan
                 .getTableRef().getTable().getPhysicalName().toString()));
         RegionSizeCalculator sizeCalculator = new 
RegionSizeCalculator(regionLocator, connection
@@ -203,6 +203,7 @@ public class PhoenixInputFormat<T extends DBWritable> 
implements InputFormat<Wri
                 psplits.add(inputSplit);
             }
         }
+        }
 
         return psplits;
     }

Reply via email to