Commit f8758031 authored by Luis Soares's avatar Luis Soares

BUG#50018: binlog corruption when table has many columns

For tables with metadata sizes ranging from 251 to 255 the size
of the event data (m_data_size) was being improperly calculated
in the Table_map_log_event constructor. This was due to the fact
that when writing the Table_map_log_event body (in
Table_map_log_event::write_data_body) a call to net_store_length
is made for packing the m_field_metadata_size. It happens that
net_store_length uses *one* byte for storing
m_field_metadata_size when it is smaller than 251 but *three*
bytes when it exceeds that value. BUG 42749 had already
pinpointed and fix this fact, but the fix was incomplete, as the
calculation in the Table_map_log_event constructor considers 255
instead of 251 as the threshold to increment m_data_size by
three. Thence, the window for having a mismatch between the
number of bytes written and the number of bytes accounted in the
event length (m_data_size) was left open for
m_field_metadata_size values between 251 and 255.

We fix this by changing the condition in the Table_map_log_event
constructor to match the one in the net_store_length, ie,
increment one byte if m_field_metadata_size < 251 and three if it
exceeds this value.

mysql-test/suite/rpl/r/rpl_row_tbl_metadata.result:
  Updated result file.
mysql-test/suite/rpl/t/rpl_row_tbl_metadata.test:
  Changes to the original test case: added slave and moved
  file into the rpl suite.
  
  New test case: replicates two tables one with 250 and 
  another with 252 metadata sizes. This exercises the usage
  of 1 or 3 bytes while packing the m_field_metadata_size.
sql/log_event.cc:
  Made the m_data_size calculation for the table map log event
  to match the number of bytes used while packing the 
  m_field_metadata_size value (according to net_store_length
  function in pack.c).
