mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
f8eab69c3e
Check the user privileges and fail the command, even if there are no slaves that need starting respectively stopping. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
137 lines
4.7 KiB
Text
137 lines
4.7 KiB
Text
#
|
|
# Simple multi-master test
|
|
#
|
|
|
|
--source include/not_embedded.inc
|
|
--source include/binlog_start_pos.inc
|
|
--source include/have_perfschema.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 slave 'slave1';
|
|
set default_master_connection = 'slave1';
|
|
--source include/wait_for_slave_to_start.inc
|
|
set default_master_connection = 'slave2';
|
|
start all slaves;
|
|
|
|
--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'
|
|
|
|
# MDEV-7074 (Sporadic test failure due to a race condition)
|
|
let $show_statement = SHOW ALL SLAVES 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 slaves status;
|
|
|
|
--echo #
|
|
--echo # MDEV:16437: merge 5.7 P_S replication instrumentation and tables
|
|
--echo #
|
|
--replace_column 3 #
|
|
query_vertical select * from performance_schema.replication_connection_configuration;
|
|
|
|
# Ensure that start all slaves doesn't do anything as all slaves are started
|
|
start all slaves;
|
|
|
|
--echo #
|
|
--echo # MDEV:16437: merge 5.7 P_S replication instrumentation and tables
|
|
--echo #
|
|
--replace_column 2 #
|
|
query_vertical select * from performance_schema.replication_applier_status_by_coordinator;
|
|
|
|
stop slave 'slave1';
|
|
|
|
--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 slave 'slave1' status;
|
|
|
|
reset slave 'slave1';
|
|
--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 slaves status;
|
|
|
|
reset slave 'slave1' all;
|
|
--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 slaves status;
|
|
|
|
stop all slaves;
|
|
--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 slaves status;
|
|
|
|
# Ensure that start all slaves doesn't do anything as all slaves are stopped
|
|
stop all slaves;
|
|
|
|
--echo #
|
|
--echo # MDEV-21858: START/STOP ALL SLAVES does not return access errors
|
|
--echo #
|
|
--connection slave
|
|
SET SESSION sql_log_bin=0;
|
|
CREATE USER 'unpriv'@'127.0.0.1';
|
|
GRANT USAGE ON *.* TO 'unpriv'@'127.0.0.1';
|
|
|
|
connect (con1,127.0.0.1,unpriv,,,$SERVER_MYPORT_3);
|
|
|
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
|
STOP SLAVE 'slave2';
|
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
|
START SLAVE 'slave2';
|
|
|
|
# Test that STOP/START ALL SLAVES checks privileges, even if there are no
|
|
# slaves that need stopping or starting.
|
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
|
STOP ALL SLAVES;
|
|
|
|
--connection slave
|
|
START SLAVE 'slave2';
|
|
set default_master_connection = 'slave2';
|
|
--source include/wait_for_slave_to_start.inc
|
|
|
|
--connection con1
|
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
|
START ALL SLAVES;
|
|
--disconnect con1
|
|
|
|
--connection slave
|
|
STOP SLAVE 'slave2';
|
|
set default_master_connection = 'slave2';
|
|
--source include/wait_for_slave_to_stop.inc
|
|
|
|
DROP USER 'unpriv'@'127.0.0.1';
|
|
SET SESSION sql_log_bin=1;
|
|
|
|
#
|
|
# 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
|
|
|