pt-query-digest doesn't parse MariaDB slow log extended stats correctly

Reported by Peter (Stig) Edwards on 2013-03-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Toolkit
Undecided
Unassigned

Bug Description

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:

# Thread_id: 123456 Schema: test QC_hit: Yes
...
# Full_scan: No Full_join: No Tmp_table: Yes Tmp_table_on_disk: Yes
# 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.

tags: added: mariadb pt-query-digest
summary: - query-digest slow query log extended statistics property names different
- with MariaDB
+ query-digest doesn't parse MariaDB slow log extended stats correctly
summary: - query-digest doesn't parse MariaDB slow log extended stats correctly
+ pt-query-digest doesn't parse MariaDB slow log extended stats correctly
Changed in percona-toolkit:
status: New → Confirmed

My colleagues came up with another approach:

my $filter = "\$event->{QC_Hit}=\$event->{QC_hit} and "
            ."\$event->{Disk_tmp_table}=\$event->{Tmp_table_on_disk} and "
            ."\$event->{Disk_filesort}=\$event->{Filesort_on_disk}";

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers