Repository: phoenix
Updated Branches:
  refs/heads/4.x-cdh5.11.2 ca5c9d03c -> d14233ccd


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

Signed-off-by: Geoffrey Jacoby <[email protected]>


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

Branch: refs/heads/4.x-cdh5.11.2
Commit: 3fe43771e82862f842cb6019b18f90330ada3e47
Parents: ca5c9d0
Author: Yechao Chen <[email protected]>
Authored: Fri Mar 2 01:53:04 2018 +0000
Committer: Pedro Boado <[email protected]>
Committed: Sat Mar 3 20:14:41 2018 +0000

----------------------------------------------------------------------
 .../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/3fe43771/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