diff --git a/bin/pt-query-digest b/bin/pt-query-digest index cc2c7cfe..85004473 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -13239,6 +13239,11 @@ sub print_reports { ); if ( $o->get('report') ) { + # XXX There's a bug here: --expected-range '','' will cause + # Use of uninitialized value in numeric lt (<) + # This bug is intentionally left unfixed at the moment because + # we exploit it to test a more serious bug: an infinite loop: + # https://bugs.launchpad.net/percona-toolkit/+bug/888114 my $expected_range = $o->get('expected-range'); my $explain_why = $expected_range && ( @$worst < $expected_range->[0] diff --git a/t/pt-query-digest/continue_on_error.t b/t/pt-query-digest/continue_on_error.t index 2590c3bb..096a230a 100644 --- a/t/pt-query-digest/continue_on_error.t +++ b/t/pt-query-digest/continue_on_error.t @@ -9,9 +9,12 @@ BEGIN { use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); -use Test::More tests => 2; +use Test::More tests => 3; use PerconaTest; +shift @INC; # our unshift (above) +shift @INC; # PerconaTest's unshift +require "$trunk/bin/pt-query-digest"; my $output; @@ -30,6 +33,25 @@ like( 'Continues on error by default' ); +# ############################################################################# +# Infinite loop in pt-query-digest if a report crashe +# https://bugs.launchpad.net/percona-toolkit/+bug/888114 +# ############################################################################# + +# This bug is due to the fact that --continue-on-error is on by default. +# To reproduce the problem, we must intentionally crash pt-query-digest +# in the right place, which means we're using another bug:a +$output = output( + sub { pt_query_digest::main("$trunk/t/lib/samples/slowlogs/slow002.txt", + "--expected-range", "'',''") }, + stderr => 1, +); + +like( + $output, + qr/Query\s+1/, + "No infinite loop in report crashes (bug 888114)" +); # ############################################################################# # Done.