summaryrefslogtreecommitdiff
path: root/mysql-test/t/ps_change_master.test
blob: d756b8cd4fb9b2a066f25d26e6e9fcb385b09358 (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
--source include/not_embedded.inc
--source include/have_log_bin.inc

--echo #
--echo # CHANGE MASTER TO doesn't work with prepared statements
--echo #

CHANGE MASTER TO MASTER_HOST='host1', MASTER_USER='user1';

let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);

--echo # Master_Host : $master_host
--echo # Master_User : $master_user

SET @s := "CHANGE MASTER TO MASTER_HOST='host2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);

--echo # Master_Host : $master_host
--echo # Master_User : $master_user

SET @s := "CHANGE MASTER TO MASTER_USER='user2'";
PREPARE stmt FROM @s;
EXECUTE stmt;
# Multiple executions should not hurt.
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $master_user= query_get_value(SHOW SLAVE STATUS, Master_User, 1);

--echo # Master_Host : $master_host
--echo # Master_User : $master_user


# Reset
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';

--echo # End of test