1
# depends on the binlog output
2
# Test of replicating FLUSH TABLES to make
3
# RENAME TABLE work with MERGE tables on the slave.
4
# Test of FLUSH NO_WRITE_TO_BINLOG by the way.
7
source include/master-slave.inc;
9
let $SERVER_VERSION=`select version()`;
11
create table t1 (a int);
12
insert into t1 values (10);
13
create table t2 (a int);
14
create table t3 (a int) engine=merge union(t1);
15
create table t4 (a int);
16
# We force the slave to open t3 (because we want to try confusing him) with this :
17
insert into t4 select * from t3;
18
rename table t1 to t5, t2 to t1;
19
# RENAME may have confused the master (this is a known bug): so FLUSH tables,
20
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
21
flush no_write_to_binlog tables;
22
# Check that it's not in the binlog.
23
--replace_result $SERVER_VERSION SERVER_VERSION
24
--replace_column 2 # 5 #
25
--replace_regex /table_id: [0-9]+/table_id: #/
26
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
27
# Check that the master is not confused.
29
# This FLUSH should go into the binlog to not confuse the slave.
31
# Check that it's in the binlog.
32
--replace_result $SERVER_VERSION SERVER_VERSION
33
--replace_column 2 # 5 #
34
--replace_regex /table_id: [0-9]+/table_id: #/
35
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
37
sync_slave_with_master;
38
# Check that the slave is not confused.
40
# Note that all this confusion may cause warnings 'table xx is open on rename'
41
# in the .err files; these are not fatal and are not reported by mysql-test-run.
43
source include/wait_for_slave_to_stop.inc;
49
flush tables with read lock;
51
source include/wait_for_slave_to_start.inc;
59
drop table t3, t4, t5;
61
sync_slave_with_master;