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.
5#
6
7source include/master-slave.inc;
8source include/not_relay_log_info_table.inc;
9
10let $SERVER_VERSION=`select version()`;
11
12create table t1 (a int);
13insert into t1 values (10);
14create table t2 (a int);
15create table t3 (a int) engine=merge union(t1);
16create table t4 (a int);
17# We force the slave to open t3 (because we want to try confusing him) with this :
18insert into t4 select * from t3;
19--let $rename_event_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
20rename table t1 to t5, t2 to t1;
21# RENAME may have confused the master (this is a known bug): so FLUSH tables,
22# first don't write it to the binlog, to test the NO_WRITE_TO_BINLOG keyword.
23flush no_write_to_binlog tables;
24# Check that it's not in the binlog.
25let $binlog_start= $rename_event_pos;
26source include/show_binlog_events.inc;
27# Check that the master is not confused.
28select * from t3;
29# This FLUSH should go into the binlog to not confuse the slave.
30flush tables;
31# Check that it's in the binlog.
32let $wait_binlog_event= flush tables;
33source include/wait_for_binlog_event.inc;
34
35--source include/sync_slave_sql_with_master.inc
36# Check that the slave is not confused.
37select * from t3;
38# Note that all this confusion may cause warnings 'table xx is open on rename'
39# in the .err files; these are not fatal and are not reported by mysql-test-run.
40stop slave;
41source include/wait_for_slave_to_stop.inc;
42
43connection master;
44drop table t1;
45
46connection slave;
47flush tables with read lock;
48start slave;
49source include/wait_for_slave_to_start.inc;
50--error 1192
51stop slave;
52
53# Cleanup
54unlock tables;
55
56connection master;
57drop table t3, t4, t5;
58
59# End of 4.1 tests
60
61--source include/rpl_end.inc
62