summaryrefslogtreecommitdiff
path: root/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
blob: 7644b18ee7e744a1d4ca1013cf5ad4e878ec24ce (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
#
# 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
sync_slave_with_master;

#discover slaves
connection master;
--query_vertical 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;
sync_slave_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