mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-20 10:55:01 +00:00
Fix for 823431: pt-query-advisor hangs on big queries
This was caused by a regex backtracking itself to a halt. The solution was to add a positive lookahead that searches for the floating but mandatory substrings that the regex needs; if those exist, then eventually it will match, but if they don't, it'll fail quickly.
This commit is contained in:
@@ -9,7 +9,9 @@ BEGIN {
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More tests => 2;
|
||||
use Test::More;
|
||||
|
||||
use File::Spec;
|
||||
|
||||
use PerconaTest;
|
||||
shift @INC; # These two shifts are required for tools that use base and
|
||||
@@ -39,7 +41,29 @@ like(
|
||||
"Parse genlog"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# pt-query-advisor hangs on big queries
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/823431
|
||||
# #############################################################################
|
||||
|
||||
my $exit_status;
|
||||
$output = output(
|
||||
sub { $exit_status = pt_query_advisor::main(@args,
|
||||
File::Spec->catfile($sample, "bug_823431.log"))
|
||||
});
|
||||
|
||||
ok(
|
||||
!$exit_status,
|
||||
"Bug 823431: pqa doesn't hang on a big query"
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/COL.002/,
|
||||
"Bug 823431: pqa doesn't hang on a big query and finds the correct rule"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
exit;
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user