From 620c4878b31273e83c0f4494f3c8e5be608e8a3b Mon Sep 17 00:00:00 2001 From: Sven Sandberg Date: Fri, 18 Jul 2008 13:34:19 +0200 Subject: [PATCH] BUG#38178: rpl_loaddata_map fails sporadically in pushbuild Problem: master binlog has 'create table t1'. Master binlog was removed before slave could replicate it. In test's cleanup code, master did 'drop table t1', which caused slave sql thread to stop with an error since slave sql thread did not know about t1. Fix: t1 is just an auxiliary construction, only needed on master. Hence, we turn off binlogging before t1 is created, drop t1 as soon as we don't need it anymore, and then turn on binlogging again. mysql-test/include/show_binlog_events.inc: Filter out directories and block_len from LOAD DATA INFILE events. mysql-test/suite/rpl/r/rpl_loaddata_map.result: updated result file mysql-test/suite/rpl/t/rpl_loaddata_map.test: Turn off binlogging while t1 is used, drop t1 as soon as we don't need it anymore, and turn on binlogging again. Also added some comments and replaced 'show binlog events' by 'source include/show_binlog_events.inc'. --- mysql-test/include/show_binlog_events.inc | 4 +- .../suite/rpl/r/rpl_loaddata_map.result | 21 +++++---- mysql-test/suite/rpl/t/rpl_loaddata_map.test | 47 +++++++++++++------ 3 files changed, 48 insertions(+), 24 deletions(-) diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index a80dc75df7d..68f913a16a3 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -4,7 +4,7 @@ if (!$binlog_start) { let $binlog_start=106; } ---replace_result $binlog_start +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start --replace_column 2 # 4 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ --eval show binlog events from $binlog_start diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_map.result b/mysql-test/suite/rpl/r/rpl_loaddata_map.result index 7078389c987..901f3352b44 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_map.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_map.result @@ -4,6 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +==== Create a big file ==== +==== Load our big file into a table ==== create table t2 (id int not null primary key auto_increment); select @@session.read_buffer_size - @@session.max_allowed_packet > 0 ; @@session.read_buffer_size - @@session.max_allowed_packet > 0 @@ -12,15 +14,18 @@ load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2; select count(*) from t2 /* 5 000 */; count(*) 5000 -show binlog events in 'master-bin.000002' from ; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000002 # Query # # use `test`; create table t2 (id int not null primary key auto_increment) -master-bin.000002 # Begin_load_query # # ;file_id=#;block_len=# -master-bin.000002 # Append_block # # ;file_id=#;block_len=# -master-bin.000002 # Append_block # # ;file_id=#;block_len=# -master-bin.000002 # Execute_load_query # # use `test`; load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2 ;file_id=# +master-bin.000001 # Query # # use `test`; create table t2 (id int not null primary key auto_increment) +master-bin.000001 # Begin_load_query # # ;file_id=#;block_len=# +master-bin.000001 # Append_block # # ;file_id=#;block_len=# +master-bin.000001 # Append_block # # ;file_id=#;block_len=# +master-bin.000001 # Execute_load_query # # use `test`; load data infile 'MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2 ;file_id=# +==== Verify results on slave ==== +[on slave] select count(*) from t2 /* 5 000 */; count(*) 5000 -drop table t1, t2; -end of the tests +==== Clean up ==== +[on master] +drop table t2; diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map.test b/mysql-test/suite/rpl/t/rpl_loaddata_map.test index 6a8378c8fdc..ddee9e7e989 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_map.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map.test @@ -1,7 +1,16 @@ +# ==== Purpose ==== # # check replication of load data with the server parameters subjected to # read_buffer_size > max_allowed_packet # +# ==== Implementation ==== +# +# Insert many rows into t1, write t1 to file. +# Load the file into t2. +# See that t2 came out as expected on slave. +# +# ==== Related Bugs ==== +# # BUG#30435 loading large LOAD DATA INFILE breaks slave with # read_buffer_size set on master # BUG#33413 show binlog events fails if binlog has event size of close @@ -9,10 +18,17 @@ source include/have_binlog_format_mixed_or_statement.inc; source include/master-slave.inc; -source include/have_innodb.inc; -source include/have_binlog_format_mixed_or_statement.inc; + + +--echo ==== Create a big file ==== + +# We turn off binlogging to avoid too much noise in the binlog. t1 is +# just an auxiliary construction anyways, it is not needed on the +# slave. --disable_query_log +SET @@sql_log_bin= 0; + let $rows= 5000; create table t1 (id int not null primary key auto_increment); @@ -22,10 +38,13 @@ while($rows) dec $rows; } eval select * into outfile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' from t1; -flush logs; + +DROP TABLE t1; +SET @@sql_log_bin= 1; --enable_query_log -connection master; + +--echo ==== Load our big file into a table ==== create table t2 (id int not null primary key auto_increment); select @@session.read_buffer_size - @@session.max_allowed_packet > 0 ; @@ -34,21 +53,21 @@ select @@session.read_buffer_size - @@session.max_allowed_packet > 0 ; eval load data infile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' into table t2; select count(*) from t2 /* 5 000 */; -# the binglog will show fragmented Append_block events ---let $binlog_start=106 ---replace_column 2 # 4 # 5 # ---replace_regex /\/\* xid=.* \*\//\/* XID *\// /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ ---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start ---eval show binlog events in 'master-bin.000002' from $binlog_start +# the binlog will show fragmented Append_block events +source include/show_binlog_events.inc; +--echo ==== Verify results on slave ==== + +--echo [on slave] sync_slave_with_master; -#connection slave; select count(*) from t2 /* 5 000 */; + +--echo ==== Clean up ==== + +--echo [on master] connection master; -drop table t1, t2; +drop table t2; sync_slave_with_master; remove_file $MYSQLTEST_VARDIR/tmp/bug30435_5k.txt; - ---echo end of the tests