phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-5034) Log all critical statements in SYSTEM.LOG table.
Date Tue, 04 Dec 2018 02:11:00 GMT

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

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

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

    https://github.com/apache/phoenix/pull/409#discussion_r238508341
  
    --- Diff: phoenix-core/src/it/java/org/apache/phoenix/end2end/QueryLoggerIT.java ---
    @@ -250,7 +250,44 @@ public void testWithLoggingOFF() throws Exception{
             assertFalse(foundQueryLog);
             conn.close();
         }
    -    
    +
    +    @Test
    +    //DROP Table statement should be always logged.
    +    public void testDropTableStatement() throws Exception{
    +        String tableName = generateUniqueName();
    +        createTableAndInsertValues(tableName, true);
    +        Properties props= new Properties();
    +        props.setProperty(QueryServices.LOG_LEVEL, LogLevel.INFO.name());
    +        Connection conn = DriverManager.getConnection(getUrl(),props);
    +        assertEquals(conn.unwrap(PhoenixConnection.class).getLogLevel(),LogLevel.INFO);
    +
    +        String query = "SELECT * FROM " + tableName;
    +        ResultSet rs = conn.createStatement().executeQuery(query);
    +
    +        String query2 = "DROP TABLE " + tableName;
    +        conn.createStatement().execute(query2);
    +        while (rs.next()) {
    +            rs.getString(1);
    +            rs.getString(2);
    +        }
    +        String logQuery = "SELECT * FROM " + SYSTEM_CATALOG_SCHEMA + ".\"" + SYSTEM_LOG_TABLE
    +            + "\"";
    +        int delay = 5000;
    +
    +        // sleep for sometime to let query log committed
    +        Thread.sleep(delay);
    --- End diff --
    
    Instead of just waiting once and checking, use a retry logic for 10 times and wait 1 sec
for each iteration. This will make tests more reliable and possibly faster (if it syncs fast)


> 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)

Mime
View raw message