pt-query-digest doesn't parse MariaDB slow log extended stats correctly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
Confirmed
|
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_
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:/
also the query cache hit text is "QC_hit", note the case. These differ from what is expected. So when parsing in SlowLogParser:
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:
< @{$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_
> $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.
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} ";