~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/extra/rpl_tests/rpl_flsh_tbls.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
let $SERVER_VERSION=`select version()`;
 
10
 
 
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.
 
28
select * from t3;
 
29
# This FLUSH should go into the binlog to not confuse the slave.
 
30
flush tables;
 
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 ;
 
36
 
 
37
sync_slave_with_master;
 
38
# Check that the slave is not confused.
 
39
select * from t3;
 
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.
 
42
stop slave;
 
43
source include/wait_for_slave_to_stop.inc;
 
44
 
 
45
connection master;
 
46
drop table t1;
 
47
 
 
48
connection slave;
 
49
flush tables with read lock;
 
50
start slave;
 
51
source include/wait_for_slave_to_start.inc;
 
52
--error 1192
 
53
stop slave;
 
54
 
 
55
# Cleanup
 
56
unlock tables;
 
57
 
 
58
connection master;
 
59
drop table t3, t4, t5;
 
60
 
 
61
sync_slave_with_master;
 
62
 
 
63
# End of 4.1 tests
 
64