XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: 2.10.0
    • Fix Version/s: None
    • Component/s: None
    • Environment:

      OS: AWS Linux2

      MySQL: Percona-Server-8.0.19

      Description

      The current MySQL version used is Percona-Server-8.0.19, some slowlog formats have problems, and the results parsed by the slowlog agent are not expected. There is no investigation from the MySQL server source code level to see if there is a bug in slowlog. The slowlog sample and QAN dashborad screenshot are attached.

       


      The currently parsed SQL:

      • +([]log.Event) (len=1) {
        + (log.Event) {
        + Offset: (uint64) 211,
        + OffsetEnd: (uint64) 838,
        + Ts: (time.Time) 2020-09-28 22:00:29.413 +0900 +0900,
        + Admin: (bool) false,
        + Query: (string) (len=55) " Tmp_tables: 0 Tmp_disk_tables: 0 Tmp_table_sizes: 0",

      expected:

      • +([]log.Event) (len=1) {
        + (log.Event) {
        + Offset: (uint64) 211,
        + OffsetEnd: (uint64) 1791,
        + Ts: (time.Time) 2020-09-28 22:00:29.413 +0900 +0900,
        + Admin: (bool) false,
        + Query: (string) (len=614) "SELECT t.table_schema, t.table_name, column_name, `auto_increment`,\n pow(2, case data_type\n when 'tinyint' then 7\n when 'smallint' then 15\n when 'mediumint' then 23\n when 'int' then 31\n when 'bigint' then 63\n end+(column_type like '% unsigned'))-1 as max_int\n FROM information_schema.columns c\n STRAIGHT_JOIN information_schema.tables t\n ON BINARY t.table_schema = c.table_schema AND BINARY t.table_name = c.table_name",

       


       

      Fix:
      +++ b/agents/mysql/slowlog/parser/parser.go
      @@ -33,6 +33,7 @@ var (
      userRe = regexp.MustCompile(`User@Host: ([^\[]|[[^[]]).?@ (\S) [(.*)]`)
      schema = regexp.MustCompile(`Schema: +(.*?) +Last_errno:`)
      headerRe = regexp.MustCompile(`^#\s+[A-Z]`)
      + headerTRe = regexp.MustCompile(`^\s+Tmp_tables:`)
      metricsRe = regexp.MustCompile(`(\w+): (\S+|\z)`)
      adminRe = regexp.MustCompile(`command: (.+)`)
      setRe = regexp.MustCompile(`^SET (?:last_insert_id|insert_id|timestamp)`)
      @@ -168,7 +169,7 @@ func (p *SlowLogParser) Run() {
      func (p *SlowLogParser) parseHeader(line string) {
      p.logf("header")

        • if !headerRe.MatchString(line) {*
          + if !headerRe.MatchString(line) && !headerTRe.MatchString(line) {

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            zhiyong.huang huang zhiyong
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Smart Checklist