phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [phoenix] ChinmaySKulkarni commented on a change in pull request #460: PHOENIX-5184: HBase and Phoenix connection leaks in Indexing code path, OrphanViewTool and PhoenixConfigurationUtil
Date Wed, 13 Mar 2019 00:46:40 GMT
ChinmaySKulkarni commented on a change in pull request #460: PHOENIX-5184: HBase and Phoenix
connection leaks in Indexing code path, OrphanViewTool and PhoenixConfigurationUtil
URL: https://github.com/apache/phoenix/pull/460#discussion_r264939137
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/PhoenixRecordWriter.java
 ##########
 @@ -52,10 +52,20 @@ public PhoenixRecordWriter(final Configuration configuration) throws
SQLExceptio
     }
     
     public PhoenixRecordWriter(final Configuration configuration, Set<String> propsToIgnore)
throws SQLException {
-        this.conn = ConnectionUtil.getOutputConnectionWithoutTheseProps(configuration, propsToIgnore);
-        this.batchSize = PhoenixConfigurationUtil.getBatchSize(configuration);
-        final String upsertQuery = PhoenixConfigurationUtil.getUpsertStatement(configuration);
-        this.statement = this.conn.prepareStatement(upsertQuery);
+        Connection connection = null;
+        try {
+            connection = ConnectionUtil.getOutputConnectionWithoutTheseProps(configuration,
propsToIgnore);
+            this.batchSize = PhoenixConfigurationUtil.getBatchSize(configuration);
+            final String upsertQuery = PhoenixConfigurationUtil.getUpsertStatement(configuration);
+            this.statement = connection.prepareStatement(upsertQuery);
 
 Review comment:
   No exception can be thrown after instantiating the statement object, so that shouldn't
be necessary. Besides, we close both the statement and the connection in the `close` method

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message