mariadb/mysql-test/suite/rpl/t/rpl_slave_status.test
Sven Sandberg 25bddd93c3 BUG#36826: rpl_slave_status fails sporadically in pushbuild
rpl_slave_status failed on pushbuild. The slave stopped with an
error. Adding sync_slave_with_master fixes the problem. Updated
test case.
2008-05-26 15:06:49 +02:00

73 lines
2 KiB
Text

# ==== Purpose ====
#
# Verify that a slave without replication privileges has
# Slave_IO_Running = No
#
# ==== Method ====
#
# We do the following steps:
# - Create a new replication user on master
# - Connect to slave and start replication as this user.
# - Verify that slave can replicate well, by creating a table and
# inserting a row into it.
# - Delete the user from the master.
# - Stop and start the slave (this should fail).
# - Check the Slave_IO_Running column of SHOW SLAVE STATUS.
#
# ==== Related bugs ====
#
# BUG#10780: slave can't connect to master - IO and SQL threads running
--source include/master-slave.inc
--echo ==== Create new replication user ====
--echo [on master]
connection master;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
--echo [on slave]
sync_slave_with_master;
stop slave;
source include/wait_for_slave_to_stop.inc;
change master to master_user='rpl',master_password='rpl';
start slave;
source include/wait_for_slave_to_start.inc;
--echo ==== Do replication as new user ====
--echo [on master]
connection master;
create table t1 (n int);
insert into t1 values (1);
--echo [on slave]
sync_slave_with_master;
select * from t1;
--echo ==== Delete new replication user ====
--echo [on master]
connection master;
drop user rpl@127.0.0.1;
flush privileges;
--echo [on slave]
sync_slave_with_master;
--echo ==== Restart slave without privileges =====
# (slave.err will contain access denied error for this START SLAVE command)
stop slave;
source include/wait_for_slave_to_stop.inc;
start slave;
source include/wait_for_slave_sql_to_start.inc;
--echo ==== Verify that Slave_IO_Running = No ====
let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
--echo Slave_IO_Running = $result (should be No)
--echo ==== Cleanup (Note that slave IO thread is not running) ====
drop table t1;
delete from mysql.user where user='rpl';
# cleanup: slave io thread has been stopped "irrecoverably"
# so we clean up mess manually
--echo [on master]
connection master;
drop table t1;