Description:
the mysqlbinlog command prepends statements extracted from the binlog with a header like this:
# at 207
#060125 2:13:34 server id 1 end_log_pos 299 Query thread_id=1 exec_time=0 error_code=1114
SHOW BINLOG EVENTS does not include the thread_id, exec_time, time of execution
and error_code information in its result table, so being a poor replacement for the mysqlbinlog
utility only
Especially the missing error_code entry can become a problem when trying to track
down replication problems
How to repeat:
emmit mysqlbinlog and SHOW BINLOG EVENTS commands for the same replication log
entry and compare the results provided
for example:
> show binlog events in 'linux-bin.000002' from 207 limit 1\G
*************************** 1. row ***************************
Log_name: linux-bin.000002
Pos: 207
Event_type: Query
Server_id: 1
End_log_pos: 299
Info: use `test`; insert into t select * from i
1 row in set (0.00 sec)
$ mysqlbinlog --start-position=207 --stop-position=208 /usr/local/mysql-5.0/var/linux-bin.000002
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
# at 207
#060125 2:13:34 server id 1 end_log_pos 299 Query thread_id=1 exec_time=0 error_code=1114
use test;
SET TIMESTAMP=1138151614;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
SET @@session.sql_mode=0;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8;
insert into t select * from i;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
Suggested fix:
include at least the error_code as an additional column in SHOW BINLOG EVENT output