Loading mysql-test/include/get_binlog_dump_thread_id.inc 0 → 100644 +9 −0 Original line number Diff line number Diff line --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; mysql-test/r/rpl_temporary.result +14 −0 Original line number Diff line number Diff line Loading @@ -89,3 +89,17 @@ f 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 "./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; mysql-test/t/rpl_temporary.test +26 −1 Original line number Diff line number Diff line Loading @@ -129,6 +129,31 @@ drop table t1,t2; 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 sql/sql_repl.cc +6 −0 Original line number Diff line number Diff line Loading @@ -466,6 +466,12 @@ impossible position"; (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())) { Loading Loading
mysql-test/include/get_binlog_dump_thread_id.inc 0 → 100644 +9 −0 Original line number Diff line number Diff line --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;
mysql-test/r/rpl_temporary.result +14 −0 Original line number Diff line number Diff line Loading @@ -89,3 +89,17 @@ f 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 "./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;
mysql-test/t/rpl_temporary.test +26 −1 Original line number Diff line number Diff line Loading @@ -129,6 +129,31 @@ drop table t1,t2; 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
sql/sql_repl.cc +6 −0 Original line number Diff line number Diff line Loading @@ -466,6 +466,12 @@ impossible position"; (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())) { Loading