polardbxengine/mysql-test/extra/rpl_tests/rpl_drop_temp.test

116 lines
2.8 KiB
Plaintext

##############################################
# Change Author: JBM
# Change Date: 2006-02-07
# Change: Added ENGINE=MyISAM
# Purpose: According to TU in 16552 This is how
# to work around NDB's issue with temp tables
##############################################
source include/master-slave.inc;
source include/have_myisam.inc;
source include/have_binlog_format_mixed_or_statement.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)ENGINE=MyISAM;
create temporary table mysqltest.t2 (n int)ENGINE=MyISAM;
disconnect con_temp;
--source include/wait_until_disconnected.inc
connection master;
if (`SELECT @@SESSION.binlog_format = 'STATEMENT'`)
{
-- let $wait_binlog_event= DROP
-- source include/wait_for_binlog_event.inc
}
sync_slave_with_master;
connection slave;
show status like 'Slave_open_temp_tables';
# Cleanup
connection master;
drop database mysqltest;
sync_slave_with_master;
#
# Bug#49137
# This test verifies if DROP MULTI TEMPORARY TABLE
# causes different errors on master and slave and breaks
# replication, when one or more of these tables do not
# exist.
#
# Nowadays, we don't drop any tables in multi-table DROP
# TABLE (without IF EXISTS clause) if one of them does not
# exist. So the first part is less relevant currently.
#
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;
# Clean-up.
connection master;
DROP TEMPORARY TABLE t1;
sync_slave_with_master;
#
# However, we still can end-up in situation when some temporary
# table dropped on master and logged as such, does not exist
# on slave. The second part of the test covers this situation.
#
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;
START SLAVE;
connection master;
sync_slave_with_master;
#
# BUG#54842: DROP TEMPORARY TABLE not binlogged after manual switching binlog format to ROW
#
--source include/rpl_reset.inc
--connection master
CREATE TABLE t1 ( i INT );
--sync_slave_with_master
SHOW STATUS LIKE 'Slave_open_temp_tables';
--connect(con1,localhost,root,,)
CREATE TEMPORARY TABLE ttmp1 ( i INT );
--disconnect con1
-- connection master
if (`SELECT @@SESSION.binlog_format = 'STATEMENT'`)
{
--let $wait_binlog_event= DROP
--source include/wait_for_binlog_event.inc
}
--sync_slave_with_master
SHOW STATUS LIKE 'Slave_open_temp_tables';
--connection master
--source include/show_binlog_events.inc
DROP TABLE t1;
# End of 4.1 tests
--source include/rpl_end.inc