Hi Serge,
I believe your patch is Ok, and adding the parameter to
wait_for_slave_sql_error is a good one. But still I have (a) question(s)
remaining (I may be missing something :) ).
Facts:
- The test fails randomly.
- We are expecting an SQL error. (with wait_for_slave_sql_error.inc)
- The failure occurs at start slave. This means that the previous
wait_for_slave_sql_error must have succeeded (as you pointed out that it
succeeds if any SQL error happens).
- When restarting the server the same duplicate key appears again
(or it is still there).
Question:
- What error was causing the wait_for_slave_sql_error to succeed? If
there was any unexpected SQL error happening before, won't setting
explicitly waiting for 1062 hide that?
I tried to reproduce the faulty behavior with a few runs on my
machine, but was not able to.
If my worries above above do not make sense, then I have no further
objections.
Cheers,
Luís
Serge Kozlov wrote:
> #At file:///home/ksm/sun/repo/bug41186/mysql-6.0-rpl/ based on
> revid:alfranio.correia@stripped
>
> 2747 Serge Kozlov 2008-12-08
> 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.
> modified:
> mysql-test/include/wait_for_slave_sql_error.inc
> mysql-test/suite/rpl/t/rpl_stm_mystery22.test
>
> === modified file 'mysql-test/include/wait_for_slave_sql_error.inc'
> --- a/mysql-test/include/wait_for_slave_sql_error.inc 2008-07-10 16:09:39 +0000
> +++ b/mysql-test/include/wait_for_slave_sql_error.inc 2008-12-07 21:20:59 +0000
> @@ -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= ;
>
> === modified file 'mysql-test/suite/rpl/t/rpl_stm_mystery22.test'
> --- a/mysql-test/suite/rpl/t/rpl_stm_mystery22.test 2008-06-22 20:05:19 +0000
> +++ b/mysql-test/suite/rpl/t/rpl_stm_mystery22.test 2008-12-07 21:20:59 +0000
> @@ -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;
>
>