Merge lp:~percona-toolkit-dev/percona-toolkit/fix-923896 into lp:percona-toolkit/2.1

Proposed by Brian Fraser
Status: Merged
Merged at revision: 270
Proposed branch: lp:~percona-toolkit-dev/percona-toolkit/fix-923896
Merge into: lp:percona-toolkit/2.1
Diff against target: 92 lines (+38/-1)
3 files modified
bin/pt-kill (+2/-0)
lib/Processlist.pm (+2/-0)
t/lib/Processlist.t (+34/-1)
To merge this branch: bzr merge lp:~percona-toolkit-dev/percona-toolkit/fix-923896
Reviewer Review Type Date Requested Status
Brian Fraser (community) Approve
Daniel Nichter Approve
Review via email: mp+107643@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Daniel Nichter (daniel-nichter) wrote :

The new tests need to be more descriptive than "ok !$@;".

review: Needs Fixing
270. By Brian Fraser <email address hidden>

Name the tests for 923896's fix

Revision history for this message
Daniel Nichter (daniel-nichter) :
review: Approve
Revision history for this message
Daniel Nichter (daniel-nichter) :
review: Approve
Revision history for this message
Brian Fraser (fraserbn) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bin/pt-kill'
--- bin/pt-kill 2012-05-24 17:25:20 +0000
+++ bin/pt-kill 2012-05-30 14:42:19 +0000
@@ -2177,6 +2177,7 @@
2177 }2177 }
21782178
2179 if ( $find_spec{busy_time} && ($query->{Command} || '') eq 'Query' ) {2179 if ( $find_spec{busy_time} && ($query->{Command} || '') eq 'Query' ) {
2180 next QUERY unless defined $query->{Time};
2180 if ( $query->{Time} < $find_spec{busy_time} ) {2181 if ( $query->{Time} < $find_spec{busy_time} ) {
2181 PTDEBUG && _d("Query isn't running long enough");2182 PTDEBUG && _d("Query isn't running long enough");
2182 next QUERY;2183 next QUERY;
@@ -2186,6 +2187,7 @@
2186 }2187 }
21872188
2188 if ( $find_spec{idle_time} && ($query->{Command} || '') eq 'Sleep' ) {2189 if ( $find_spec{idle_time} && ($query->{Command} || '') eq 'Sleep' ) {
2190 next QUERY unless defined $query->{Time};
2189 if ( $query->{Time} < $find_spec{idle_time} ) {2191 if ( $query->{Time} < $find_spec{idle_time} ) {
2190 PTDEBUG && _d("Query isn't idle long enough");2192 PTDEBUG && _d("Query isn't idle long enough");
2191 next QUERY;2193 next QUERY;
21922194
=== modified file 'lib/Processlist.pm'
--- lib/Processlist.pm 2012-01-19 19:46:56 +0000
+++ lib/Processlist.pm 2012-05-30 14:42:19 +0000
@@ -470,6 +470,7 @@
470470
471 # Match special busy_time.471 # Match special busy_time.
472 if ( $find_spec{busy_time} && ($query->{Command} || '') eq 'Query' ) {472 if ( $find_spec{busy_time} && ($query->{Command} || '') eq 'Query' ) {
473 next QUERY unless defined($query->{Time});
473 if ( $query->{Time} < $find_spec{busy_time} ) {474 if ( $query->{Time} < $find_spec{busy_time} ) {
474 PTDEBUG && _d("Query isn't running long enough");475 PTDEBUG && _d("Query isn't running long enough");
475 next QUERY;476 next QUERY;
@@ -480,6 +481,7 @@
480481
481 # Match special idle_time.482 # Match special idle_time.
482 if ( $find_spec{idle_time} && ($query->{Command} || '') eq 'Sleep' ) {483 if ( $find_spec{idle_time} && ($query->{Command} || '') eq 'Sleep' ) {
484 next QUERY unless defined($query->{Time});
483 if ( $query->{Time} < $find_spec{idle_time} ) {485 if ( $query->{Time} < $find_spec{idle_time} ) {
484 PTDEBUG && _d("Query isn't idle long enough");486 PTDEBUG && _d("Query isn't idle long enough");
485 next QUERY;487 next QUERY;
486488
=== modified file 't/lib/Processlist.t'
--- t/lib/Processlist.t 2012-03-06 13:56:08 +0000
+++ t/lib/Processlist.t 2012-05-30 14:42:19 +0000
@@ -9,7 +9,7 @@
9use strict;9use strict;
10use warnings FATAL => 'all';10use warnings FATAL => 'all';
11use English qw(-no_match_vars);11use English qw(-no_match_vars);
12use Test::More tests => 32;12use Test::More tests => 34;
1313
14use Processlist;14use Processlist;
15use PerconaTest;15use PerconaTest;
@@ -828,6 +828,39 @@
828);828);
829829
830# #############################################################################830# #############################################################################
831# https://bugs.launchpad.net/percona-toolkit/+bug/923896
832# #############################################################################
833
834%find_spec = (
835 busy_time => 1,
836 ignore => {},
837 match => {},
838);
839my $proc = { 'Time' => undef,
840 'Command' => 'Query',
841 'db' => undef,
842 'Id' => '7',
843 'Info' => undef,
844 'User' => 'msandbox',
845 'State' => '',
846 'Host' => 'localhost'
847 };
848
849local $@;
850eval { $pl->find([$proc], %find_spec) };
851ok !$@,
852 "Bug 923896: NULL Time in processlist doesn't fail for busy_time+Command=Query";
853
854delete $find_spec{busy_time};
855$find_spec{idle_time} = 1;
856$proc->{Command} = 'Sleep';
857
858local $@;
859eval { $pl->find([$proc], %find_spec) };
860ok !$@,
861 "Bug 923896: NULL Time in processlist doesn't fail for idle_time+Command=Sleep";
862
863# #############################################################################
831# Done.864# Done.
832# #############################################################################865# #############################################################################
833exit;866exit;

Subscribers

People subscribed via source and target branches