| 1 |
# drop table t1 t2 t3 are included int master-slave.inc |
| 2 |
# meaningful only in statement-based: |
| 3 |
|
| 4 |
-- source include/not_group_replication_plugin.inc |
| 5 |
-- source include/have_binlog_format_statement.inc |
| 6 |
-- source include/master-slave.inc |
| 7 |
|
| 8 |
--disable_query_log |
| 9 |
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); |
| 10 |
--enable_query_log |
| 11 |
|
| 12 |
create table t2 (n int, PRIMARY KEY(n)); |
| 13 |
create temporary table t1 (n int); |
| 14 |
create temporary table t3 (n int not null); |
| 15 |
|
| 16 |
insert into t1 values(1),(2),(3),(100),(25),(26),(200),(300); |
| 17 |
--disable_warnings |
| 18 |
insert into t2 select * from t1; |
| 19 |
--enable_warnings |
| 20 |
alter table t3 add primary key(n); |
| 21 |
|
| 22 |
flush logs; |
| 23 |
insert into t3 values (1010); |
| 24 |
--disable_warnings |
| 25 |
insert into t2 select * from t3; |
| 26 |
--enable_warnings |
| 27 |
|
| 28 |
drop table if exists t3; |
| 29 |
insert into t2 values (1012); |
| 30 |
|
| 31 |
connection master1; |
| 32 |
create temporary table t1 (n int); |
| 33 |
insert into t1 values (4),(5); |
| 34 |
--disable_warnings |
| 35 |
insert into t2 select * from t1; |
| 36 |
--enable_warnings |
| 37 |
|
| 38 |
save_master_pos; |
| 39 |
disconnect master; |
| 40 |
|
| 41 |
connection slave; |
| 42 |
#add 1 to the saved position, so we will catch drop table on disconnect |
| 43 |
#for sure |
| 44 |
sync_with_master 1; |
| 45 |
|
| 46 |
connection master1; |
| 47 |
insert into t2 values(61); |
| 48 |
|
| 49 |
save_master_pos; |
| 50 |
disconnect master1; |
| 51 |
|
| 52 |
connection slave; |
| 53 |
#same trick - make sure we catch drop of temporary table on disconnect |
| 54 |
sync_with_master 1; |
| 55 |
|
| 56 |
select * from t2; |
| 57 |
select count(*) from t2; |
| 58 |
select sum(n) from t2; |
| 59 |
show status like 'Replica_open_temp_tables'; |
| 60 |
|
| 61 |
# |
| 62 |
# Clean up |
| 63 |
# |
| 64 |
connect (master2,localhost,root,,); |
| 65 |
connection master2; |
| 66 |
drop table if exists t1,t2; |
| 67 |
--source include/sync_slave_sql_with_master.inc |
| 68 |
|
| 69 |
|
| 70 |
--source include/rpl_end.inc |