From: Date: April 7 2006 7:40pm Subject: bk commit into 5.0 tree (aelkin:1.2137) BUG#17284 List-Archive: http://lists.mysql.com/commits/4652 X-Bug: 17284 Message-Id: <200604071740.k37He7HF010765@dsl-hkigw8-feb0de00-199.dhcp.inet.fi> Below is the list of changes that have just been committed into a local 5.0 repository of elkin. When elkin does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2137 06/04/07 20:39:25 aelkin@stripped +4 -0 Bug#17284 erroneous temp table cleanup on slave. Idea of the fix is for master to send FD event with `created' as 0 to reconnecting slave (upon slave_net_timeout, no master crash) to avoid destroying temp tables. In a case of a connect by slave to the master after its crash temp tables have been already cleaned up so that slave can not keep `orphan' temp tables. mysql-test/include/get_binlog_dump_thread_id.inc 1.1 06/04/07 20:39:21 aelkin@stripped +9 -0 mysqltest's preudo-macro to calculate $id master dump thread id mysql-test/include/get_binlog_dump_thread_id.inc 1.0 06/04/07 20:39:21 aelkin@stripped +0 -0 BitKeeper file /usr_rh9/home/elkin.rh9/MySQL/FIXES/5.0.21-bug17284-temp_table/mysql-test/include/get_binlog_dump_thread_id.inc sql/sql_repl.cc 1.148 06/04/07 20:39:20 aelkin@stripped +6 -0 Storing zero for assigning to `created' of FD event on the reconnecting slave. mysql-test/t/rpl_temporary.test 1.16 06/04/07 20:39:20 aelkin@stripped +26 -1 wait-free addon to check temp tables are ok after slave reconnect. mysql-test/r/rpl_temporary.result 1.19 06/04/07 20:39:20 aelkin@stripped +14 -0 results # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: aelkin # Host: dsl-hkigw8-feb0de00-199.dhcp.inet.fi # Root: /usr_rh9/home/elkin.rh9/MySQL/FIXES/5.0.21-bug17284-temp_table --- New file --- +++ mysql-test/include/get_binlog_dump_thread_id.inc 06/04/07 20:39:21 --exec $MYSQL test -e 'show processlist' | grep 'Binlog Dump' | cut -f1 > $MYSQLTEST_VARDIR/tmp/bl_dump_thread_id --disable_warnings drop table if exists t999; --enable_warnings create temporary table t999 (f int); --replace_result $MYSQL_TEST_DIR "." eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999; let $id = `select f from t999`; drop table t999; --- 1.147/sql/sql_repl.cc 2006-01-03 18:54:37 +02:00 +++ 1.148/sql/sql_repl.cc 2006-04-07 20:39:20 +03:00 @@ -466,6 +466,12 @@ (rli->group_master_log_pos) */ int4store((char*) packet->ptr()+LOG_POS_OFFSET+1, 0); + /* + if reconnect master sends FD event with `created' as 0 + to avoid destroying temp tables. + */ + int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+ + ST_CREATED_OFFSET+1, (ulong) 0); /* send it */ if (my_net_write(net, (char*)packet->ptr(), packet->length())) { --- 1.18/mysql-test/r/rpl_temporary.result 2005-03-23 20:18:16 +02:00 +++ 1.19/mysql-test/r/rpl_temporary.result 2006-04-07 20:39:20 +03:00 @@ -89,3 +89,17 @@ 7 drop table t1,t2; create temporary table t3 (f int); +create temporary table t4 (f int); +create table t5 (f int); +drop table if exists t999; +create temporary table t999 (f int); +LOAD DATA INFILE "/usr_rh9/home/elkin.rh9/MySQL/FIXES/5.0.21-bug17284-temp_table/mysql-test/var/tmp/bl_dump_thread_id" into table t999; +drop table t999; +insert into t4 values (1); +kill `select id from information_schema.processlist where command='Binlog Dump'`; +insert into t5 select * from t4; +select * from t5 /* must be 1 after reconnection */; +f +1 +drop temporary table t4; +drop table t5; --- 1.15/mysql-test/t/rpl_temporary.test 2005-07-28 16:12:37 +03:00 +++ 1.16/mysql-test/t/rpl_temporary.test 2006-04-07 20:39:20 +03:00 @@ -129,6 +129,31 @@ create temporary table t3 (f int); sync_with_master; +# +# Bug#17284 erroneous temp table cleanup on slave +# + +connection master; +create temporary table t4 (f int); +create table t5 (f int); +sync_with_master; +# find dumper's $id +source include/get_binlog_dump_thread_id.inc; +insert into t4 values (1); +# a hint how to do that in 5.1 +--replace_result $id "`select id from information_schema.processlist where command='Binlog Dump'`" +eval kill $id; # to stimulate reconnection by slave w/o timeout +insert into t5 select * from t4; +save_master_pos; + +connection slave; +sync_with_master; +select * from t5 /* must be 1 after reconnection */; + +connection master; +drop temporary table t4; +drop table t5; + # The server will now close done -# End of 4.1 tests +# End of 5.0 tests