Commit 52066c51 authored by Davi Arnaut's avatar Davi Arnaut

Merge.

parents f972dce2 605ba686
......@@ -4,59 +4,33 @@ reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
==== Create new replication user ====
[on master]
grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl';
[on slave]
stop slave;
change master to master_user='rpl',master_password='rpl';
start slave;
drop table if exists t1;
==== Do replication as new user ====
[on master]
create table t1 (n int);
insert into t1 values (1);
[on slave]
select * from t1;
n
1
delete from mysql.user where user='rpl';
==== Delete new replication user ====
[on master]
drop user rpl@127.0.0.1;
flush privileges;
[on slave]
==== Restart slave without privileges =====
stop slave;
start slave;
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
Master_User rpl
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running Yes
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master NULL
Master_SSL_Verify_Server_Cert No
Last_IO_Errno #
Last_IO_Error #
Last_SQL_Errno 0
Last_SQL_Error
==== Verify that Slave_IO_Running = No ====
Slave_IO_Running = No (should be No)
==== Cleanup (Note that slave IO thread is not running) ====
drop table t1;
delete from mysql.user where user='rpl';
[on master]
drop table t1;
--source include/master-slave.inc
############################################################################
# Test case for BUG#10780
# ==== 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 ====
#
# REQUIREMENT
# A slave without replication privileges should have Slave_IO_Running = No
# BUG#10780: slave can't connect to master - IO and SQL threads running
# 1. Create new replication user
--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';
connection slave;
--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;
# 2. Do replication as new user
--echo ==== Do replication as new user ====
--echo [on master]
connection master;
--disable_warnings
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;
--echo [on slave]
sync_slave_with_master;
select * from t1;
# 3. Delete new replication user
--echo ==== Delete new replication user ====
--echo [on master]
connection master;
delete from mysql.user where user='rpl';
drop user rpl@127.0.0.1;
flush privileges;
connection slave;
# 4. Restart slave without 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;
# 5. Make sure Slave_IO_Running = No
--replace_result $MASTER_MYPORT MASTER_MYPORT
# Column 1 is replaced, since the output can be either
# "Connecting to master" or "Waiting for master update"
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
query_vertical show slave status;
--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)
# Cleanup (Note that slave IO thread is not running)
connection slave;
--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;
# 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