Uploaded image for project: 'Percona Toolkit'
  1. Percona Toolkit
  2. PT-1442

LP #1714630: pt-query-digest parses timestamps incorrectly from general log

    XMLWordPrintable

    Details

      Description

      **Reported in Launchpad by Nickolay Ihalainen last update 09-01-2018 17:38:40

      General log contains timestamps like: 2017-08-31T15:58:05.255051Z
      my $genlog_line_1= qr{
      \A
      (?\d

      {6}\s+\d{1,2}:\d\d:\d\d|\d{4}-\d{1,2}-\d{1,2}T\d\d:\d\d:\d\d\.\d+Z))? # Timestamp
      \s+
      (?:\s*(\d+)) # Thread ID
      \s
      (\w+) # Command
      \s+
      (.*) # Argument
      \Z
      }xs;


      It's not considered as proper TS or as mysql TS in parse_timestamp function and QPS always calculated as 0:
      $mysql_ts = qr/(\d\d)(\d\d)(\d\d) (\d)\d+)\d+)(\.\d+)?/;
      $proper_ts = qr/(\d\d\d\d)(\d\d)(\d\d)[T ](\d\d)\d\d)\d\d)(\.\d+)?/;

      Suggested fix remove Z from genlog_line_1:
      (?\d{6}

      \s+\d

      {1,2}:\d\d:\d\d|\d{4}-\d{1,2}

      -\d

      {1,2}

      T\d\d:\d\d:\d\d\.\d+))?Z? # Timestamp

      /opt/mysql/product/mysql/bin/mysqld, Version: 5.7.18-15-29.20-log (Percona XtraDB Cluster binary (GPL) 5.7.18-29.20, Revision 7693d6e, wsrep_29.20). started with:
      Tcp port: 3306 Unix socket: /opt/mysql/product/mysql/mysql3306.sock
      Time Id Command Argument
      2017-08-31T15:58:05.255051Z 2166396 Query SELECT 1
      2017-08-31T15:59:05.255051Z 2166396 Query SELECT 1

        Smart Checklist

          Attachments

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              lpjirasync lpjirasync (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: