Processlist.pm: parse_event assumed that STATE couldn't be NULL.

Probably an oversight, since the rest of the library already
dealt with that by treating it as an empty string.
This commit is contained in:
Brian Fraser
2012-07-19 11:06:17 -03:00
parent 2b1c36d6f6
commit 28894c3f1e
4 changed files with 35 additions and 7 deletions

View File

@@ -2222,7 +2222,7 @@ sub parse_event {
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
{ $curr->[STATE] => 0 }, # PROFILE
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
}
@@ -2236,7 +2236,7 @@ sub parse_event {
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
{ $curr->[STATE] => 0 }, # PROFILE
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
}

View File

@@ -2398,7 +2398,7 @@ sub parse_event {
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
{ $curr->[STATE] => 0 }, # PROFILE
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
}
@@ -2412,7 +2412,7 @@ sub parse_event {
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
{ $curr->[STATE] => 0 }, # PROFILE
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
}

View File

@@ -278,7 +278,7 @@ sub parse_event {
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
{ $curr->[STATE] => 0 }, # PROFILE
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
}
@@ -293,7 +293,7 @@ sub parse_event {
int($query_start), # START
$etime, # ETIME
$time, # FSEEN
{ $curr->[STATE] => 0 }, # PROFILE
{ ($curr->[STATE] || "") => 0 }, # PROFILE
];
}
}

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 34;
use Test::More tests => 35;
use Processlist;
use PerconaTest;
@@ -860,6 +860,34 @@ eval { $pl->find([$proc], %find_spec) };
ok !$@,
"Bug 923896: NULL Time in processlist doesn't fail for idle_time+Command=Sleep";
# #############################################################################
# NULL STATE doesn't generate warnings
# https://bugs.launchpad.net/percona-toolkit/+bug/821703
# #############################################################################
$procs = [
[ [1, 'unauthenticated user', 'localhost', undef, 'Connect', 7,
'some state', 1] ],
[ [1, 'unauthenticated user', 'localhost', undef, 'Connect', 8,
undef, 2] ],
],
eval {
parse_n_times(
2,
code => sub {
return shift @$procs;
},
time => Transformers::unix_timestamp('2001-01-01 00:05:00'),
);
};
is(
$EVAL_ERROR,
'',
"NULL STATE shouldn't cause warnings"
);
# #############################################################################
# Done.
# #############################################################################