From f1a5003548b3f119b6ef00f87f60cab6efafc4ec Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 13 Apr 2006 20:42:48 +0200 Subject: [PATCH] Fixes for Bug#12429: Replication tests fail: "Slave_IO_Running" (?) differs related to MySQL 4.1 and Bug#16920 rpl_deadlock_innodb fails in show slave status (reported for MySQL 5.1) - backport of several fixes done in MySQL 5.0 to 4.1 - fix for new discovered instability (see comment on Bug#12429 + Bug#16920) - reenabling of testcases mysql-test/r/rpl_deadlock.result: Updated results mysql-test/r/rpl_relayrotate.result: Updated results mysql-test/t/disabled.def: Reenabling of tests mysql-test/t/rpl_deadlock.test: - replace sleep with real_sleep (backport fix for Bug#15624 MySQL 5.0) - egalized value for Slave_IO_Running - line 105 (backport fix for Bug#12429 MySQL 5.0) - line 85 (see comment in Bug#12429 + Bug#16920 rpl_deadlock_innodb fails in show slave status) - improve readability of show slave status output (--vertical_results) mysql-test/t/rpl_relayrotate.test: - Replace select ... with select max(a) - add sync_with_master (backport fix done by Kristian in MySQL 5.0 because of timing problems similar to Bug#15624) mysql-test/t/rpl_until.test: Add wait_for_slave_to_stop like in the current MySQL 5.0 version of this test. I assume this makes the test results more predictable. --- mysql-test/r/rpl_deadlock.result | 105 ++++++++++++++++++++++++++-- mysql-test/r/rpl_relayrotate.result | 7 +- mysql-test/t/disabled.def | 3 - mysql-test/t/rpl_deadlock.test | 16 +++-- mysql-test/t/rpl_relayrotate.test | 8 +-- mysql-test/t/rpl_until.test | 4 ++ 6 files changed, 119 insertions(+), 24 deletions(-) diff --git a/mysql-test/r/rpl_deadlock.result b/mysql-test/r/rpl_deadlock.result index 8eb9d64fcae..db88cf73c03 100644 --- a/mysql-test/r/rpl_deadlock.result +++ b/mysql-test/r/rpl_deadlock.result @@ -44,8 +44,39 @@ select * from t2; a 22 show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 13110 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +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 13110 +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 # stop slave; change master to master_log_pos=401; begin; @@ -62,8 +93,39 @@ select * from t2; a 22 show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 13110 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +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 13110 +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 # set global max_relay_log_size=0; stop slave; change master to master_log_pos=401; @@ -82,6 +144,37 @@ select * from t2; a 22 show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master -# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 13110 # # master-bin.000001 Yes Yes 0 0 13110 # None 0 No # +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_MYPORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 13110 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running # +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 13110 +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 # drop table t1,t2,t3,t4; diff --git a/mysql-test/r/rpl_relayrotate.result b/mysql-test/r/rpl_relayrotate.result index bf9bbbb9b93..20f19973d83 100644 --- a/mysql-test/r/rpl_relayrotate.result +++ b/mysql-test/r/rpl_relayrotate.result @@ -10,10 +10,7 @@ reset slave; start slave; stop slave; start slave; -select master_pos_wait('master-bin.001',3000)>=0; -master_pos_wait('master-bin.001',3000)>=0 -1 -select * from t1 where a=8000; -a +select max(a) from t1; +max(a) 8000 drop table t1; diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 3eae8d230d8..9bfe9567d83 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -10,6 +10,3 @@ # ############################################################################## -rpl_relayrotate : Unstable test case, bug#12429 -rpl_until : Unstable test case, bug#12429 -rpl_deadlock : Unstable test case, bug#12429 diff --git a/mysql-test/t/rpl_deadlock.test b/mysql-test/t/rpl_deadlock.test index d3bc31addff..e8ba6d6faec 100644 --- a/mysql-test/t/rpl_deadlock.test +++ b/mysql-test/t/rpl_deadlock.test @@ -58,7 +58,7 @@ while ($1) enable_query_log; select * from t1 for update; start slave; ---sleep 3 # hope that slave is blocked now +--real_sleep 3 # hope that slave is blocked now insert into t2 values(22); # provoke deadlock, slave should be victim commit; sync_with_master; @@ -67,7 +67,9 @@ select * from t2; # check that no error is reported --replace_column 1 # 8 # 9 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT +--vertical_results show slave status; +--horizontal_results # 2) Test lock wait timeout @@ -76,15 +78,17 @@ change master to master_log_pos=401; # the BEGIN log event begin; select * from t2 for update; # hold lock start slave; ---sleep 10 # slave should have blocked, and be retrying +--real_sleep 10 # slave should have blocked, and be retrying commit; sync_with_master; select * from t1; # check that slave succeeded finally select * from t2; # check that no error is reported ---replace_column 1 # 8 # 9 # 23 # 33 # +--replace_column 1 # 8 # 9 # 11 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT +--vertical_results show slave status; +--horizontal_results # Now we repeat 2), but with BEGIN in the same relay log as # COMMIT (to see if seeking into hot log is ok). @@ -97,14 +101,16 @@ change master to master_log_pos=401; begin; select * from t2 for update; start slave; ---sleep 10 +--real_sleep 10 commit; sync_with_master; select * from t1; select * from t2; ---replace_column 1 # 8 # 9 # 23 # 33 # +--replace_column 1 # 8 # 9 # 11 # 23 # 33 # --replace_result $MASTER_MYPORT MASTER_MYPORT +--vertical_results show slave status; +--horizontal_results connection master; drop table t1,t2,t3,t4; diff --git a/mysql-test/t/rpl_relayrotate.test b/mysql-test/t/rpl_relayrotate.test index 1dab8bf4ed5..04f03367e20 100644 --- a/mysql-test/t/rpl_relayrotate.test +++ b/mysql-test/t/rpl_relayrotate.test @@ -52,11 +52,9 @@ start slave; # which proves that the transaction restarted at # the right place. # We must wait for the transaction to commit before -# reading, MASTER_POS_WAIT() will do it for sure -# (the only statement with position>=3000 is COMMIT). -select master_pos_wait('master-bin.001',3000)>=0; -select * from t1 where a=8000; - +# reading: +sync_with_master; +select max(a) from t1; connection master; # The following DROP is a very important cleaning task: diff --git a/mysql-test/t/rpl_until.test b/mysql-test/t/rpl_until.test index 57ebc67db1d..990f00fdc63 100644 --- a/mysql-test/t/rpl_until.test +++ b/mysql-test/t/rpl_until.test @@ -26,6 +26,7 @@ show binlog events; connection slave; start slave until master_log_file='master-bin.000001', master_log_pos=244; sleep 2; +wait_for_slave_to_stop; # here table should be still not deleted select * from t1; --replace_result $MASTER_MYPORT MASTER_MYPORT @@ -37,6 +38,7 @@ start slave until master_log_file='master-no-such-bin.000001', master_log_pos=29 # again this table should be still not deleted select * from t1; sleep 2; +wait_for_slave_to_stop; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # show slave status; @@ -44,6 +46,7 @@ show slave status; # try replicate all until second insert to t2; start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=537; sleep 4; +wait_for_slave_to_stop; select * from t2; --replace_result $MASTER_MYPORT MASTER_MYPORT --replace_column 1 # 9 # 11 # 23 # 33 # @@ -61,6 +64,7 @@ stop slave; start slave until master_log_file='master-bin.000001', master_log_pos=561; # 2 is not enough when running with valgrind --real_sleep 4 +wait_for_slave_to_stop; # here the sql slave thread should be stopped --replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004 --replace_column 1 # 9 # 23 # 33 #