Merge fix-1176010-pqd-grouping-quoted-vals.

This commit is contained in:
Daniel Nichter
2013-06-26 16:10:41 -07:00
4 changed files with 109 additions and 8836 deletions

View File

@@ -13252,7 +13252,10 @@ sub main {
process => sub { process => sub {
my ( $args ) = @_; my ( $args ) = @_;
my $event = $pl->parse_event(code => $code); my $event = $pl->parse_event(code => $code);
$args->{event} = $event if $event; if ( $event ) {
sanitize_event($event);
$args->{event} = $event;
}
return $args; return $args;
}, },
); );
@@ -13313,6 +13316,7 @@ sub main {
stats => $args->{stats}, stats => $args->{stats},
); );
if ( $event ) { if ( $event ) {
sanitize_event($event);
$args->{event} = $event; $args->{event} = $event;
return $args; return $args;
} }
@@ -14567,6 +14571,23 @@ sub save_resume_offset {
return; return;
} }
sub sanitize_event {
my ($event) = @_;
# Quoted and unquoted values should be treated the same
# https://bugs.launchpad.net/percona-toolkit/+bug/1176010
if ( $event->{db} ) {
$event->{db} =~ s/^`//;
$event->{db} =~ s/`$//;
}
if ( $event->{Schema} ) {
$event->{Schema} =~ s/^`//;
$event->{Schema} =~ s/`$//;
}
return;
}
sub _d { sub _d {
my ($package, undef, $line) = caller 0; my ($package, undef, $line) = caller 0;
@_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; } @_ = map { (my $temp = $_) =~ s/\n/\n# /g; $temp; }

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,52 @@
# Query 1: 0 QPS, 0x concurrency, ID 0xAA353644DE4C4CB4 at byte 434 ______
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.02
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 50 2
# Exec time 91 19ms 2us 19ms 9ms 19ms 13ms 9ms
# Lock time 100 9ms 0 9ms 5ms 9ms 7ms 5ms
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 0 0 0 0 0 0 0 0
# Query size 65 54 27 27 27 27 0 27
# String:
# Databases db
# Hosts
# Users meow
# Query_time distribution
# 1us ################################################################
# 10us
# 100us
# 1ms
# 10ms ################################################################
# 100ms
# 1s
# 10s+
administrator command: Quit\G
# Query 2: 0 QPS, 0x concurrency, ID 0xCC47B42511EA22DD at byte 662 ______
# This item is included in the report because it matches --limit.
# Scores: V/M = 0.00
# Attribute pct total min max avg 95% stddev median
# ============ === ======= ======= ======= ======= ======= ======= =======
# Count 50 2
# Exec time 8 2ms 899us 899us 899us 899us 0 899us
# Lock time 0 0 0 0 0 0 0 0
# Rows sent 0 0 0 0 0 0 0 0
# Rows examine 0 0 0 0 0 0 0 0
# Query size 34 28 14 14 14 14 0 14
# String:
# Databases db
# Hosts
# Users meow
# Query_time distribution
# 1us
# 10us
# 100us ################################################################
# 1ms
# 10ms
# 100ms
# 1s
# 10s+
SET NAMES utf8\G

View File

@@ -393,6 +393,18 @@ ok(
'Analysis for slow056 (no query bug 1082599)' 'Analysis for slow056 (no query bug 1082599)'
); );
# #############################################################################
# Bug 1176010: pt-query-digest should know how to group quoted and unquoted database names
# https://bugs.launchpad.net/percona-toolkit/+bug/1176010
#############################################################################
ok(
no_diff(
sub { pt_query_digest::main(@args, $sample.'slow057.txt') },
"t/pt-query-digest/samples/slow057.txt",
),
'Analysis for slow057 (no grouping bug 1176010)'
);
# ############################################################################# # #############################################################################
# Done. # Done.
# ############################################################################# # #############################################################################