diff options
author | Sujatha <sujatha.sivakumar@mariadb.com> | 2020-02-04 18:16:21 +0530 |
---|---|---|
committer | Sujatha <sujatha.sivakumar@mariadb.com> | 2020-02-04 18:16:21 +0530 |
commit | 42e825dd0a8d25c1d6fa93f5a07115ceed3ee0ff (patch) | |
tree | 9cf7b8aa71e0907c3912a221a475df306818121e /mysql-test/suite/multi_source | |
parent | 287c1db7867502348dcbc9ff7ccaae3d289cdbb1 (diff) | |
download | mariadb-git-42e825dd0a8d25c1d6fa93f5a07115ceed3ee0ff.tar.gz |
MDEV-20601: Make REPLICA a synonym for SLAVE in SQL statements
Fix:
===
Add "REPLICA" as an alias for "SLAVE". All commands which use "SLAVE" keyword
can be used with new alias "REPLICA".
List of commands:
On Master:
=========
SHOW REPLICA HOSTS <--> SHOW SLAVE HOSTS
Privilege "SLAVE" <--> "REPLICA"
On Slave:
=========
START SLAVE <--> START REPLICA
START ALL SLAVES <--> START ALL REPLICAS
START SLAVE UNTIL <--> START REPLICA UNTIL
STOP SLAVE <--> STOP REPLICA
STOP ALL SLAVES <--> STOP ALL REPLICAS
RESET SLAVE <--> RESET REPLICA
RESET SLAVE ALL <--> RESET REPLICA ALL
SLAVE_POS <--> REPLICA_POS
Diffstat (limited to 'mysql-test/suite/multi_source')
-rw-r--r-- | mysql-test/suite/multi_source/multi_source_slave_alias_replica.result | 157 | ||||
-rw-r--r-- | mysql-test/suite/multi_source/multi_source_slave_alias_replica.test | 80 |
2 files changed, 237 insertions, 0 deletions
diff --git a/mysql-test/suite/multi_source/multi_source_slave_alias_replica.result b/mysql-test/suite/multi_source/multi_source_slave_alias_replica.result new file mode 100644 index 00000000000..de38313401d --- /dev/null +++ b/mysql-test/suite/multi_source/multi_source_slave_alias_replica.result @@ -0,0 +1,157 @@ +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; +CHANGE MASTER 'slave1' TO MASTER_PORT=MYPORT_1, MASTER_HOST='127.0.0.1', MASTER_USER='root'; +CHANGE MASTER 'slave2' TO MASTER_PORT=MYPORT_2, MASTER_HOST='127.0.0.1', MASTER_USER='root'; +START REPLICA 'slave1'; +SET default_master_connection = 'slave1'; +include/wait_for_slave_to_start.inc +SET default_master_connection = 'slave2'; +"Command: START ALL SLAVES --> START ALL REPLICAS" +START ALL REPLICAS; +Warnings: +Note 1937 SLAVE 'slave2' started +include/wait_for_slave_to_start.inc +SET default_master_connection = ''; +connection master1; +connection slave; +connection master2; +connection slave; +"Command: SHOW ALL STAVES STATUS --> SHOW ALL REPLICAS STATUS" +SHOW ALL REPLICAS STATUS; +Connection_name slave1 +Slave_SQL_State Slave has read all relay log; waiting for the slave I/O thread to update it +Slave_IO_State Waiting for master to send event +Master_Host 127.0.0.1 +Master_User root +Master_Port MYPORT_1 +Connect_Retry 60 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos <read_master_log_pos> +Relay_Log_File mysqld-relay-bin-slave1.000002 +Relay_Log_Pos <relay_log_pos> +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos <read_master_log_pos> +Relay_Log_Space <relay_log_space1> +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master 0 +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 +Master_SSL_Crl +Master_SSL_Crlpath +Using_Gtid No +Gtid_IO_Pos +Replicate_Do_Domain_Ids +Replicate_Ignore_Domain_Ids +Parallel_Mode optimistic +SQL_Delay 0 +SQL_Remaining_Delay NULL +Slave_SQL_Running_State Slave has read all relay log; waiting for the slave I/O thread to update it +Slave_DDL_Groups 0 +Slave_Non_Transactional_Groups 0 +Slave_Transactional_Groups 0 +Retried_transactions 0 +Max_relay_log_size 1073741824 +Executed_log_entries 7 +Slave_received_heartbeats 0 +Slave_heartbeat_period 60.000 +Gtid_Slave_Pos +Connection_name slave2 +Slave_SQL_State Slave has read all relay log; waiting for the slave I/O thread to update it +Slave_IO_State Waiting for master to send event +Master_Host 127.0.0.1 +Master_User root +Master_Port MYPORT_2 +Connect_Retry 60 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos <read_master_log_pos> +Relay_Log_File mysqld-relay-bin-slave2.000002 +Relay_Log_Pos <relay_log_pos> +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos <read_master_log_pos> +Relay_Log_Space <relay_log_space1> +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master 0 +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 2 +Master_SSL_Crl +Master_SSL_Crlpath +Using_Gtid No +Gtid_IO_Pos +Replicate_Do_Domain_Ids +Replicate_Ignore_Domain_Ids +Parallel_Mode optimistic +SQL_Delay 0 +SQL_Remaining_Delay NULL +Slave_SQL_Running_State Slave has read all relay log; waiting for the slave I/O thread to update it +Slave_DDL_Groups 0 +Slave_Non_Transactional_Groups 0 +Slave_Transactional_Groups 0 +Retried_transactions 0 +Max_relay_log_size 1073741824 +Executed_log_entries 7 +Slave_received_heartbeats 0 +Slave_heartbeat_period 60.000 +Gtid_Slave_Pos +"Command: STOP ALL SLAVES --> STOP ALL REPLICAS" +STOP ALL REPLICAS; +Warnings: +Note 1938 SLAVE 'slave2' stopped +Note 1938 SLAVE 'slave1' stopped +include/reset_master_slave.inc +disconnect slave; +connection master1; +include/reset_master_slave.inc +disconnect master1; +connection master2; +include/reset_master_slave.inc +disconnect master2; diff --git a/mysql-test/suite/multi_source/multi_source_slave_alias_replica.test b/mysql-test/suite/multi_source/multi_source_slave_alias_replica.test new file mode 100644 index 00000000000..409718dd4e7 --- /dev/null +++ b/mysql-test/suite/multi_source/multi_source_slave_alias_replica.test @@ -0,0 +1,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'; +--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'; +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 |