Only add Error_no to event if there is one. Don't stringify it either; set its type in pqd.

This commit is contained in:
Daniel Nichter
2013-02-01 10:26:45 -07:00
parent 9e7248861d
commit cf74cd791e
3 changed files with 11 additions and 7 deletions

View File

@@ -14591,6 +14591,7 @@ sub main {
Last_errno => 'string',
Thread_id => 'string',
InnoDB_trx_id => 'string',
Error_no => 'string',
Killed => 'bool',
};

View File

@@ -654,11 +654,14 @@ sub _packet_from_server {
}
$event = {
cmd => $com,
arg => $arg,
ts => $packet->{ts},
Error_no => $error->{errno} ? "#$error->{errno}" : 'none',
cmd => $com,
arg => $arg,
ts => $packet->{ts},
};
if ( $error->{errno} ) {
# https://bugs.launchpad.net/percona-toolkit/+bug/823411
$event->{Error_no} = $error->{errno};
}
$session->{attribs}->{Error_msg} = $error->{message};
return $self->_make_event($event, $packet, $session);
}

View File

@@ -177,7 +177,7 @@ test_protocol_parser(
pos_in_log => 0,
bytes => length('select 5 from foo'),
cmd => 'Query',
Error_no => "#1046",
Error_no => "1046",
Error_msg => 'No database selected',
Rows_affected => 0,
Warning_count => 0,
@@ -1659,7 +1659,7 @@ test_protocol_parser(
[
{
Error_msg => "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1",
Error_no => '#1064',
Error_no => '1064',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000316',
@@ -1679,7 +1679,7 @@ test_protocol_parser(
},
{
Error_msg => 'Unknown system variable \'nono\'',
Error_no => '#1193',
Error_no => '1193',
No_good_index_used => 'No',
No_index_used => 'No',
Query_time => '0.000329',