lp:~percona-toolkit-dev/percona-toolkit/fix-929046-pt-qa-sub.001-lit.001-lit.002-fix
- Get this branch:
- bzr branch lp:~percona-toolkit-dev/percona-toolkit/fix-929046-pt-qa-sub.001-lit.001-lit.002-fix
Branch merges
- Daniel Nichter: Pending requested
- Brian Fraser: Pending requested
-
Diff: 143 lines (+43/-18)3 files modifiedbin/pt-query-advisor (+9/-9)
lib/QueryAdvisorRules.pm (+17/-8)
t/lib/QueryAdvisorRules.t (+17/-1)
Related bugs
Related blueprints
Branch information
- Owner:
- Percona Toolkit developers
- Status:
- Development
Recent revisions
- 473. By Brian Fraser
-
Fix for bug 929046: SUB.001, LIT.001 and LIT.002 are sensitive to program state
The original bug was about SUB.001, but LIT.00[12] were affected
as well. The bug boiled down to using //g on $event->{arg}, but
here's a simplified version:my $str = "abc in stuff";
# This will print "6"
say $str =~ /in/g ? pos($str) : "no match";
# This will print "no match"
say $str =~ /abc/g ? pos($str) : "no match";The second doesn't match because it will start from after
the "in" that the previous regex matched, at which point
it's too late to match abc.There's two solutions to this: First, to use lvalue pos() before
each match, ala pos($str) = 0; -- But that's doing a lot of
extra stuff to work around our own bug. The other solution,
and what this commit implements, is not using //g and pos() at all,
instead using the @+ variable. $+[0] already holds the data we need,
at no extra cost, and to boot makes things slightly faster.So what was previously
if ( $str =~ m/./g ) {
return pos($str)
}Is now
if ( $str =~ m/./ ) {
return $+[0];
} - 466. By Brian Fraser
-
Remove the @INC shifts from the test files. This is no longer needed since the tools do their %INC mangling
Branch metadata
- Branch format:
- Branch format 7
- Repository format:
- Bazaar repository format 2a (needs bzr 1.16 or later)
- Stacked on:
- lp:percona-toolkit/2.1