1# drop table t1 t2 t3 are included int master-slave.inc 2# meaningful only in statement-based: 3 4-- source include/have_binlog_format_mixed_or_statement.inc 5-- source include/master-slave.inc 6 7--disable_query_log 8CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); 9--enable_query_log 10 11create table t2 (n int, PRIMARY KEY(n)); 12create temporary table t1 (n int); 13create temporary table t3 (n int not null); 14 15insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300); 16--disable_warnings 17insert into t2 select * from t1; 18--enable_warnings 19alter table t3 add primary key(n); 20 21flush logs; 22insert into t3 values (1010); 23--disable_warnings 24insert into t2 select * from t3; 25--enable_warnings 26 27drop table if exists t3; 28insert into t2 values (1012); 29 30connection master1; 31create temporary table t1 (n int); 32insert into t1 values (4),(5); 33--disable_warnings 34insert into t2 select * from t1; 35--enable_warnings 36 37save_master_pos; 38disconnect master; 39 40connection slave; 41#add 1 to the saved position, so we will catch drop table on disconnect 42#for sure 43sync_with_master 1; 44 45connection master1; 46insert into t2 values(61); 47 48save_master_pos; 49disconnect master1; 50 51connection slave; 52#same trick - make sure we catch drop of temporary table on disconnect 53sync_with_master 1; 54 55select * from t2; 56select count(*) from t2; 57select sum(n) from t2; 58show status like 'Slave_open_temp_tables'; 59 60--echo *** MDEV-8016: Replication aborts on DROP /*!40005 TEMPORARY */ TABLE IF EXISTS *** 61connect (master2,localhost,root,,); 62INSERT INTO t2 VALUES (2000), (2001); 63CREATE FUNCTION f() RETURNS INTEGER RETURN 1; 64CREATE TEMPORARY TABLE t3 AS SELECT f() AS col FROM t2; 65--let $gtid=`SELECT @@gtid_binlog_pos` 66--disconnect master2 67--connection default 68# Wait for implicit DROP TEMPORARY TABLE tmp to be binlogged. 69--let $wait_condition= SELECT @@gtid_binlog_pos != '$gtid' 70--source include/wait_condition.inc 71 72--sync_slave_with_master 73 74 75# 76# Clean up 77# 78connect (master2,localhost,root,,); 79connection master2; 80drop table if exists t1,t2; 81drop function f; 82sync_slave_with_master; 83 84 85--source include/rpl_end.inc 86