summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <aelkin@mysql.com>2006-04-09 23:47:11 +0300
committerunknown <aelkin@mysql.com>2006-04-09 23:47:11 +0300
commit9b0da58292fe20ac2c320247d1e4701ea79a0d9b (patch)
treeff67330e5d094dfba2ea50e6e645e3aecc1089c3
parentdde4ebdd0c202753ad22346758d7b6b26edaae1b (diff)
parent99afb2bafd9b8be8f3e202e0de3a204bb6a65740 (diff)
downloadmariadb-git-9b0da58292fe20ac2c320247d1e4701ea79a0d9b.tar.gz
Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/usr_rh9/home/elkin.rh9/MySQL/Merge/5.1 sql/log.cc: Auto merged
-rw-r--r--mysql-test/include/get_binlog_dump_thread_id.inc9
-rw-r--r--mysql-test/mysql-test-run.sh2
-rw-r--r--mysql-test/r/rpl_temporary.result14
-rw-r--r--mysql-test/t/rpl_temporary.test26
-rw-r--r--sql/sql_repl.cc6
5 files changed, 57 insertions, 0 deletions
diff --git a/mysql-test/include/get_binlog_dump_thread_id.inc b/mysql-test/include/get_binlog_dump_thread_id.inc
new file mode 100644
index 00000000000..830a88b5db6
--- /dev/null
+++ b/mysql-test/include/get_binlog_dump_thread_id.inc
@@ -0,0 +1,9 @@
+--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 $MYSQLTEST_VARDIR "."
+eval LOAD DATA INFILE "$MYSQLTEST_VARDIR/tmp/bl_dump_thread_id" into table t999;
+let $id = `select f from t999`;
+drop table t999;
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index 4485d8ca073..62e4aafef7e 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -330,6 +330,8 @@ STRESS_INIT_FILE=""
STRESS_TEST_FILE=""
STRESS_TEST=""
+$ECHO "Logging: $0 $*" # To ensure we see all arguments in the output, for the test analysis tool
+
while test $# -gt 0; do
case "$1" in
--embedded-server)
diff --git a/mysql-test/r/rpl_temporary.result b/mysql-test/r/rpl_temporary.result
index 5e3030f2c7a..bc5cc262079 100644
--- a/mysql-test/r/rpl_temporary.result
+++ b/mysql-test/r/rpl_temporary.result
@@ -74,3 +74,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 "./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;
diff --git a/mysql-test/t/rpl_temporary.test b/mysql-test/t/rpl_temporary.test
index 9c6056f9217..7269b54556b 100644
--- a/mysql-test/t/rpl_temporary.test
+++ b/mysql-test/t/rpl_temporary.test
@@ -131,4 +131,30 @@ 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 5.1 tests
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index e900d33f743..6ec010b8a44 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -464,6 +464,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()))
{