summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl/t/rpl_redirect.test
blob: 078d10487949639b0166b571701d7a29ee2e65d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# Test of automatic redirection of queries to master/slave.
# 

source include/master-slave.inc;
# We disable this for now as PS doesn't handle redirection
--disable_ps_protocol

#first, make sure the slave has had enough time to register
save_master_pos;
connection slave;
sync_with_master;

#discover slaves
connection master;
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
SHOW SLAVE STATUS;
--replace_result $SLAVE_MYPORT SLAVE_PORT
SHOW SLAVE HOSTS;
rpl_probe;

#turn on master/slave query direction auto-magic
enable_rpl_parse;
create table t1 ( n int);
insert into t1 values (1),(2),(3),(4);
disable_rpl_parse;
save_master_pos;
connection slave;
sync_with_master;
insert into t1 values(5);
connection master;
enable_rpl_parse;
# The first of the queries will be sent to the slave, the second to the master.
SELECT * FROM t1 ORDER BY n;
SELECT * FROM t1 ORDER BY n;
disable_rpl_parse;
SELECT * FROM t1 ORDER BY n;
connection slave;
SELECT * FROM t1 ORDER BY n;

# Cleanup
connection master;
drop table t1;
sync_slave_with_master;

# End of 4.1 tests