parent be397eb4
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
RESET MASTER;
DROP TABLE IF EXISTS `t1`;
### TABLE with field_metadata_size == 290
CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(30) NOT NULL,
......@@ -154,3 +161,277 @@ INSERT INTO `t1` VALUES ('1','1','1','1','1','1','1','1','1','1','1','1','1','1'
DROP TABLE `t1`;
FLUSH LOGS;
=== Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail.
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
### TABLE with field_metadata_size == 250
CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(30) NOT NULL,
`c3` varchar(30) DEFAULT NULL,
`c4` varchar(30) DEFAULT NULL,
`c5` varchar(30) DEFAULT NULL,
`c6` varchar(30) DEFAULT NULL,
`c7` varchar(30) DEFAULT NULL,
`c8` varchar(30) DEFAULT NULL,
`c9` varchar(30) DEFAULT NULL,
`c10` varchar(30) DEFAULT NULL,
`c11` varchar(30) DEFAULT NULL,
`c12` varchar(30) DEFAULT NULL,
`c13` varchar(30) DEFAULT NULL,
`c14` varchar(30) DEFAULT NULL,
`c15` varchar(30) DEFAULT NULL,
`c16` varchar(30) DEFAULT NULL,
`c17` varchar(30) DEFAULT NULL,
`c18` varchar(30) DEFAULT NULL,
`c19` varchar(30) DEFAULT NULL,
`c20` varchar(30) DEFAULT NULL,
`c21` varchar(30) DEFAULT NULL,
`c22` varchar(30) DEFAULT NULL,
`c23` varchar(30) DEFAULT NULL,
`c24` varchar(30) DEFAULT NULL,
`c25` varchar(30) DEFAULT NULL,
`c26` varchar(30) DEFAULT NULL,
`c27` varchar(30) DEFAULT NULL,
`c28` varchar(30) DEFAULT NULL,
`c29` varchar(30) DEFAULT NULL,
`c30` varchar(30) DEFAULT NULL,
`c31` varchar(30) DEFAULT NULL,
`c32` varchar(30) DEFAULT NULL,
`c33` varchar(30) DEFAULT NULL,
`c34` varchar(30) DEFAULT NULL,
`c35` varchar(30) DEFAULT NULL,
`c36` varchar(30) DEFAULT NULL,
`c37` varchar(30) DEFAULT NULL,
`c38` varchar(30) DEFAULT NULL,
`c39` varchar(30) DEFAULT NULL,
`c40` varchar(30) DEFAULT NULL,
`c41` varchar(30) DEFAULT NULL,
`c42` varchar(30) DEFAULT NULL,
`c43` varchar(30) DEFAULT NULL,
`c44` varchar(30) DEFAULT NULL,
`c45` varchar(30) DEFAULT NULL,
`c46` varchar(30) DEFAULT NULL,
`c47` varchar(30) DEFAULT NULL,
`c48` varchar(30) DEFAULT NULL,
`c49` varchar(30) DEFAULT NULL,
`c50` varchar(30) DEFAULT NULL,
`c51` varchar(30) DEFAULT NULL,
`c52` varchar(30) DEFAULT NULL,
`c53` varchar(30) DEFAULT NULL,
`c54` varchar(30) DEFAULT NULL,
`c55` varchar(30) DEFAULT NULL,
`c56` varchar(30) DEFAULT NULL,
`c57` varchar(30) DEFAULT NULL,
`c58` varchar(30) DEFAULT NULL,
`c59` varchar(30) DEFAULT NULL,
`c60` varchar(30) DEFAULT NULL,
`c61` varchar(30) DEFAULT NULL,
`c62` varchar(30) DEFAULT NULL,
`c63` varchar(30) DEFAULT NULL,
`c64` varchar(30) DEFAULT NULL,
`c65` varchar(30) DEFAULT NULL,
`c66` varchar(30) DEFAULT NULL,
`c67` varchar(30) DEFAULT NULL,
`c68` varchar(30) DEFAULT NULL,
`c69` varchar(30) DEFAULT NULL,
`c70` varchar(30) DEFAULT NULL,
`c71` varchar(30) DEFAULT NULL,
`c72` varchar(30) DEFAULT NULL,
`c73` varchar(30) DEFAULT NULL,
`c74` varchar(30) DEFAULT NULL,
`c75` varchar(30) DEFAULT NULL,
`c76` varchar(30) DEFAULT NULL,
`c77` varchar(30) DEFAULT NULL,
`c78` varchar(30) DEFAULT NULL,
`c79` varchar(30) DEFAULT NULL,
`c80` varchar(30) DEFAULT NULL,
`c81` varchar(30) DEFAULT NULL,
`c82` varchar(30) DEFAULT NULL,
`c83` varchar(30) DEFAULT NULL,
`c84` varchar(30) DEFAULT NULL,
`c85` varchar(30) DEFAULT NULL,
`c86` varchar(30) DEFAULT NULL,
`c87` varchar(30) DEFAULT NULL,
`c88` varchar(30) DEFAULT NULL,
`c89` varchar(30) DEFAULT NULL,
`c90` varchar(30) DEFAULT NULL,
`c91` varchar(30) DEFAULT NULL,
`c92` varchar(30) DEFAULT NULL,
`c93` varchar(30) DEFAULT NULL,
`c94` varchar(30) DEFAULT NULL,
`c95` varchar(30) DEFAULT NULL,
`c96` varchar(30) DEFAULT NULL,
`c97` varchar(30) DEFAULT NULL,
`c98` varchar(30) DEFAULT NULL,
`c99` varchar(30) DEFAULT NULL,
`c100` varchar(30) DEFAULT NULL,
`c101` varchar(30) DEFAULT NULL,
`c102` varchar(30) DEFAULT NULL,
`c103` varchar(30) DEFAULT NULL,
`c104` varchar(30) DEFAULT NULL,
`c105` varchar(30) DEFAULT NULL,
`c106` varchar(30) DEFAULT NULL,
`c107` varchar(30) DEFAULT NULL,
`c108` varchar(30) DEFAULT NULL,
`c109` varchar(30) DEFAULT NULL,
`c110` varchar(30) DEFAULT NULL,
`c111` varchar(30) DEFAULT NULL,
`c112` varchar(30) DEFAULT NULL,
`c113` varchar(30) DEFAULT NULL,
`c114` varchar(30) DEFAULT NULL,
`c115` varchar(30) DEFAULT NULL,
`c116` varchar(30) DEFAULT NULL,
`c117` varchar(30) DEFAULT NULL,
`c118` varchar(30) DEFAULT NULL,
`c119` varchar(30) DEFAULT NULL,
`c120` varchar(30) DEFAULT NULL,
`c121` varchar(30) DEFAULT NULL,
`c122` varchar(30) DEFAULT NULL,
`c123` varchar(30) DEFAULT NULL,
`c124` varchar(30) DEFAULT NULL,
`c125` varchar(30) DEFAULT NULL,
`c126` varchar(30) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB;
### TABLE with field_metadata_size == 251
CREATE TABLE `t2` (
`c1` float,
`c2` varchar(30) NOT NULL,
`c3` varchar(30) DEFAULT NULL,
`c4` varchar(30) DEFAULT NULL,
`c5` varchar(30) DEFAULT NULL,
`c6` varchar(30) DEFAULT NULL,
`c7` varchar(30) DEFAULT NULL,
`c8` varchar(30) DEFAULT NULL,
`c9` varchar(30) DEFAULT NULL,
`c10` varchar(30) DEFAULT NULL,
`c11` varchar(30) DEFAULT NULL,
`c12` varchar(30) DEFAULT NULL,
`c13` varchar(30) DEFAULT NULL,
`c14` varchar(30) DEFAULT NULL,
`c15` varchar(30) DEFAULT NULL,
`c16` varchar(30) DEFAULT NULL,
`c17` varchar(30) DEFAULT NULL,
`c18` varchar(30) DEFAULT NULL,
`c19` varchar(30) DEFAULT NULL,
`c20` varchar(30) DEFAULT NULL,
`c21` varchar(30) DEFAULT NULL,
`c22` varchar(30) DEFAULT NULL,
`c23` varchar(30) DEFAULT NULL,
`c24` varchar(30) DEFAULT NULL,
`c25` varchar(30) DEFAULT NULL,
`c26` varchar(30) DEFAULT NULL,
`c27` varchar(30) DEFAULT NULL,
`c28` varchar(30) DEFAULT NULL,
`c29` varchar(30) DEFAULT NULL,
`c30` varchar(30) DEFAULT NULL,
`c31` varchar(30) DEFAULT NULL,
`c32` varchar(30) DEFAULT NULL,
`c33` varchar(30) DEFAULT NULL,
`c34` varchar(30) DEFAULT NULL,
`c35` varchar(30) DEFAULT NULL,
`c36` varchar(30) DEFAULT NULL,
`c37` varchar(30) DEFAULT NULL,
`c38` varchar(30) DEFAULT NULL,
`c39` varchar(30) DEFAULT NULL,
`c40` varchar(30) DEFAULT NULL,
`c41` varchar(30) DEFAULT NULL,
`c42` varchar(30) DEFAULT NULL,
`c43` varchar(30) DEFAULT NULL,
`c44` varchar(30) DEFAULT NULL,
`c45` varchar(30) DEFAULT NULL,
`c46` varchar(30) DEFAULT NULL,
`c47` varchar(30) DEFAULT NULL,
`c48` varchar(30) DEFAULT NULL,
`c49` varchar(30) DEFAULT NULL,
`c50` varchar(30) DEFAULT NULL,
`c51` varchar(30) DEFAULT NULL,
`c52` varchar(30) DEFAULT NULL,
`c53` varchar(30) DEFAULT NULL,
`c54` varchar(30) DEFAULT NULL,
`c55` varchar(30) DEFAULT NULL,
`c56` varchar(30) DEFAULT NULL,
`c57` varchar(30) DEFAULT NULL,
`c58` varchar(30) DEFAULT NULL,
`c59` varchar(30) DEFAULT NULL,
`c60` varchar(30) DEFAULT NULL,
`c61` varchar(30) DEFAULT NULL,
`c62` varchar(30) DEFAULT NULL,
`c63` varchar(30) DEFAULT NULL,
`c64` varchar(30) DEFAULT NULL,
`c65` varchar(30) DEFAULT NULL,
`c66` varchar(30) DEFAULT NULL,
`c67` varchar(30) DEFAULT NULL,
`c68` varchar(30) DEFAULT NULL,
`c69` varchar(30) DEFAULT NULL,
`c70` varchar(30) DEFAULT NULL,
`c71` varchar(30) DEFAULT NULL,
`c72` varchar(30) DEFAULT NULL,
`c73` varchar(30) DEFAULT NULL,
`c74` varchar(30) DEFAULT NULL,
`c75` varchar(30) DEFAULT NULL,
`c76` varchar(30) DEFAULT NULL,
`c77` varchar(30) DEFAULT NULL,
`c78` varchar(30) DEFAULT NULL,
`c79` varchar(30) DEFAULT NULL,
`c80` varchar(30) DEFAULT NULL,
`c81` varchar(30) DEFAULT NULL,
`c82` varchar(30) DEFAULT NULL,
`c83` varchar(30) DEFAULT NULL,
`c84` varchar(30) DEFAULT NULL,
`c85` varchar(30) DEFAULT NULL,
`c86` varchar(30) DEFAULT NULL,
`c87` varchar(30) DEFAULT NULL,
`c88` varchar(30) DEFAULT NULL,
`c89` varchar(30) DEFAULT NULL,
`c90` varchar(30) DEFAULT NULL,
`c91` varchar(30) DEFAULT NULL,
`c92` varchar(30) DEFAULT NULL,
`c93` varchar(30) DEFAULT NULL,
`c94` varchar(30) DEFAULT NULL,
`c95` varchar(30) DEFAULT NULL,
`c96` varchar(30) DEFAULT NULL,
`c97` varchar(30) DEFAULT NULL,
`c98` varchar(30) DEFAULT NULL,
`c99` varchar(30) DEFAULT NULL,
`c100` varchar(30) DEFAULT NULL,
`c101` varchar(30) DEFAULT NULL,
`c102` varchar(30) DEFAULT NULL,
`c103` varchar(30) DEFAULT NULL,
`c104` varchar(30) DEFAULT NULL,
`c105` varchar(30) DEFAULT NULL,
`c106` varchar(30) DEFAULT NULL,
`c107` varchar(30) DEFAULT NULL,
`c108` varchar(30) DEFAULT NULL,
`c109` varchar(30) DEFAULT NULL,
`c110` varchar(30) DEFAULT NULL,
`c111` varchar(30) DEFAULT NULL,
`c112` varchar(30) DEFAULT NULL,
`c113` varchar(30) DEFAULT NULL,
`c114` varchar(30) DEFAULT NULL,
`c115` varchar(30) DEFAULT NULL,
`c116` varchar(30) DEFAULT NULL,
`c117` varchar(30) DEFAULT NULL,
`c118` varchar(30) DEFAULT NULL,
`c119` varchar(30) DEFAULT NULL,
`c120` varchar(30) DEFAULT NULL,
`c121` varchar(30) DEFAULT NULL,
`c122` varchar(30) DEFAULT NULL,
`c123` varchar(30) DEFAULT NULL,
`c124` varchar(30) DEFAULT NULL,
`c125` varchar(30) DEFAULT NULL,
`c126` varchar(30) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES ('1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1');
LOCK TABLES `t2` WRITE;
INSERT INTO `t2` VALUES ('1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1');
DROP TABLE `t1`;
DROP TABLE `t2`;
FLUSH LOGS;
=== Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail.
......@@ -2,27 +2,33 @@
# BUG#42749: infinite loop writing to row based binlog - processlist shows
# "freeing items"
#
# BUG#50018: binlog corruption when table has many columns
#
# WHY
# ===
#
# This bug would make table map event to report data_written one byte less
# than what would actually be written in its body. This would cause one byte shorter
# event end_log_pos. The ultimate impact was that it would make fixing the
# position in MYSQL_BIN_LOG::write_cache bogus or end up in an infinite loop.
# This bug would make table map event to report data_written one
# byte less than what would actually be written in its body. This
# would cause one byte shorter event end_log_pos. The ultimate
# impact was that it would make fixing the position in
# MYSQL_BIN_LOG::write_cache bogus or end up in an infinite loop.
#
# HOW
# ===
#
# Checking that the patch fixes the problem is done as follows:
# i) a table with several fields is created;
#
# i) tables with several fields is created (above and below a 251
# metadata size threshold)
# ii) an insert is performed;
# iii) the logs are flushed;
# iv) mysqlbinlog is used to check if it succeeds.
#
# In step iv), before the bug was fixed, the test case would fail with
# mysqlbinlog reporting that it was unable to succeed in reading the event.
#
# In step iv), before the bug was fixed, the test case would fail
# with mysqlbinlog reporting that it was unable to succeed in
# reading the event.
-- source include/master-slave.inc
-- source include/have_log_bin.inc
-- source include/have_innodb.inc
-- source include/have_binlog_format_row.inc
......@@ -34,6 +40,7 @@ RESET MASTER;
DROP TABLE IF EXISTS `t1`;
-- enable_warnings
-- echo ### TABLE with field_metadata_size == 290
CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(30) NOT NULL,
......@@ -192,8 +199,322 @@ DROP TABLE `t1`;
FLUSH LOGS;
-- sync_slave_with_master
-- connection master
-- echo === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail.
-- let $MYSQLD_DATADIR= `SELECT @@datadir`;
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog
-- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog
-- source include/master-slave-reset.inc
-- connection master
# Create two tables one with field_metadata_size == 250
# and another one with field_metadata_size == 252
#
# Each varchar field takes up to 2 metadata bytes, see:
#
# Field_varstring::do_save_field_metadata (field.cc)
#
# The integer field takes 0 bytes, see:
#
# Field::do_save_field_metadata (field.h)
#
# The float field takes 1 byte, see:
#
# Field_float::do_save_field_metadata (field.cc)
#
# We choose 250 and 252 which are the ones below and above
# the threshold for switching to use 1 or 3 bytes for the
# m_data_size increment.
#
-- echo ### TABLE with field_metadata_size == 250
CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(30) NOT NULL,
`c3` varchar(30) DEFAULT NULL,
`c4` varchar(30) DEFAULT NULL,
`c5` varchar(30) DEFAULT NULL,
`c6` varchar(30) DEFAULT NULL,
`c7` varchar(30) DEFAULT NULL,
`c8` varchar(30) DEFAULT NULL,
`c9` varchar(30) DEFAULT NULL,
`c10` varchar(30) DEFAULT NULL,
`c11` varchar(30) DEFAULT NULL,
`c12` varchar(30) DEFAULT NULL,
`c13` varchar(30) DEFAULT NULL,
`c14` varchar(30) DEFAULT NULL,
`c15` varchar(30) DEFAULT NULL,
`c16` varchar(30) DEFAULT NULL,
`c17` varchar(30) DEFAULT NULL,
`c18` varchar(30) DEFAULT NULL,
`c19` varchar(30) DEFAULT NULL,
`c20` varchar(30) DEFAULT NULL,
`c21` varchar(30) DEFAULT NULL,
`c22` varchar(30) DEFAULT NULL,
`c23` varchar(30) DEFAULT NULL,
`c24` varchar(30) DEFAULT NULL,
`c25` varchar(30) DEFAULT NULL,
`c26` varchar(30) DEFAULT NULL,
`c27` varchar(30) DEFAULT NULL,
`c28` varchar(30) DEFAULT NULL,
`c29` varchar(30) DEFAULT NULL,
`c30` varchar(30) DEFAULT NULL,
`c31` varchar(30) DEFAULT NULL,
`c32` varchar(30) DEFAULT NULL,
`c33` varchar(30) DEFAULT NULL,
`c34` varchar(30) DEFAULT NULL,
`c35` varchar(30) DEFAULT NULL,
`c36` varchar(30) DEFAULT NULL,
`c37` varchar(30) DEFAULT NULL,
`c38` varchar(30) DEFAULT NULL,
`c39` varchar(30) DEFAULT NULL,
`c40` varchar(30) DEFAULT NULL,
`c41` varchar(30) DEFAULT NULL,
`c42` varchar(30) DEFAULT NULL,
`c43` varchar(30) DEFAULT NULL,
`c44` varchar(30) DEFAULT NULL,
`c45` varchar(30) DEFAULT NULL,
`c46` varchar(30) DEFAULT NULL,
`c47` varchar(30) DEFAULT NULL,
`c48` varchar(30) DEFAULT NULL,
`c49` varchar(30) DEFAULT NULL,
`c50` varchar(30) DEFAULT NULL,
`c51` varchar(30) DEFAULT NULL,
`c52` varchar(30) DEFAULT NULL,
`c53` varchar(30) DEFAULT NULL,
`c54` varchar(30) DEFAULT NULL,
`c55` varchar(30) DEFAULT NULL,
`c56` varchar(30) DEFAULT NULL,
`c57` varchar(30) DEFAULT NULL,
`c58` varchar(30) DEFAULT NULL,
`c59` varchar(30) DEFAULT NULL,
`c60` varchar(30) DEFAULT NULL,
`c61` varchar(30) DEFAULT NULL,
`c62` varchar(30) DEFAULT NULL,
`c63` varchar(30) DEFAULT NULL,
`c64` varchar(30) DEFAULT NULL,
`c65` varchar(30) DEFAULT NULL,
`c66` varchar(30) DEFAULT NULL,
`c67` varchar(30) DEFAULT NULL,
`c68` varchar(30) DEFAULT NULL,
`c69` varchar(30) DEFAULT NULL,
`c70` varchar(30) DEFAULT NULL,
`c71` varchar(30) DEFAULT NULL,
`c72` varchar(30) DEFAULT NULL,
`c73` varchar(30) DEFAULT NULL,
`c74` varchar(30) DEFAULT NULL,
`c75` varchar(30) DEFAULT NULL,
`c76` varchar(30) DEFAULT NULL,
`c77` varchar(30) DEFAULT NULL,
`c78` varchar(30) DEFAULT NULL,
`c79` varchar(30) DEFAULT NULL,
`c80` varchar(30) DEFAULT NULL,
`c81` varchar(30) DEFAULT NULL,
`c82` varchar(30) DEFAULT NULL,
`c83` varchar(30) DEFAULT NULL,
`c84` varchar(30) DEFAULT NULL,
`c85` varchar(30) DEFAULT NULL,
`c86` varchar(30) DEFAULT NULL,
`c87` varchar(30) DEFAULT NULL,
`c88` varchar(30) DEFAULT NULL,
`c89` varchar(30) DEFAULT NULL,
`c90` varchar(30) DEFAULT NULL,
`c91` varchar(30) DEFAULT NULL,
`c92` varchar(30) DEFAULT NULL,
`c93` varchar(30) DEFAULT NULL,
`c94` varchar(30) DEFAULT NULL,
`c95` varchar(30) DEFAULT NULL,
`c96` varchar(30) DEFAULT NULL,
`c97` varchar(30) DEFAULT NULL,
`c98` varchar(30) DEFAULT NULL,
`c99` varchar(30) DEFAULT NULL,
`c100` varchar(30) DEFAULT NULL,
`c101` varchar(30) DEFAULT NULL,
`c102` varchar(30) DEFAULT NULL,
`c103` varchar(30) DEFAULT NULL,
`c104` varchar(30) DEFAULT NULL,
`c105` varchar(30) DEFAULT NULL,
`c106` varchar(30) DEFAULT NULL,
`c107` varchar(30) DEFAULT NULL,
`c108` varchar(30) DEFAULT NULL,
`c109` varchar(30) DEFAULT NULL,
`c110` varchar(30) DEFAULT NULL,
`c111` varchar(30) DEFAULT NULL,
`c112` varchar(30) DEFAULT NULL,
`c113` varchar(30) DEFAULT NULL,
`c114` varchar(30) DEFAULT NULL,
`c115` varchar(30) DEFAULT NULL,
`c116` varchar(30) DEFAULT NULL,
`c117` varchar(30) DEFAULT NULL,
`c118` varchar(30) DEFAULT NULL,
`c119` varchar(30) DEFAULT NULL,
`c120` varchar(30) DEFAULT NULL,
`c121` varchar(30) DEFAULT NULL,
`c122` varchar(30) DEFAULT NULL,
`c123` varchar(30) DEFAULT NULL,
`c124` varchar(30) DEFAULT NULL,
`c125` varchar(30) DEFAULT NULL,
`c126` varchar(30) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB;
-- echo ### TABLE with field_metadata_size == 251
CREATE TABLE `t2` (
`c1` float,
`c2` varchar(30) NOT NULL,
`c3` varchar(30) DEFAULT NULL,
`c4` varchar(30) DEFAULT NULL,
`c5` varchar(30) DEFAULT NULL,
`c6` varchar(30) DEFAULT NULL,
`c7` varchar(30) DEFAULT NULL,
`c8` varchar(30) DEFAULT NULL,
`c9` varchar(30) DEFAULT NULL,
`c10` varchar(30) DEFAULT NULL,
`c11` varchar(30) DEFAULT NULL,
`c12` varchar(30) DEFAULT NULL,
`c13` varchar(30) DEFAULT NULL,
`c14` varchar(30) DEFAULT NULL,
`c15` varchar(30) DEFAULT NULL,
`c16` varchar(30) DEFAULT NULL,
`c17` varchar(30) DEFAULT NULL,
`c18` varchar(30) DEFAULT NULL,
`c19` varchar(30) DEFAULT NULL,
`c20` varchar(30) DEFAULT NULL,
`c21` varchar(30) DEFAULT NULL,
`c22` varchar(30) DEFAULT NULL,
`c23` varchar(30) DEFAULT NULL,
`c24` varchar(30) DEFAULT NULL,
`c25` varchar(30) DEFAULT NULL,
`c26` varchar(30) DEFAULT NULL,
`c27` varchar(30) DEFAULT NULL,
`c28` varchar(30) DEFAULT NULL,
`c29` varchar(30) DEFAULT NULL,
`c30` varchar(30) DEFAULT NULL,
`c31` varchar(30) DEFAULT NULL,
`c32` varchar(30) DEFAULT NULL,
`c33` varchar(30) DEFAULT NULL,
`c34` varchar(30) DEFAULT NULL,
`c35` varchar(30) DEFAULT NULL,
`c36` varchar(30) DEFAULT NULL,
`c37` varchar(30) DEFAULT NULL,
`c38` varchar(30) DEFAULT NULL,
`c39` varchar(30) DEFAULT NULL,
`c40` varchar(30) DEFAULT NULL,
`c41` varchar(30) DEFAULT NULL,
`c42` varchar(30) DEFAULT NULL,
`c43` varchar(30) DEFAULT NULL,
`c44` varchar(30) DEFAULT NULL,
`c45` varchar(30) DEFAULT NULL,
`c46` varchar(30) DEFAULT NULL,
`c47` varchar(30) DEFAULT NULL,
`c48` varchar(30) DEFAULT NULL,
`c49` varchar(30) DEFAULT NULL,
`c50` varchar(30) DEFAULT NULL,
`c51` varchar(30) DEFAULT NULL,
`c52` varchar(30) DEFAULT NULL,
`c53` varchar(30) DEFAULT NULL,
`c54` varchar(30) DEFAULT NULL,
`c55` varchar(30) DEFAULT NULL,
`c56` varchar(30) DEFAULT NULL,
`c57` varchar(30) DEFAULT NULL,
`c58` varchar(30) DEFAULT NULL,
`c59` varchar(30) DEFAULT NULL,
`c60` varchar(30) DEFAULT NULL,
`c61` varchar(30) DEFAULT NULL,
`c62` varchar(30) DEFAULT NULL,
`c63` varchar(30) DEFAULT NULL,
`c64` varchar(30) DEFAULT NULL,
`c65` varchar(30) DEFAULT NULL,
`c66` varchar(30) DEFAULT NULL,
`c67` varchar(30) DEFAULT NULL,
`c68` varchar(30) DEFAULT NULL,
`c69` varchar(30) DEFAULT NULL,
`c70` varchar(30) DEFAULT NULL,
`c71` varchar(30) DEFAULT NULL,
`c72` varchar(30) DEFAULT NULL,
`c73` varchar(30) DEFAULT NULL,
`c74` varchar(30) DEFAULT NULL,
`c75` varchar(30) DEFAULT NULL,
`c76` varchar(30) DEFAULT NULL,
`c77` varchar(30) DEFAULT NULL,
`c78` varchar(30) DEFAULT NULL,
`c79` varchar(30) DEFAULT NULL,
`c80` varchar(30) DEFAULT NULL,
`c81` varchar(30) DEFAULT NULL,
`c82` varchar(30) DEFAULT NULL,
`c83` varchar(30) DEFAULT NULL,
`c84` varchar(30) DEFAULT NULL,
`c85` varchar(30) DEFAULT NULL,
`c86` varchar(30) DEFAULT NULL,
`c87` varchar(30) DEFAULT NULL,
`c88` varchar(30) DEFAULT NULL,
`c89` varchar(30) DEFAULT NULL,
`c90` varchar(30) DEFAULT NULL,
`c91` varchar(30) DEFAULT NULL,
`c92` varchar(30) DEFAULT NULL,
`c93` varchar(30) DEFAULT NULL,
`c94` varchar(30) DEFAULT NULL,
`c95` varchar(30) DEFAULT NULL,
`c96` varchar(30) DEFAULT NULL,
`c97` varchar(30) DEFAULT NULL,
`c98` varchar(30) DEFAULT NULL,
`c99` varchar(30) DEFAULT NULL,
`c100` varchar(30) DEFAULT NULL,
`c101` varchar(30) DEFAULT NULL,
`c102` varchar(30) DEFAULT NULL,
`c103` varchar(30) DEFAULT NULL,
`c104` varchar(30) DEFAULT NULL,
`c105` varchar(30) DEFAULT NULL,
`c106` varchar(30) DEFAULT NULL,
`c107` varchar(30) DEFAULT NULL,
`c108` varchar(30) DEFAULT NULL,
`c109` varchar(30) DEFAULT NULL,
`c110` varchar(30) DEFAULT NULL,
`c111` varchar(30) DEFAULT NULL,
`c112` varchar(30) DEFAULT NULL,
`c113` varchar(30) DEFAULT NULL,
`c114` varchar(30) DEFAULT NULL,
`c115` varchar(30) DEFAULT NULL,
`c116` varchar(30) DEFAULT NULL,
`c117` varchar(30) DEFAULT NULL,
`c118` varchar(30) DEFAULT NULL,
`c119` varchar(30) DEFAULT NULL,
`c120` varchar(30) DEFAULT NULL,
`c121` varchar(30) DEFAULT NULL,
`c122` varchar(30) DEFAULT NULL,
`c123` varchar(30) DEFAULT NULL,
`c124` varchar(30) DEFAULT NULL,
`c125` varchar(30) DEFAULT NULL,
`c126` varchar(30) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB;
LOCK TABLES `t1` WRITE;
INSERT INTO `t1` VALUES ('1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1');
LOCK TABLES `t2` WRITE;
INSERT INTO `t2` VALUES ('1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1');
DROP TABLE `t1`;
DROP TABLE `t2`;
FLUSH LOGS;
-- sync_slave_with_master
-- connection master
-- echo === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail.
-- let $MYSQLD_DATADIR= `SELECT @@datadir`;
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog
-- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog
-- source include/master-slave-end.inc
......@@ -7925,10 +7925,10 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
plus one or three bytes (see pack.c:net_store_length) for number of
elements in the field metadata array.
*/
if (m_field_metadata_size > 255)
m_data_size+= m_field_metadata_size + 3;
else
if (m_field_metadata_size < 251)
m_data_size+= m_field_metadata_size + 1;
else
m_data_size+= m_field_metadata_size + 3;
bzero(m_null_bits, num_null_bytes);
for (unsigned int i= 0 ; i < m_table->s->fields ; ++i)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment