Repository: phoenix
Updated Branches:
  refs/heads/master 1a226ed3e -> 02816fe95


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

Signed-off-by: Geoffrey <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/02816fe9
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/02816fe9
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/02816fe9

Branch: refs/heads/master
Commit: 02816fe95adff974e54fd7ace8851ba099ba0963
Parents: 1a226ed
Author: Yechao Chen <chenyec...@gmail.com>
Authored: Fri Mar 2 09:53:04 2018 +0800
Committer: Geoffrey <gjac...@apache.org>
Committed: Fri Mar 2 10:12:15 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/02816fe9/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