From 755bcd99c0520e6e3ed1ac51726ec32c87553ea2 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Fri, 12 Dec 2008 14:25:36 +0300 Subject: [PATCH 1/4] Bug#40142: possible reason of timeout is stopped slave threads before sync_with_master command. The patch add waiting of proper state of slave before sync with master. --- mysql-test/suite/rpl/t/rpl_start_stop_slave.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test index 93c613f4cf4..dbf0775c978 100644 --- a/mysql-test/suite/rpl/t/rpl_start_stop_slave.test +++ b/mysql-test/suite/rpl/t/rpl_start_stop_slave.test @@ -25,6 +25,7 @@ let $wait_condition= SELECT COUNT(*) > 0 FROM t1; source include/wait_condition.inc; stop slave io_thread; start slave io_thread; +source include/wait_for_slave_to_start.inc; sync_with_master; connection master; From 4ae3c11cca21864042709fd820ff9531206b1f47 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Fri, 12 Dec 2008 14:34:18 +0300 Subject: [PATCH 2/4] Bug#41108: It is a testcase timeout bug so the patch fixes test code in places where timeout can happen: 1. Added waiting start/stop slave to make sure that slave works properly. 2. Added cleanup for slave. 3. Updated related result files. --- mysql-test/extra/rpl_tests/rpl_flsh_tbls.test | 19 ++++++++++++------- .../suite/rpl/r/rpl_row_flsh_tbls.result | 1 + .../suite/rpl/r/rpl_stm_flsh_tbls.result | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test index ee6b0ed1426..0baf49c9fac 100644 --- a/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test +++ b/mysql-test/extra/rpl_tests/rpl_flsh_tbls.test @@ -4,8 +4,7 @@ # Test of FLUSH NO_WRITE_TO_BINLOG by the way. # - --- source include/master-slave.inc +source include/master-slave.inc; let $SERVER_VERSION=`select version()`; @@ -34,26 +33,32 @@ flush tables; --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ eval SHOW BINLOG EVENTS FROM $rename_event_pos ; -save_master_pos; -connection slave; -sync_with_master; + +sync_slave_with_master; # Check that the slave is not confused. select * from t3; # Note that all this confusion may cause warnings 'table xx is open on rename' # in the .err files; these are not fatal and are not reported by mysql-test-run. - stop slave; +source include/wait_for_slave_to_stop.inc; + connection master; drop table t1; + connection slave; flush tables with read lock; start slave; -sleep 1; +source include/wait_for_slave_to_start.inc; --error 1192 stop slave; +# Cleanup +unlock tables; + connection master; drop table t3, t4, t5; +sync_slave_with_master; + # End of 4.1 tests diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result index 09626754428..129bad0fbcc 100644 --- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result @@ -30,4 +30,5 @@ flush tables with read lock; start slave; stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +unlock tables; drop table t3, t4, t5; diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result index 1c6b5615b6e..74031af1dde 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result @@ -30,4 +30,5 @@ flush tables with read lock; start slave; stop slave; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +unlock tables; drop table t3, t4, t5; From aa78bb303030377b6b153a82ecdc4a1dbdbfc4f2 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Fri, 12 Dec 2008 14:40:22 +0300 Subject: [PATCH 3/4] Bug#41186: Possible reason of bug is waiting any sql error on slave instead exact number of error. The patch does following: 1) Add new parameter $slave_sql_errno for wait_for_slave_sql_error.inc 2) Add waiting error 1062 (Duplicate PK) for slave SQL thread in test case. --- .../include/wait_for_slave_sql_error.inc | 20 ++++++++++++++++--- mysql-test/suite/rpl/t/rpl_stm_mystery22.test | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/wait_for_slave_sql_error.inc b/mysql-test/include/wait_for_slave_sql_error.inc index c454e3eb4d7..2d392f0e761 100644 --- a/mysql-test/include/wait_for_slave_sql_error.inc +++ b/mysql-test/include/wait_for_slave_sql_error.inc @@ -7,15 +7,29 @@ # # source include/wait_for_slave_sql_error.inc; # -# Parameters to this macro are $slave_timeout and -# $slave_keep_connection. See wait_for_slave_param.inc for -# descriptions. +# Parameters: +# +# $slave_sql_errno +# Number of expected SQL error. If it skipped then any error +# will pass. +# +# $slave_timeout and +# See wait_for_slave_param.inc for descriptions. +# +# $slave_keep_connection. +# See wait_for_slave_param.inc for descriptions. let $old_slave_param_comparison= $slave_param_comparison; let $slave_param= Last_SQL_Errno; let $slave_param_comparison= !=; let $slave_param_value= 0; + +if ($slave_sql_errno) { + let $slave_param_comparison= =; + let $slave_param_value= $slave_sql_errno; +} + let $slave_error_message= Failed while waiting for slave to produce an error in its sql thread; source include/wait_for_slave_param.inc; let $slave_error_message= ; diff --git a/mysql-test/suite/rpl/t/rpl_stm_mystery22.test b/mysql-test/suite/rpl/t/rpl_stm_mystery22.test index b43a734fffc..171bd9d5531 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_mystery22.test +++ b/mysql-test/suite/rpl/t/rpl_stm_mystery22.test @@ -28,6 +28,7 @@ insert into t1 values(NULL,'new'); save_master_pos; connection slave; # wait until the slave tries to run the query, fails and aborts slave thread +let $slave_sql_errno= 1062; source include/wait_for_slave_sql_error.inc; select * from t1 order by n; delete from t1 where n = 2; From fab8d1b460c949d2ca58c81244a223b6894ebc53 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 12 Dec 2008 23:51:44 +0200 Subject: [PATCH 4/4] Bug #40129 no-threads fails on pushbuild in 6.0-rpl, ps_stm_threadpool The test reacted on the way how mtr orders arguments for the server that are gathered from different source. It appeared that the opt-file options were parsed before those that supplied to mtr via its command line. In effect, the opt-file preferences got overriden by the command line and some tests, like no-threads, were caught by surprise: a test expects an option value that had been "hardcoded" into its opt-file but gets another one. This server options ordering problem exists on in the new rpl trees mtr. In option of the author of this patch, the opt-file shall be considered as having the highest preference weight. The opt-file is merely a part of the header of a test, namely a part that can not be technically deployed along the test file. It's unnatural for the test writer to provide both the opt file value and a guard that guarantees the value will be set on in the run time. It's logical to provide either one: the option and its value or the guard. Fixed with relocating parse of the opt file to be the last among sources of the sever's options. A side effect: fixing a small problem of resetting the suite options at time the opt file starts parsing. A side effect: main.log_bin_trust_function_creators_func is disabled to be re-enabled with the fixes for bug#41003 will be merged from the main trees. mysql-test/lib/mtr_cases.pm: Relocating parse of the opt file to be the last. This ensure the opt file is the last provider for the server options so that the opt-file options have the highest preference; fixing a separate issue of incorrect resetting the suite options for the server; mysql-test/t/disabled.def: log_bin_trust_function_creators_func is disabled. Todo: to-reable when fixes for bug#41003 will be merged from the main trees. --- mysql-test/lib/mtr_cases.pm | 22 ++++++++++------------ mysql-test/t/disabled.def | 1 + 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 577bc0c6438..6579a6e8af0 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -580,7 +580,6 @@ sub optimize_cases { sub process_opts_file { my ($tinfo, $opt_file, $opt_name)= @_; - $tinfo->{$opt_name}= []; if ( -f $opt_file ) { my $opts= opts_from_file($opt_file); @@ -756,17 +755,6 @@ sub collect_one_test_case { push(@{$tinfo->{'master_opt'}}, @$suite_opts); push(@{$tinfo->{'slave_opt'}}, @$suite_opts); - # ---------------------------------------------------------------------- - # Add master opts, extra options only for master - # ---------------------------------------------------------------------- - process_opts_file($tinfo, "$testdir/$tname-master.opt", 'master_opt'); - - # ---------------------------------------------------------------------- - # Add slave opts, list of extra option only for slave - # ---------------------------------------------------------------------- - process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt'); - - #----------------------------------------------------------------------- # Check for test specific config file #----------------------------------------------------------------------- @@ -987,6 +975,16 @@ sub collect_one_test_case { push(@{$tinfo->{'master_opt'}}, @::opt_extra_mysqld_opt); push(@{$tinfo->{'slave_opt'}}, @::opt_extra_mysqld_opt); + # ---------------------------------------------------------------------- + # Add master opts, extra options only for master + # ---------------------------------------------------------------------- + process_opts_file($tinfo, "$testdir/$tname-master.opt", 'master_opt'); + + # ---------------------------------------------------------------------- + # Add slave opts, list of extra option only for slave + # ---------------------------------------------------------------------- + process_opts_file($tinfo, "$testdir/$tname-slave.opt", 'slave_opt'); + return $tinfo; } diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index d21842b7141..e9357c2c048 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -24,3 +24,4 @@ sql_low_priority_updates_func : BUG#37962 2008-07-08 sven *_func tests c timestamp_func : BUG#37962 2008-07-08 sven *_func tests containing sleeps/race conditions log_output_func : BUG#37766 2008-07-10 sven main.log_output_func randomly fails in pushbuild slow_query_log_func.test : Bug #37962: *_func tests containing sleeps/race conditions +log_bin_trust_function_creators_func : Bug#41003 Dec-12-2008 andrei todo:re-enable after merging the bug fixes from the main trees.