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

LP #1149883: pt-query-digest doesn't parse MariaDB slow log extended stats correctly

    XMLWordPrintable

    Details

      Description

      **Reported in Launchpad by Peter (Stig) Edwards last update 19-03-2013 16:29:28

      Hello and thank you for percona-toolkit and pt-query-digest,

      With mariadb (version 5.3.12 at least) the slow query log extended statistics Query_plan verbosity logs:

      "Full_scan", "Full_join", "Tmp_table", "Tmp_table_on_disk", "Filesort", "Filesort_on_disk" and "Merge_passes"

      For exmaple:

      1. Thread_id: 123456 Schema: test QC_hit: Yes
        ...
      2. Full_scan: No Full_join: No Tmp_table: Yes Tmp_table_on_disk: Yes
      3. Filesort: Yes Filesort_on_disk: No Merge_passes: 0

      See: https://kb.askmonty.org/en/slow-query-log-extended-statistics/

      also the query cache hit text is "QC_hit", note the case. These differ from what is expected. So when parsing in SlowLogParser::parse_event in the branch for "some line with properties" I hacked it so that:

      Filesort_on_disk => Disk_filesort
      Tmp_table_on_disk => Disk_tmp_table
      QC_hit => QC_Hit

      when using mariadb:

      > if( 'Tmp_table_on_disk' eq $temp[$#temp-1] )

      { > $temp[$#temp-1] = 'Disk_tmp_table'; > }

      elsif ( 'Filesort_on_disk' eq $temp[2] )

      { > $temp[2] = 'Disk_filesort'; > }

      elsif ( 'QC_hit' eq $temp[$#temp-1] )

      { > $temp[$#temp-1] = 'QC_Hit' > }

      I also changed SlowLogWriter::write

      < @{$event}

      {qw(QC_Hit Full_scan Full_join Tmp_table Disk_tmp_table Filesort Disk_filesort Merge_passes)}

      ;
      > @{$event}

      {qw(QC_Hit Full_scan Full_join Tmp_table Tmp_table_on_disk Filesort Filesort_on_disk Merge_passes)}

      ;

      and set_history_options(), but I'm not sure if this was needed:

      > $attr =~ s/^QC_hit/QC_Hit/; # QC_hit is really QC_Hit

      I was thinking you could potentially branch on the global "version" or "version_comment" variable to account for this difference.

      http://www.percona.com/doc/percona-server/5.1/diagnostics/slow_extended.html?id=percona-server:features:slow_extended_51&redirect=2#query-plan-information

      Many thanks.

        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: