~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_slave_status.test

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ==== Purpose ====
 
2
#
 
3
# Verify that a slave without replication privileges has
 
4
# Slave_IO_Running = No
 
5
#
 
6
# ==== Method ====
 
7
#
 
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.
 
16
#
 
17
# ==== Related bugs ====
 
18
#
 
19
# BUG#10780: slave can't connect to master - IO and SQL threads running
 
20
 
1
21
--source include/master-slave.inc
2
22
 
3
 
############################################################################
4
 
# Test case for BUG#10780
5
 
#
6
 
# REQUIREMENT
7
 
#   A slave without replication privileges should have Slave_IO_Running = No
8
 
 
9
 
# 1. Create new replication user
 
23
--echo ==== Create new replication user ====
 
24
--echo [on master]
10
25
connection master;
11
26
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
12
 
 
13
 
connection slave;
 
27
flush privileges;
 
28
--echo [on slave]
 
29
sync_slave_with_master;
14
30
stop slave;
 
31
source include/wait_for_slave_to_stop.inc;
15
32
change master to master_user='rpl',master_password='rpl';
16
33
start slave;
 
34
source include/wait_for_slave_to_start.inc;
17
35
 
18
 
# 2. Do replication as new user
 
36
--echo ==== Do replication as new user ====
 
37
--echo [on master]
19
38
connection master;
20
 
--disable_warnings
21
 
drop table if exists t1;
22
 
--enable_warnings
23
39
create table t1 (n int);
24
40
insert into t1 values (1);
25
 
save_master_pos;
26
 
connection slave;
27
 
sync_with_master;
 
41
--echo [on slave]
 
42
sync_slave_with_master;
28
43
select * from t1;
29
44
 
30
45
# 3. Delete new replication user
 
46
# note: drop user will be replicated on slave
 
47
--echo ==== Delete new replication user ====
 
48
--echo [on master]
31
49
connection master;
32
 
delete from mysql.user where user='rpl';
 
50
drop user rpl@127.0.0.1;
33
51
flush privileges;
34
 
connection slave;
35
 
 
36
 
# 4. Restart slave without privileges
 
52
 
 
53
--echo [on slave]
 
54
sync_slave_with_master;
 
55
 
 
56
--echo ==== Restart slave without privileges =====
37
57
# (slave.err will contain access denied error for this START SLAVE command)
38
58
stop slave;
 
59
source include/wait_for_slave_to_stop.inc;
39
60
start slave;
40
 
 
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 #
46
 
--vertical_results
47
 
show slave status;
48
 
 
49
 
# Cleanup (Note that slave IO thread is not running)
50
 
connection slave;
 
61
source include/wait_for_slave_sql_to_start.inc;
 
62
 
 
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)
 
66
 
 
67
--echo ==== Cleanup (Note that slave IO thread is not running) ====
51
68
drop table t1;
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
55
71
 
 
72
--echo [on master]
56
73
connection master;
57
74
drop table t1;
58
 
 
59
 
# end of 4.1 tests