summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/multi_source/multi_source_slave_alias_replica.test
blob: 0e93d989ed0556a7e20a0ac4b5fb4fd093b5ede2 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# ==== Purpose ====
#
# Test verifies that SQL statements which use keyword 'REPLICA' a synonym for
# 'SLAVE' work as expected.
#
# ==== Implementation ====
#
# List of commands being verified are
#
# START ALL REPLICAS
# STOP ALL REPLICAS
# SHOW ALL REPLICAS STATUS
#
# ==== References ====
#
# MDEV-20601: Make REPLICA a synonym for SLAVE in SQL statements
#

--source include/not_embedded.inc
--source include/binlog_start_pos.inc
--let $rpl_server_count= 0

--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3)
--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1)
--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2)

--connection slave
--replace_result $SERVER_MYPORT_1 MYPORT_1
eval CHANGE MASTER 'slave1' TO MASTER_PORT=$SERVER_MYPORT_1, MASTER_HOST='127.0.0.1', MASTER_USER='root', master_ssl_verify_server_cert=0;
--replace_result $SERVER_MYPORT_2 MYPORT_2
eval CHANGE MASTER 'slave2' TO MASTER_PORT=$SERVER_MYPORT_2, MASTER_HOST='127.0.0.1', MASTER_USER='root', master_ssl_verify_server_cert=0;
START REPLICA 'slave1';
SET default_master_connection = 'slave1';
--source include/wait_for_slave_to_start.inc
SET default_master_connection = 'slave2';
--echo "Command: START ALL SLAVES --> START ALL REPLICAS"
START ALL REPLICAS;

--source include/wait_for_slave_to_start.inc
SET default_master_connection = '';

# Ensure that all data is in the relay log
--connection master1
--save_master_pos
--connection slave
--sync_with_master 0,'slave1'
--connection master2
--save_master_pos
--connection slave
--sync_with_master 0,'slave2'

--echo "Command: SHOW ALL STAVES STATUS --> SHOW ALL REPLICAS STATUS"
let $show_statement = SHOW ALL REPLICAS STATUS;
let $field = Executed_log_entries;
let $condition = = 7;
let $wait_for_all = 1;
--source include/wait_show_condition.inc

let read_master_log_pos=`select $binlog_start_pos + 73`;
let relay_log_pos=`select 2*$binlog_start_pos + 117`;
let relay_log_space1=`select 3*$binlog_start_pos + 178`;
let relay_log_space2=`select 3*$binlog_start_pos + 178`;
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
--query_vertical SHOW ALL REPLICAS STATUS

--echo "Command: STOP ALL SLAVES --> STOP ALL REPLICAS"
STOP ALL REPLICAS;

#
# clean up
#

--source include/reset_master_slave.inc
--disconnect slave
--connection master1
--source include/reset_master_slave.inc
--disconnect master1
--connection master2
--source include/reset_master_slave.inc
--disconnect master2