[ 
https://issues.apache.org/jira/browse/PHOENIX-5034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16709457#comment-16709457
 ] 

ASF GitHub Bot commented on PHOENIX-5034:
-----------------------------------------

Github user karanmehta93 commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/410#discussion_r238896069
  
    --- Diff: 
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java ---
    @@ -1774,11 +1778,20 @@ public QueryLogger 
createQueryLogger(CompilableStatement stmt, String sql) throw
                     }
                 }
             }
    -        QueryLogger queryLogger = 
QueryLogger.getInstance(connection,isSystemTable);
    -        QueryLoggerUtil.logInitialDetails(queryLogger, 
connection.getTenantId(),
    +
    +        QueryLogger queryLogger = 
QueryLogger.createInstance(connection,isSystemTable,
    +            isCriticalStatement(stmt));
    +        QueryLoggerUtil.logInitialDetails(queryLogger, 
connection.getTenantId(), 
                     connection.getQueryServices(), sql, getParameters());
    +        if (isCriticalStatement(stmt)) {
    +            queryLogger.sync(null, null);
    +        }
             return queryLogger;
         }
    +
    +    private boolean isCriticalStatement(CompilableStatement stmt) {
    --- End diff --
    
    On a second thought, How about logging every DML that is not a "Update 
statement"? 
    It might be an overkill if we have people creating tons of views though, 
but we could always drop those as well.


> Log all critical statements in SYSTEM.LOG table.
> ------------------------------------------------
>
>                 Key: PHOENIX-5034
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-5034
>             Project: Phoenix
>          Issue Type: Improvement
>            Reporter: Xu Cang
>            Assignee: Xu Cang
>            Priority: Minor
>         Attachments: PHOENIX-5034-4.x-HBase-1.3.001.patch, 
> PHOENIX-5034-4.x-HBase-1.3.002.patch, PHOENIX-5034-4.x-HBase-1.3.003.patch, 
> PHOENIX-5034-4.x-HBase-1.3.004.patch, PHOENIX-5034-4.x-HBase-1.3.005.patch
>
>
> In production, sometimes engineers see table got dropped unexpectedly. It's 
> not easy to SCAN raw table from HBase itself to understand what happened and 
> when the table get dropped.
> Since we already have SYSTEM.LOG query log facility in Phoenix that sampling 
> query statement (log 1% statement by default). It's good to always log 
> critical statements such as "DROP" or "ALTER" statements.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to