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.
8
-- source include/master-slave.inc
10
let $SERVER_VERSION=`select version()`;
12
create table t1 (a int);
13
insert into t1 values (10);
14
create table t2 (a int);
15
create table t3 (a int) engine=merge union(t1);
16
create table t4 (a int);
17
# We force the slave to open t3 (because we want to try confusing him) with this :
18
insert into t4 select * from t3;
19
rename table t1 to t5, t2 to t1;
20
# RENAME may have confused the master (this is a known bug): so FLUSH tables,
21
# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
22
flush no_write_to_binlog tables;
23
# Check that it's not in the binlog.
24
--replace_result $SERVER_VERSION SERVER_VERSION
25
--replace_column 2 # 5 #
26
--replace_regex /table_id: [0-9]+/table_id: #/
27
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
28
# Check that the master is not confused.
30
# This FLUSH should go into the binlog to not confuse the slave.
32
# Check that it's in the binlog.
33
--replace_result $SERVER_VERSION SERVER_VERSION
34
--replace_column 2 # 5 #
35
--replace_regex /table_id: [0-9]+/table_id: #/
36
eval SHOW BINLOG EVENTS FROM $rename_event_pos ;
40
# Check that the slave is not confused.
42
# Note that all this confusion may cause warnings 'table xx is open on rename'
43
# in the .err files; these are not fatal and are not reported by mysql-test-run.
49
flush tables with read lock;
56
drop table t3, t4, t5;