Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.2 bb0813199 -> fb8997963


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/fb899796
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fb899796
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fb899796

Branch: refs/heads/4.x-HBase-1.2
Commit: fb89979632d6aa1c8569ff67c00bcdd93ca7bc98
Parents: bb08131
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 10:48:53 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/fb899796/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