You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by swaroopak <gi...@git.apache.org> on 2018/08/30 21:10:38 UTC

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

GitHub user swaroopak opened a pull request:

    https://github.com/apache/phoenix/pull/338

    PHOENIX-4870 LoggingPhoenixConnection should log metrics when AutoCommit is set to True.

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/swaroopak/phoenix PHOENIX-4870

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/phoenix/pull/338.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #338
    
----
commit 97a04d7aaec6011edad06a21c9283c3cecf38beb
Author: s.kadam <s....@...>
Date:   2018-08-28T23:07:24Z

    PHOENIX-4870 Added test case and fixed the bug for auto commit in LoggingPhoenixStatement

----


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by swaroopak <gi...@git.apache.org>.
Github user swaroopak commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214208402
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    +            phoenixMetricsLog.logWriteMetricsfoForMutationsSinceLastReset(
    --- End diff --
    
    Looks like we can't.


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214222006
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    +            phoenixMetricsLog.logWriteMetricsfoForMutationsSinceLastReset(
    --- End diff --
    
    Can you check `LoggingPhoenixConnection`? It has similar calls multiple times as well. Might be good to refactor this along with it.


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214200566
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    --- End diff --
    
    Follow up: Is `Statement stmt` reference needed?


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214222170
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    --- End diff --
    
    I see this piece of code
    ```
                            // If transactional, this will move the read pointer forward
                            if (connection.getAutoCommit()) {
                                connection.commit();
                            }
    ```
    @twdsilva any idea?


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214199911
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixLoggingMetricsIT.java ---
    @@ -154,6 +154,35 @@ private void verifyQueryLevelMetricsLogging(String query) throws SQLException {
             assertTrue(logRequestReadMetricsFuncCallCount == 1);
         }
     
    +    @Test
    +    public void testPhoenixMetricsLoggedOnAutoCommit() throws Exception {
    +        // Autocommit is turned on explicitly
    +        loggedConn.setAutoCommit(true);
    +        //with executeUpdate() method
    +        // run SELECT to verify read metrics are logged
    +        String query = "SELECT * FROM " + tableName1;
    +        verifyQueryLevelMetricsLogging(query);
    +        // run UPSERT SELECT to verify mutation metrics are logged
    +        String upsertSelect = "UPSERT INTO " + tableName2 + " SELECT * FROM " + tableName1;
    +        loggedConn.createStatement().executeUpdate(upsertSelect);
    +        // Autocommit is turned on explicitly
    +        // Hence mutation metrics are expected during implicit commit
    +        assertTrue("Mutation write metrics are not logged for " + tableName2,
    --- End diff --
    
    You should check specifically for `tableName2` in the map.


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214198941
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixLoggingMetricsIT.java ---
    @@ -154,6 +154,35 @@ private void verifyQueryLevelMetricsLogging(String query) throws SQLException {
             assertTrue(logRequestReadMetricsFuncCallCount == 1);
         }
     
    +    @Test
    +    public void testPhoenixMetricsLoggedOnAutoCommit() throws Exception {
    +        // Autocommit is turned on explicitly
    +        loggedConn.setAutoCommit(true);
    +        //with executeUpdate() method
    +        // run SELECT to verify read metrics are logged
    +        String query = "SELECT * FROM " + tableName1;
    +        verifyQueryLevelMetricsLogging(query);
    --- End diff --
    
    nit: Not related to this Jira, but its better to rename this method to `upsertRowsAndVerifyQueryLevelMetricsLogging`


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214200404
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    +            phoenixMetricsLog.logWriteMetricsfoForMutationsSinceLastReset(
    --- End diff --
    
    Can you reuse this piece of code from somewhere?


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by twdsilva <gi...@git.apache.org>.
Github user twdsilva commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214429093
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    --- End diff --
    
    Not sure if that is needed any more since we start the transaction in MetaDataClient.updateCache
    
    boolean isTransactional = (table!=null && table.isTransactional());
            if (isTransactional) {
                connection.getMutationState().startTransaction(table.getTransactionProvider());
            }


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r215432867
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixLoggingMetricsIT.java ---
    @@ -164,13 +167,51 @@ public void testPhoenixMetricsLoggedOnClose() throws Exception {
                     mutationReadMetricsMap.size() == 0);
         }
     
    +
    +    @Test
    +    public void testPhoenixMetricsLoggedOnAutoCommitTrue() throws Exception {
    --- End diff --
    
    nit: just add a description of test above as javadoc comment


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214200370
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    +            phoenixMetricsLog.logWriteMetricsfoForMutationsSinceLastReset(
    +                    PhoenixRuntime.getWriteMetricInfoForMutationsSinceLastReset(conn));
    +            phoenixMetricsLog.logReadMetricInfoForMutationsSinceLastReset(
    +                    PhoenixRuntime.getReadMetricInfoForMutationsSinceLastReset(conn));
    +            PhoenixRuntime.resetMetrics(conn);
    +        }
    +        return;
    --- End diff --
    
    nit: not needed


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214222059
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    --- End diff --
    
    What happens if its not a mutation and we try logging the metrics (in case of queries)?


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by swaroopak <gi...@git.apache.org>.
Github user swaroopak commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214205419
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    +            phoenixMetricsLog.logWriteMetricsfoForMutationsSinceLastReset(
    --- End diff --
    
    Unlikely, but let me check that. 


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r215431187
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixPreparedStatement.java ---
    @@ -17,20 +17,20 @@
      */
     package org.apache.phoenix.jdbc;
     
    -import java.sql.PreparedStatement;
    -import java.sql.ResultSet;
    -import java.sql.SQLException;
    -import java.sql.SQLFeatureNotSupportedException;
    +import java.sql.*;
     
     public class LoggingPhoenixPreparedStatement extends DelegatePreparedStatement {
         
         private PhoenixMetricsLog phoenixMetricsLog;
         private String sql;
    +    private Connection conn;
         
    -    public LoggingPhoenixPreparedStatement(PreparedStatement stmt, PhoenixMetricsLog phoenixMetricsLog, String sql) {
    +    public LoggingPhoenixPreparedStatement(Connection conn, PreparedStatement stmt,
    +                                           PhoenixMetricsLog phoenixMetricsLog, String sql) {
             super(stmt);
             this.phoenixMetricsLog = phoenixMetricsLog;
             this.sql = sql;
    +        this.conn = conn;
    --- End diff --
    
    nit: Can you move the init of variables in the same order as function arguments?


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r215432400
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -62,4 +75,10 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        if(conn instanceof LoggingPhoenixConnection && conn.getAutoCommit()){
    --- End diff --
    
    nit: 
    just change the order of conditions
    add brackets around `conn instanceof LoggingPhoenixConnection`
     and add spaces before brackets in conditions (applicable everywhere)



---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by swaroopak <gi...@git.apache.org>.
Github user swaroopak commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214424216
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    --- End diff --
    
    Yes, in case of executeQuery, metrics get logged. The differentiating function call happens in PhoenixStatement Class. In case of mutation, it directly executes executeMutation.


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214199456
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixLoggingMetricsIT.java ---
    @@ -154,6 +154,35 @@ private void verifyQueryLevelMetricsLogging(String query) throws SQLException {
             assertTrue(logRequestReadMetricsFuncCallCount == 1);
         }
     
    +    @Test
    +    public void testPhoenixMetricsLoggedOnAutoCommit() throws Exception {
    --- End diff --
    
    nit: `testPhoenixMetricsLoggedOnAutoCommit` to `testPhoenixMetricsLoggedOnAutoCommitTrue`


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214198016
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixLoggingMetricsIT.java ---
    @@ -154,6 +154,35 @@ private void verifyQueryLevelMetricsLogging(String query) throws SQLException {
             assertTrue(logRequestReadMetricsFuncCallCount == 1);
         }
     
    +    @Test
    +    public void testPhoenixMetricsLoggedOnAutoCommit() throws Exception {
    +        // Autocommit is turned on explicitly
    +        loggedConn.setAutoCommit(true);
    +        //with executeUpdate() method
    +        // run SELECT to verify read metrics are logged
    +        String query = "SELECT * FROM " + tableName1;
    +        verifyQueryLevelMetricsLogging(query);
    +        // run UPSERT SELECT to verify mutation metrics are logged
    +        String upsertSelect = "UPSERT INTO " + tableName2 + " SELECT * FROM " + tableName1;
    +        loggedConn.createStatement().executeUpdate(upsertSelect);
    +        // Autocommit is turned on explicitly
    +        // Hence mutation metrics are expected during implicit commit
    +        assertTrue("Mutation write metrics are not logged for " + tableName2,
    +                mutationWriteMetricsMap.size()  > 0);
    +        assertTrue("Mutation read metrics for not found for " + tableName1,
    +                mutationReadMetricsMap.get(tableName1).size() > 0);
    +        //with execute() method
    +        loggedConn.createStatement().execute(upsertSelect);
    +        // Autocommit is turned on explicitly
    +        // Hence mutation metrics are expected during implicit commit
    +        assertTrue("Mutation write metrics are not logged for " + tableName2,
    +                mutationWriteMetricsMap.size()  > 0);
    +        assertTrue("Mutation read metrics for not found for " + tableName1,
    +                mutationReadMetricsMap.get(tableName1).size() > 0);
    +
    +        clearAllTestMetricMaps();
    --- End diff --
    
    no need to call this method unless you are checking any metrics after this.
    This automatically gets called in `@Before`


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by swaroopak <gi...@git.apache.org>.
Github user swaroopak commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214205225
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    --- End diff --
    
    This helper function gets called from both execute and executeUpdate. We need Statment reference to distinguish in case of execute


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214199323
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/monitoring/PhoenixLoggingMetricsIT.java ---
    @@ -154,6 +154,35 @@ private void verifyQueryLevelMetricsLogging(String query) throws SQLException {
             assertTrue(logRequestReadMetricsFuncCallCount == 1);
         }
     
    +    @Test
    +    public void testPhoenixMetricsLoggedOnAutoCommit() throws Exception {
    +        // Autocommit is turned on explicitly
    +        loggedConn.setAutoCommit(true);
    +        //with executeUpdate() method
    +        // run SELECT to verify read metrics are logged
    +        String query = "SELECT * FROM " + tableName1;
    +        verifyQueryLevelMetricsLogging(query);
    +        // run UPSERT SELECT to verify mutation metrics are logged
    +        String upsertSelect = "UPSERT INTO " + tableName2 + " SELECT * FROM " + tableName1;
    +        loggedConn.createStatement().executeUpdate(upsertSelect);
    +        // Autocommit is turned on explicitly
    +        // Hence mutation metrics are expected during implicit commit
    +        assertTrue("Mutation write metrics are not logged for " + tableName2,
    +                mutationWriteMetricsMap.size()  > 0);
    +        assertTrue("Mutation read metrics for not found for " + tableName1,
    +                mutationReadMetricsMap.get(tableName1).size() > 0);
    +        //with execute() method
    --- End diff --
    
    `clearAllTestMetricMaps()` should be called here to ensure we are getting metrics.


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r215059097
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    --- End diff --
    
    > In case of mutation, it directly executes executeMutation
    
    You can also provide a mutation through `execute()` method call.


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r214200113
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -59,4 +70,17 @@ public ResultSet getGeneratedKeys() throws SQLException {
             return new LoggingPhoenixResultSet(super.getGeneratedKeys(), phoenixMetricsLog, this.sql);
         }
     
    +    private void loggingAutoCommitHelper() throws SQLException {
    +        Connection conn = this.getConnection();
    +
    +        if(stmt.getUpdateOperation().isMutation() && conn.getAutoCommit()){
    --- End diff --
    
    Isn't `conn.getAutoCommit()` check sufficient?


---

[GitHub] phoenix pull request #338: PHOENIX-4870 LoggingPhoenixConnection should log ...

Posted by karanmehta93 <gi...@git.apache.org>.
Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/338#discussion_r215432475
  
    --- Diff: phoenix-core/src/main/java/org/apache/phoenix/jdbc/LoggingPhoenixStatement.java ---
    @@ -25,28 +28,38 @@
     
         private PhoenixMetricsLog phoenixMetricsLog;
         private String sql;
    -    
    -    public LoggingPhoenixStatement(Statement stmt, PhoenixMetricsLog phoenixMetricsLog) {
    +    private Connection conn;
    +
    +    public LoggingPhoenixStatement(Connection conn, Statement stmt, PhoenixMetricsLog phoenixMetricsLog) {
             super(stmt);
             this.phoenixMetricsLog = phoenixMetricsLog;
    +        this.conn = conn;
    --- End diff --
    
    same comment as above.


---