| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Verify that a slave without replication privileges has |
| 4 |
# Slave_IO_Running = No |
| 5 |
# Check that relay_log_status doesn't change by CHANGE MASTER |
| 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 |
|
| 21 |
--source include/master-slave.inc |
| 22 |
|
| 23 |
--echo ==== Create new replication user ==== |
| 24 |
connection master; |
| 25 |
GRANT REPLICATION SLAVE ON *.* TO [email protected] IDENTIFIED BY 'rpl'; |
| 26 |
|
| 27 |
sync_slave_with_master; |
| 28 |
source include/stop_slave.inc; |
| 29 |
|
| 30 |
# Test that relay_log_purge doesn't change because of CHANGE MASTER |
| 31 |
set @save_relay_log_purge=@@global.relay_log_purge; |
| 32 |
set @@global.relay_log_purge=0; |
| 33 |
CHANGE MASTER TO master_user='rpl', master_password='rpl'; |
| 34 |
select @@global.relay_log_purge; |
| 35 |
set @@global.relay_log_purge=1; |
| 36 |
CHANGE MASTER TO master_user='rpl', master_password='rpl'; |
| 37 |
select @@global.relay_log_purge; |
| 38 |
set @@global.relay_log_purge=@save_relay_log_purge; |
| 39 |
|
| 40 |
CHANGE MASTER TO master_user='rpl', master_password='rpl'; |
| 41 |
source include/start_slave.inc; |
| 42 |
|
| 43 |
--echo ==== Do replication as new user ==== |
| 44 |
connection master; |
| 45 |
CREATE TABLE t1 (n INT); |
| 46 |
INSERT INTO t1 VALUES (1); |
| 47 |
sync_slave_with_master; |
| 48 |
SELECT * FROM t1; |
| 49 |
|
| 50 |
--echo ==== Delete new replication user ==== |
| 51 |
connection master; |
| 52 |
DROP USER [email protected]; |
| 53 |
FLUSH PRIVILEGES; |
| 54 |
|
| 55 |
sync_slave_with_master; |
| 56 |
|
| 57 |
--echo ==== Restart slave without privileges ===== |
| 58 |
# (slave.err will contain access denied error for this START SLAVE command) |
| 59 |
source include/stop_slave.inc; |
| 60 |
START SLAVE; |
| 61 |
source include/wait_for_slave_sql_to_start.inc; |
| 62 |
|
| 63 |
--echo ==== Verify that Slave IO thread stopped with error ==== |
| 64 |
# 1045 = ER_ACCESS_DENIED_ERROR |
| 65 |
--let $slave_io_errno= 1045 |
| 66 |
--source include/wait_for_slave_io_error.inc |
| 67 |
|
| 68 |
--echo ==== Cleanup (Note that slave IO thread is not running) ==== |
| 69 |
|
| 70 |
# cleanup: slave io thread is stopped so we reset replication |
| 71 |
--source include/stop_slave_sql.inc |
| 72 |
CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = ''; |
| 73 |
# clear Slave_IO_Errno |
| 74 |
--let $rpl_only_running_threads= 1 |
| 75 |
--source include/rpl_reset.inc |
| 76 |
|
| 77 |
connection master; |
| 78 |
DROP TABLE t1; |
| 79 |
|
| 80 |
--source include/rpl_end.inc |