diff --git a/bin/pt-query-digest b/bin/pt-query-digest index dabc4ba4..c286b265 100755 --- a/bin/pt-query-digest +++ b/bin/pt-query-digest @@ -14591,6 +14591,7 @@ sub main { Last_errno => 'string', Thread_id => 'string', InnoDB_trx_id => 'string', + Error_no => 'string', Killed => 'bool', }; diff --git a/lib/MySQLProtocolParser.pm b/lib/MySQLProtocolParser.pm index ba6e09da..75ba635e 100644 --- a/lib/MySQLProtocolParser.pm +++ b/lib/MySQLProtocolParser.pm @@ -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); } diff --git a/t/lib/MySQLProtocolParser.t b/t/lib/MySQLProtocolParser.t index 30be19a1..c4ffa839 100644 --- a/t/lib/MySQLProtocolParser.t +++ b/t/lib/MySQLProtocolParser.t @@ -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',