#At file:///home/daogangqu/mysql/bzrwork1/bug55790/mysql-next-mr-bugfixing/ based on revid:dao-gang.qu@stripped
3324 Dao-Gang.Qu@stripped 2010-10-22
Bug #55790 Read_Master_Log_Pos is wrong after Slave_IO_Error= ER_NET_PACKET_TOO_LARGE
When logging in row format, DML is written as a Table_map_event
followed by its row events. The Table_map_event is written to
the relay log by slave I/O thread even if its rows events are
discarded. But it is not displayed by MYSQLBINLOG. However,
the Read_Master_Log_Pos displayed by SHOW SLAVE STATUS is
at the end of the Table_map_Log_event.
After the patch, the header of the Table_map_log_event will
be displayed by MYSQLBINLOG so long as it was written to
the relay log even if its rows events are discarded. To
multi rows events in one statement, the headers of other
rows events also will be displayed if the last rows event
is discarded by slave I/O thread. And MYSQLBINLOG will print
a warning for the missed rows event.
@ client/mysqlbinlog.cc
Add code to print a warning if the head cache is nonempty
after a binlog has been processed.
@ mysql-test/suite/rpl/r/rpl_packet.result
Test result for Bug #55790
@ mysql-test/suite/rpl/t/rpl_packet.test
Added test to verify if the the Table_map_log_event will
be displayed by MYSQLBINLOG so long as it was written to
the relay log, even if its rows events are discarded. And
MYSQLBINLOG will print a warning for the missed rows event.
modified:
client/mysqlbinlog.cc
mysql-test/suite/rpl/r/rpl_packet.result
mysql-test/suite/rpl/t/rpl_packet.test
=== modified file 'client/mysqlbinlog.cc'
--- a/client/mysqlbinlog.cc 2010-09-01 02:51:08 +0000
+++ b/client/mysqlbinlog.cc 2010-10-22 08:28:30 +0000
@@ -1469,6 +1469,18 @@ static Exit_status dump_log_entries(cons
rc= (remote_opt ? dump_remote_log_entries(&print_event_info, logname) :
dump_local_log_entries(&print_event_info, logname));
+ if (my_b_tell(&print_event_info.head_cache))
+ {
+ copy_event_cache_to_file_and_reinit(&print_event_info.head_cache,
+ result_file);
+ warning("The range of printed events ends with a row event or "
+ "a table map event that does not have the STMT_END_F "
+ "flag set. This might be because the last statement "
+ "was not fully written to the log, or because you are "
+ "using a --stop-position or --stop-datetime that refers "
+ "to an event in the middle of a statement. The partial "
+ "event has not been written to output.");
+ }
/* Set delimiter back to semicolon */
if (!raw_mode)
{
=== modified file 'mysql-test/suite/rpl/r/rpl_packet.result'
--- a/mysql-test/suite/rpl/r/rpl_packet.result 2010-07-20 15:27:13 +0000
+++ b/mysql-test/suite/rpl/r/rpl_packet.result 2010-10-22 08:28:30 +0000
@@ -57,6 +57,30 @@ SHOW BINLOG EVENTS;
SET @max_allowed_packet_1= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_2= @@session.max_allowed_packet;
+START SLAVE;
+DROP TABLE t1;
+select @@global.max_allowed_packet;
+@@global.max_allowed_packet
+4096
+select @@global.net_buffer_length;
+@@global.net_buffer_length
+4096
+select @@global.max_allowed_packet;
+@@global.max_allowed_packet
+1024
+select @@global.net_buffer_length;
+@@global.net_buffer_length
+1024
+CREATE TABLE t1 (a TEXT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (REPEAT('a', 2048));
+# 1153 = ER_NET_PACKET_TOO_LARGE
+Last_IO_Error = Got a packet bigger than 'max_allowed_packet' bytes
+# Now Read_Master_Log_Pos is as following:
+Read_Master_Log_Pos 424
+# Test the Table_map_log_event is displayed at Read_Master_Log_Pos by MYSQLBINLOG
+Last event in relay log:
+#server id # end_log_pos 424 Table_map: `test`.`t1` mapped to number #
+WARNING: The range of printed events ends with a row event or a table map event that does not have the STMT_END_F flag set. This might be because the last statement was not fully written to the log, or because you are using a --stop-position or --stop-datetime that refers to an event in the middle of a statement. The partial event has not been written to output.
==== clean up ====
DROP TABLE t1;
SET @@global.max_allowed_packet= 1024;
=== modified file 'mysql-test/suite/rpl/t/rpl_packet.test'
--- a/mysql-test/suite/rpl/t/rpl_packet.test 2010-08-06 08:54:01 +0000
+++ b/mysql-test/suite/rpl/t/rpl_packet.test 2010-10-22 08:28:30 +0000
@@ -152,6 +152,57 @@ if (`SELECT NOT(@max_allowed_packet_0 =
--die @max_allowed_packet changed after executing SHOW BINLOG EVENTS
}
+#
+# BUG#55790
+# This test verifies if the the Table_map_log_event will
+# be displayed by MYSQLBINLOG so long as it was written
+# to the relay log, even if its rows events are discarded.
+# And MYSQLBINLOG will print a warning for the missed
+# rows event.
+#
+
+connection slave;
+START SLAVE;
+--source include/wait_for_slave_to_start.inc
+
+connection master;
+DROP TABLE t1;
+select @@global.max_allowed_packet;
+select @@global.net_buffer_length;
+sync_slave_with_master;
+select @@global.max_allowed_packet;
+select @@global.net_buffer_length;
+
+--connection master
+CREATE TABLE t1 (a TEXT) ENGINE=MyISAM;
+--sync_slave_with_master
+
+# Create big row event.
+--connection master
+INSERT INTO t1 VALUES (REPEAT('a', 2048));
+
+# Slave IO thread should stop with error when trying to read the big event.
+--connection slave
+--echo # 1153 = ER_NET_PACKET_TOO_LARGE
+--let $slave_io_errno= 1153
+--let $show_slave_io_error= 1
+--source include/wait_for_slave_io_error.inc
+
+--echo # Now Read_Master_Log_Pos is as following:
+--let $status_items= Read_Master_Log_Pos
+--source include/show_slave_status.inc
+
+--echo # Test the Table_map_log_event is displayed at Read_Master_Log_Pos by MYSQLBINLOG
+--let $MYSQLD_DATADIR= `SELECT @@datadir`
+--let $MYSQLD_TMPDIR= `select @@tmpdir`
+--echo Last event in relay log:
+--let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+--replace_regex /#[0-9]*[ ]*[0-9]*:[0-9]*:[0-9]* server id [0-9]*/#server id #/ /mapped to number [0-9]*/mapped to number #/
+exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file 2> $MYSQLD_TMPDIR/warning.txt
+ | grep 'end_log_pos'
+ | tail -n 1;
+--cat_file $MYSQLD_TMPDIR/warning.txt
+--remove_file $MYSQLD_TMPDIR/warning.txt
--echo ==== clean up ====
connection master;
Attachment: [text/bzr-bundle] bzr/dao-gang.qu@sun.com-20101022082830-s0wjgi2dgaux23c7.bundle
| Thread |
|---|
| • bzr commit into mysql-next-mr-bugfixing branch (Dao-Gang.Qu:3324) Bug#55790 | Dao-Gang.Qu | 22 Oct |