3
# Verify that a slave without replication privileges has
4
# Slave_IO_Running = No
8
# We do the following steps:
9
# - Create a new replication user on master
10
# - Connect to slave and start replication as this user.
11
# - Verify that slave can replicate well, by creating a table and
12
# inserting a row into it.
13
# - Delete the user from the master.
14
# - Stop and start the slave (this should fail).
15
# - Check the Slave_IO_Running column of SHOW SLAVE STATUS.
17
# ==== Related bugs ====
19
# BUG#10780: slave can't connect to master - IO and SQL threads running
1
21
--source include/master-slave.inc
3
############################################################################
4
# Test case for BUG#10780
7
# A slave without replication privileges should have Slave_IO_Running = No
9
# 1. Create new replication user
23
--echo ==== Create new replication user ====
11
26
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
29
sync_slave_with_master;
31
source include/wait_for_slave_to_stop.inc;
15
32
change master to master_user='rpl',master_password='rpl';
34
source include/wait_for_slave_to_start.inc;
18
# 2. Do replication as new user
36
--echo ==== Do replication as new user ====
21
drop table if exists t1;
23
39
create table t1 (n int);
24
40
insert into t1 values (1);
42
sync_slave_with_master;
30
45
# 3. Delete new replication user
46
# note: drop user will be replicated on slave
47
--echo ==== Delete new replication user ====
32
delete from mysql.user where user='rpl';
50
drop user rpl@127.0.0.1;
36
# 4. Restart slave without privileges
54
sync_slave_with_master;
56
--echo ==== Restart slave without privileges =====
37
57
# (slave.err will contain access denied error for this START SLAVE command)
59
source include/wait_for_slave_to_stop.inc;
41
# 5. Make sure Slave_IO_Running = No
42
--replace_result $MASTER_MYPORT MASTER_MYPORT
43
# Column 1 is replaced, since the output can be either
44
# "Connecting to master" or "Waiting for master update"
45
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
49
# Cleanup (Note that slave IO thread is not running)
61
source include/wait_for_slave_sql_to_start.inc;
63
--echo ==== Verify that Slave_IO_Running = No ====
64
let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1);
65
--echo Slave_IO_Running = $result (should be No)
67
--echo ==== Cleanup (Note that slave IO thread is not running) ====
52
delete from mysql.user where user='rpl';
53
69
# cleanup: slave io thread has been stopped "irrecoverably"
54
70
# so we clean up mess manually