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