List:Commits« Previous MessageNext Message »
From:Sven Sandberg Date:May 26 2008 1:06pm
Subject:commit into mysql-5.1 branch (sven:2654) Bug#36826
View as plain text  
#At file:///home/sven/bzr/b36826-pb_rpl_slave_status/5.1-bugteam/

 2654 Sven Sandberg	2008-05-26
      BUG#36826: rpl_slave_status fails sporadically in pushbuild
      rpl_slave_status failed on pushbuild. The slave stopped with an
      error. Adding sync_slave_with_master fixes the problem. Updated
      test case. 
modified:
  mysql-test/suite/rpl/r/rpl_slave_status.result
  mysql-test/suite/rpl/t/rpl_slave_status.test

per-file comments:
  mysql-test/suite/rpl/r/rpl_slave_status.result
    Updated result file.
  mysql-test/suite/rpl/t/rpl_slave_status.test
    - Added comment explaining what the test does.
    - Added sync_slave_with_master in two places where it was missing. This
      caused sporadic pushbuild errors.
    - Added wait_for_slave_to_{start,stop} after {START,STOP} SLAVE queries.
    - Removed 'drop table if exists' from setup code.
    - Replaced save_master_pos;connection slave;sync_with_master by
      sync_slave_with_master.
    - Replaced 'delete from mysql.user' by 'drop user'.
    - Wrapped 'show slave status' inside query_get_value(), so that only what
      we test is in the output.

=== modified file 'mysql-test/suite/rpl/r/rpl_slave_status.result'
--- a/mysql-test/suite/rpl/r/rpl_slave_status.result	2008-03-12 12:07:35 +0000
+++ b/mysql-test/suite/rpl/r/rpl_slave_status.result	2008-05-26 13:06:49 +0000
@@ -4,59 +4,33 @@
 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@stripped 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@stripped;
 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;

=== modified file 'mysql-test/suite/rpl/t/rpl_slave_status.test'
--- a/mysql-test/suite/rpl/t/rpl_slave_status.test	2008-05-16 16:03:50 +0000
+++ b/mysql-test/suite/rpl/t/rpl_slave_status.test	2008-05-26 13:06:49 +0000
@@ -1,60 +1,73 @@
+# ==== 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 ====
+#
+# BUG#10780: slave can't connect to master - IO and SQL threads running
+
 --source include/master-slave.inc
 
-############################################################################
-# Test case for BUG#10780
-#
-# REQUIREMENT
-#   A slave without replication privileges should have Slave_IO_Running = No
-
-# 1. Create new replication user
+--echo ==== Create new replication user ====
+--echo [on master]
 connection master;
 grant replication slave on *.* to rpl@stripped 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@stripped;
 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

Thread
commit into mysql-5.1 branch (sven:2654) Bug#36826Sven Sandberg26 May