Commit 58530329 authored by Luis Soares's avatar Luis Soares

BUG#50018: binlog corruption when table has many columns

Some improvements on the test case as suggested during review.
parent f8758031
...@@ -4,7 +4,6 @@ reset master; ...@@ -4,7 +4,6 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
RESET MASTER;
DROP TABLE IF EXISTS `t1`; DROP TABLE IF EXISTS `t1`;
### TABLE with field_metadata_size == 290 ### TABLE with field_metadata_size == 290
CREATE TABLE `t1` ( CREATE TABLE `t1` (
...@@ -157,9 +156,11 @@ CREATE TABLE `t1` ( ...@@ -157,9 +156,11 @@ CREATE TABLE `t1` (
PRIMARY KEY (`c1`) PRIMARY KEY (`c1`)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
LOCK TABLES `t1` WRITE; 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','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'); INSERT INTO `t1`(c2) VALUES ('1');
DROP TABLE `t1`;
FLUSH LOGS; FLUSH LOGS;
### assertion: the slave replicated event successfully and tables match
Comparing tables master:test.t1 and slave:test.t1
DROP TABLE `t1`;
=== Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail. === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail.
stop slave; stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
...@@ -167,271 +168,39 @@ reset master; ...@@ -167,271 +168,39 @@ reset master;
reset slave; reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave; start slave;
### TABLE with field_metadata_size == 250 ### action: generating several tables with different metadata
CREATE TABLE `t1` ( ### sizes (resorting to perl)
`c1` int(11) NOT NULL AUTO_INCREMENT, ### testing table with 249 field metadata size.
`c2` varchar(30) NOT NULL, ### testing table with 250 field metadata size.
`c3` varchar(30) DEFAULT NULL, ### testing table with 251 field metadata size.
`c4` varchar(30) DEFAULT NULL, ### testing table with 252 field metadata size.
`c5` varchar(30) DEFAULT NULL, ### testing table with 253 field metadata size.
`c6` varchar(30) DEFAULT NULL, ### testing table with 254 field metadata size.
`c7` varchar(30) DEFAULT NULL, ### testing table with 255 field metadata size.
`c8` varchar(30) DEFAULT NULL, ### testing table with 256 field metadata size.
`c9` varchar(30) DEFAULT NULL, ### testing table with 257 field metadata size.
`c10` varchar(30) DEFAULT NULL, ### testing table with 258 field metadata size.
`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; FLUSH LOGS;
=== Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail. ### assertion: the slave replicated event successfully and tables match for t10
Comparing tables master:test.t10 and slave:test.t10
### assertion: the slave replicated event successfully and tables match for t9
Comparing tables master:test.t9 and slave:test.t9
### assertion: the slave replicated event successfully and tables match for t8
Comparing tables master:test.t8 and slave:test.t8
### assertion: the slave replicated event successfully and tables match for t7
Comparing tables master:test.t7 and slave:test.t7
### assertion: the slave replicated event successfully and tables match for t6
Comparing tables master:test.t6 and slave:test.t6
### assertion: the slave replicated event successfully and tables match for t5
Comparing tables master:test.t5 and slave:test.t5
### assertion: the slave replicated event successfully and tables match for t4
Comparing tables master:test.t4 and slave:test.t4
### assertion: the slave replicated event successfully and tables match for t3
Comparing tables master:test.t3 and slave:test.t3
### assertion: the slave replicated event successfully and tables match for t2
Comparing tables master:test.t2 and slave:test.t2
### assertion: the slave replicated event successfully and tables match for t1
Comparing tables master:test.t1 and slave:test.t1
### assertion: check that binlog is not corrupt. Using mysqlbinlog to
### detect failure. Before the patch mysqlbinlog would find
### a corrupted event, thence would fail.
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# BUG#42749: infinite loop writing to row based binlog - processlist shows # BUG#42749: infinite loop writing to row based binlog - processlist shows
# "freeing items" # "freeing items"
# #
# BUG#50018: binlog corruption when table has many columns
# #
# WHY # WHY
# === # ===
...@@ -18,8 +17,7 @@ ...@@ -18,8 +17,7 @@
# #
# Checking that the patch fixes the problem is done as follows: # Checking that the patch fixes the problem is done as follows:
# #
# i) tables with several fields is created (above and below a 251 # i) one table with m_field_metadata sized at 290
# metadata size threshold)
# ii) an insert is performed; # ii) an insert is performed;
# iii) the logs are flushed; # iii) the logs are flushed;
# iv) mysqlbinlog is used to check if it succeeds. # iv) mysqlbinlog is used to check if it succeeds.
...@@ -29,12 +27,8 @@ ...@@ -29,12 +27,8 @@
# reading the event. # reading the event.
-- source include/master-slave.inc -- source include/master-slave.inc
-- source include/have_log_bin.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_binlog_format_row.inc -- source include/have_binlog_format_row.inc
-- connection default
RESET MASTER;
-- disable_warnings -- disable_warnings
DROP TABLE IF EXISTS `t1`; DROP TABLE IF EXISTS `t1`;
...@@ -192,13 +186,20 @@ CREATE TABLE `t1` ( ...@@ -192,13 +186,20 @@ CREATE TABLE `t1` (
) ENGINE=InnoDB; ) ENGINE=InnoDB;
LOCK TABLES `t1` WRITE; LOCK TABLES `t1` WRITE;
INSERT INTO `t1`(c2) VALUES ('1');
FLUSH LOGS;
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','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'); -- sync_slave_with_master
-- connection master
DROP TABLE `t1`; -- echo ### assertion: the slave replicated event successfully and tables match
-- let $diff_table_1=master:test.t1
-- let $diff_table_2=slave:test.t1
-- source include/diff_tables.inc
FLUSH LOGS; DROP TABLE `t1`;
-- connection master
-- sync_slave_with_master -- sync_slave_with_master
-- connection master -- connection master
...@@ -208,313 +209,132 @@ FLUSH LOGS; ...@@ -208,313 +209,132 @@ FLUSH LOGS;
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog -- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog
-- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog -- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug42749.binlog
#############################################################
# BUG#50018: binlog corruption when table has many columns
#
# Same test from BUG#42749, but now we generate some SQL which
# creates and inserts into tables with metadata size from 249
# to 258.
#
# The test works as follows:
# 1. SQL for several CREATE TABLE and INSERTS are generated
# into a file.
# 2. This file is then "sourced"
# 3. The slave is synchronized with the master
# 4. FLUSH LOGS on master
# 5. Compare tables on master and slave.
# 6. run mysqlbinlog on master's binary log
#
# Steps #5 and #6 assert that binary log is not corrupted
# in both cases: when slave is replaying events and when
# mysqlbinlog is used to read the binary log
-- source include/master-slave-reset.inc -- source include/master-slave-reset.inc
-- connection master -- connection master
# Create two tables one with field_metadata_size == 250 # Create several tables with field_metadata_size ranging
# and another one with field_metadata_size == 252 # from 249 to 258 (so that we cover 251 and 255 range).
# This should exercise the switch between using 1 or 3
# bytes to pack m_field_metadata_size.
# #
# Each varchar field takes up to 2 metadata bytes, see: # Each varchar field takes up to 2 metadata bytes, see:
# #
# Field_varstring::do_save_field_metadata (field.cc) # 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: # The float field takes 1 byte, see:
# #
# Field_float::do_save_field_metadata (field.cc) # 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 -- let $generated_sql= $MYSQLTEST_VARDIR/tmp/b50018.sql
-- let B50018_FILE= $generated_sql
CREATE TABLE `t1` ( -- echo ### action: generating several tables with different metadata
`c1` int(11) NOT NULL AUTO_INCREMENT, -- echo ### sizes (resorting to perl)
`c2` varchar(30) NOT NULL, -- perl
`c3` varchar(30) DEFAULT NULL, my $file= $ENV{'B50018_FILE'};
`c4` varchar(30) DEFAULT NULL, open(FILE, ">", "$file") or die "Unable to open bug 50018 generated SQL file: $!" ;
`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 my $tables= "";
my $ntables= 10;
my $base_ncols= 124;
CREATE TABLE `t2` ( for my $i (1..$ntables)
`c1` float, {
`c2` varchar(30) NOT NULL, my $ncols= $base_ncols + $i;
`c3` varchar(30) DEFAULT NULL, my $metadata_size= $ncols_variable * 2 + 1;
`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; print FILE "-- echo ### testing table with " . ($base_ncols*2 + $i) . " field metadata size.\n";
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'); print FILE "CREATE TABLE t$i (\n";
for my $n (1..$base_ncols)
{
print FILE "c$n VARCHAR(30) NOT NULL DEFAULT 'BUG#50018',\n";
}
for my $n (1..$i)
{
print FILE "c" . ($base_ncols+$n) . " FLOAT NOT NULL DEFAULT 0";
if ($n < $i)
{
print FILE ",\n";
}
}
LOCK TABLES `t2` WRITE; print FILE ") Engine=InnoDB;\n";
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`; $tables.= " t$i WRITE";
DROP TABLE `t2`; if ($i < $ntables)
{
$tables .=",";
}
print FILE "LOCK TABLES t$i WRITE;\n";
print FILE "INSERT INTO t$i(c". ($base_ncols+1) . ") VALUES (50018);\n";
}
FLUSH LOGS; close(FILE);
-- sync_slave_with_master EOF
## we don't need this in the result file
## however, for debugging purposes you
## may want to reactivate query logging
-- disable_query_log
-- source $generated_sql
UNLOCK TABLES;
-- enable_query_log
-- sync_slave_with_master
-- connection master -- connection master
-- echo === Using mysqlbinlog to detect failure. Before the patch mysqlbinlog would find a corrupted event, thence would fail. FLUSH LOGS;
-- let $ntables=10
while($ntables)
{
-- echo ### assertion: the slave replicated event successfully and tables match for t$ntables
-- let $diff_table_1=master:test.t$ntables
-- let $diff_table_2=slave:test.t$ntables
-- source include/diff_tables.inc
-- connection master
-- disable_query_log
-- eval DROP TABLE t$ntables
-- enable_query_log
-- sync_slave_with_master
-- connection master
-- dec $ntables
}
-- echo ### assertion: check that binlog is not corrupt. Using mysqlbinlog to
-- echo ### detect failure. Before the patch mysqlbinlog would find
-- echo ### a corrupted event, thence would fail.
-- let $MYSQLD_DATADIR= `SELECT @@datadir`; -- let $MYSQLD_DATADIR= `SELECT @@datadir`;
-- exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog -- exec $MYSQL_BINLOG -v --hex $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog
-- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog
## clean up
## For debugging purposes you might want not to remove these
-- remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug50018.binlog
-- remove_file $generated_sql
-- source include/master-slave-end.inc -- source include/master-slave-end.inc
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