rpl_slave_status.test

Added waiting start/stop slave via primitives.
parent a5d13561
......@@ -4,21 +4,21 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
stop slave;
change master to master_user='rpl',master_password='rpl';
start slave;
drop table if exists t1;
create table t1 (n int);
insert into t1 values (1);
select * from t1;
GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
STOP SLAVE;
CHANGE MASTER TO master_user='rpl',master_password='rpl';
START SLAVE;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (n int);
INSERT INTO t1 VALUES (1);
SELECT * FROM t1;
n
1
delete from mysql.user where user='rpl';
flush privileges;
stop slave;
start slave;
show slave status;
DELETE FROM mysql.user WHERE user='rpl';
FLUSH PRIVILEGES;
STOP SLAVE;
START SLAVE;
SHOW SLAVE STATUS;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User rpl
......@@ -57,6 +57,6 @@ Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
drop table t1;
delete from mysql.user where user='rpl';
drop table t1;
DROP TABLE t1;
DELETE FROM mysql.user WHERE user='rpl';
DROP TABLE t1;
--source include/master-slave.inc
############################################################################
# Test case for BUG#10780
#
# REQUIREMENT
# A slave without replication privileges should have Slave_IO_Running = No
############################################################################
--source include/master-slave.inc
# 1. Create new replication user
connection master;
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
--connection master
GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY 'rpl';
connection slave;
stop slave;
change master to master_user='rpl',master_password='rpl';
start slave;
--connection slave
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
# 2. Do replication as new user
connection master;
--connection master
--disable_warnings
drop table if exists t1;
DROP TABLE IF EXISTS t1;
--enable_warnings
create table t1 (n int);
insert into t1 values (1);
save_master_pos;
connection slave;
sync_with_master;
select * from t1;
CREATE TABLE t1 (n int);
INSERT INTO t1 VALUES (1);
--sync_slave_with_master
SELECT * FROM t1;
# 3. Delete new replication user
connection master;
delete from mysql.user where user='rpl';
flush privileges;
connection slave;
--connection master
DELETE FROM mysql.user WHERE user='rpl';
FLUSH PRIVILEGES;
--connection slave
# 4. Restart slave without privileges
# (slave.err will contain access denied error for this START SLAVE command)
stop slave;
start slave;
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
START SLAVE;
--let $slave_param= Slave_SQL_Running
--let $slave_param_value= Yes
--source include/wait_for_slave_param.inc
# 5. Make sure Slave_IO_Running = No
--replace_result $MASTER_MYPORT MASTER_MYPORT
......@@ -44,16 +48,16 @@ start slave;
# "Connecting to master" or "Waiting for master update"
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
--vertical_results
show slave status;
SHOW SLAVE STATUS;
# Cleanup (Note that slave IO thread is not running)
connection slave;
drop table t1;
delete from mysql.user where user='rpl';
--connection slave
DROP TABLE t1;
DELETE FROM mysql.user WHERE user='rpl';
# cleanup: slave io thread has been stopped "irrecoverably"
# so we clean up mess manually
connection master;
drop table t1;
--connection master
DROP TABLE t1;
# end of 4.1 tests
# End of 4.1 tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment