mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-21 03:14:58 +00:00
Fix for 923896
This commit is contained in:
@@ -2177,6 +2177,7 @@ sub find {
|
||||
}
|
||||
|
||||
if ( $find_spec{busy_time} && ($query->{Command} || '') eq 'Query' ) {
|
||||
next QUERY unless defined $query->{Time};
|
||||
if ( $query->{Time} < $find_spec{busy_time} ) {
|
||||
PTDEBUG && _d("Query isn't running long enough");
|
||||
next QUERY;
|
||||
@@ -2186,6 +2187,7 @@ sub find {
|
||||
}
|
||||
|
||||
if ( $find_spec{idle_time} && ($query->{Command} || '') eq 'Sleep' ) {
|
||||
next QUERY unless defined $query->{Time};
|
||||
if ( $query->{Time} < $find_spec{idle_time} ) {
|
||||
PTDEBUG && _d("Query isn't idle long enough");
|
||||
next QUERY;
|
||||
|
@@ -470,6 +470,7 @@ sub find {
|
||||
|
||||
# Match special busy_time.
|
||||
if ( $find_spec{busy_time} && ($query->{Command} || '') eq 'Query' ) {
|
||||
next QUERY unless defined($query->{Time});
|
||||
if ( $query->{Time} < $find_spec{busy_time} ) {
|
||||
PTDEBUG && _d("Query isn't running long enough");
|
||||
next QUERY;
|
||||
@@ -480,6 +481,7 @@ sub find {
|
||||
|
||||
# Match special idle_time.
|
||||
if ( $find_spec{idle_time} && ($query->{Command} || '') eq 'Sleep' ) {
|
||||
next QUERY unless defined($query->{Time});
|
||||
if ( $query->{Time} < $find_spec{idle_time} ) {
|
||||
PTDEBUG && _d("Query isn't idle long enough");
|
||||
next QUERY;
|
||||
|
@@ -9,7 +9,7 @@ BEGIN {
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use English qw(-no_match_vars);
|
||||
use Test::More tests => 32;
|
||||
use Test::More tests => 34;
|
||||
|
||||
use Processlist;
|
||||
use PerconaTest;
|
||||
@@ -827,6 +827,37 @@ is_deeply(
|
||||
"Find all queries that aren't ignored"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# https://bugs.launchpad.net/percona-toolkit/+bug/923896
|
||||
# #############################################################################
|
||||
|
||||
%find_spec = (
|
||||
busy_time => 1,
|
||||
ignore => {},
|
||||
match => {},
|
||||
);
|
||||
my $proc = { 'Time' => undef,
|
||||
'Command' => 'Query',
|
||||
'db' => undef,
|
||||
'Id' => '7',
|
||||
'Info' => undef,
|
||||
'User' => 'msandbox',
|
||||
'State' => '',
|
||||
'Host' => 'localhost'
|
||||
};
|
||||
|
||||
local $@;
|
||||
eval { $pl->find([$proc], %find_spec) };
|
||||
ok !$@;
|
||||
|
||||
delete $find_spec{busy_time};
|
||||
$find_spec{idle_time} = 1;
|
||||
$proc->{Command} = 'Sleep';
|
||||
|
||||
local $@;
|
||||
eval { $pl->find([$proc], %find_spec) };
|
||||
ok !$@;
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user