| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Test verifies that SQL statements which use keyword 'REPLICA' a synonym for |
| 4 |
# 'SLAVE' work as expected. |
| 5 |
# |
| 6 |
# ==== Implementation ==== |
| 7 |
# |
| 8 |
# List of commands being verified are |
| 9 |
# |
| 10 |
# START ALL REPLICAS |
| 11 |
# STOP ALL REPLICAS |
| 12 |
# SHOW ALL REPLICAS STATUS |
| 13 |
# |
| 14 |
# ==== References ==== |
| 15 |
# |
| 16 |
# MDEV-20601: Make REPLICA a synonym for SLAVE in SQL statements |
| 17 |
# |
| 18 |
|
| 19 |
--source include/not_embedded.inc |
| 20 |
--source include/binlog_start_pos.inc |
| 21 |
--let $rpl_server_count= 0 |
| 22 |
|
| 23 |
--connect (slave,127.0.0.1,root,,,$SERVER_MYPORT_3) |
| 24 |
--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) |
| 25 |
--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2) |
| 26 |
|
| 27 |
--connection slave |
| 28 |
--replace_result $SERVER_MYPORT_1 MYPORT_1 |
| 29 |
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; |
| 30 |
--replace_result $SERVER_MYPORT_2 MYPORT_2 |
| 31 |
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; |
| 32 |
START REPLICA 'slave1'; |
| 33 |
SET default_master_connection = 'slave1'; |
| 34 |
--source include/wait_for_slave_to_start.inc |
| 35 |
SET default_master_connection = 'slave2'; |
| 36 |
--echo "Command: START ALL SLAVES --> START ALL REPLICAS" |
| 37 |
START ALL REPLICAS; |
| 38 |
|
| 39 |
--source include/wait_for_slave_to_start.inc |
| 40 |
SET default_master_connection = ''; |
| 41 |
|
| 42 |
# Ensure that all data is in the relay log |
| 43 |
--connection master1 |
| 44 |
--save_master_pos |
| 45 |
--connection slave |
| 46 |
--sync_with_master 0,'slave1' |
| 47 |
--connection master2 |
| 48 |
--save_master_pos |
| 49 |
--connection slave |
| 50 |
--sync_with_master 0,'slave2' |
| 51 |
|
| 52 |
--echo "Command: SHOW ALL STAVES STATUS --> SHOW ALL REPLICAS STATUS" |
| 53 |
let $show_statement = SHOW ALL REPLICAS STATUS; |
| 54 |
let $field = Executed_log_entries; |
| 55 |
let $condition = = 7; |
| 56 |
let $wait_for_all = 1; |
| 57 |
--source include/wait_show_condition.inc |
| 58 |
|
| 59 |
let read_master_log_pos=`select $binlog_start_pos + 73`; |
| 60 |
let relay_log_pos=`select 2*$binlog_start_pos + 117`; |
| 61 |
let relay_log_space1=`select 3*$binlog_start_pos + 178`; |
| 62 |
let relay_log_space2=`select 3*$binlog_start_pos + 178`; |
| 63 |
--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> |
| 64 |
--query_vertical SHOW ALL REPLICAS STATUS |
| 65 |
|
| 66 |
--echo "Command: STOP ALL SLAVES --> STOP ALL REPLICAS" |
| 67 |
STOP ALL REPLICAS; |
| 68 |
|
| 69 |
# |
| 70 |
# clean up |
| 71 |
# |
| 72 |
|
| 73 |
--source include/reset_master_slave.inc |
| 74 |
--disconnect slave |
| 75 |
--connection master1 |
| 76 |
--source include/reset_master_slave.inc |
| 77 |
--disconnect master1 |
| 78 |
--connection master2 |
| 79 |
--source include/reset_master_slave.inc |
| 80 |
--disconnect master2 |