mariadb/mysql-test/t/rpl_drop_temp.test
unknown 2b2ce3d6cb Bug #49137 Replication failure on SBR/MBR + multi-table DROP TEMPORARY TABLE
In statement-based or mixed-mode replication, use DROP TEMPORARY TABLE
to drop multiple tables causes different errors on master and slave, 
when one or more of these tables do not exist. Because when executed
on slave, it would automatically add IF EXISTS to the query to ignore
all ER_BAD_TABLE_ERROR errors.

To fix the problem, do not add IF EXISTS when executing DROP TEMPORARY
TABLE on the slave, and clear the ER_BAD_TABLE_ERROR error after
execution if the query does not expect any errors.


mysql-test/r/rpl_drop_temp.result:
  Updated for the patch of bug#49137.
mysql-test/t/rpl_drop_temp.test:
  Added the test file to verify if DROP MULTI TEMPORARY TABLE
  will cause different errors on master and slave, when one or
  more of these tables do not exist.
sql/log_event.cc:
  Added code to handle above cases which are
  removed from sql_parse.cc
sql/sql_parse.cc:
  Remove the code to issue the 'Unknown table' error,
  if the temporary table does not exist when dropping
  it on slave. The above cases decribed in comments
  will be handled later in log_event.cc.
2009-12-31 11:33:10 +08:00

57 lines
1.2 KiB
Text

source include/master-slave.inc;
--disable_warnings
create database if not exists mysqltest;
--enable_warnings
connect (con_temp,127.0.0.1,root,,test,$MASTER_MYPORT,);
connection con_temp;
use mysqltest;
create temporary table mysqltest.t1 (n int);
create temporary table mysqltest.t2 (n int);
select get_lock("con_temp",10);
connection master;
disconnect con_temp;
select get_lock("con_temp",10);
sync_slave_with_master;
connection slave;
show status like 'Slave_open_temp_tables';
connection master;
drop database mysqltest;
sync_slave_with_master;
#
# Bug#49137
# This test verifies if DROP MULTI TEMPORARY TABLE
# will cause different errors on master and slave,
# when one or more of these tables do not exist.
#
connection master;
DROP TEMPORARY TABLE IF EXISTS tmp1;
CREATE TEMPORARY TABLE t1 ( a int );
--error 1051
DROP TEMPORARY TABLE t1, t2;
--error 1051
DROP TEMPORARY TABLE tmp2;
sync_slave_with_master;
connection slave;
stop slave;
wait_for_slave_to_stop;
--echo **** On Master ****
connection master;
CREATE TEMPORARY TABLE tmp3 (a int);
DROP TEMPORARY TABLE tmp3;
connection slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
connection master;
sync_slave_with_master;
# End of 4.1 tests