Sergei, hello.
> #At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0-sea
>
> 2697 Serge Kozlov 2008-09-15
> Bug#37716. Remove real_sleep and and waiting proper values of
> Read_Master_Log_Pos and
> Exec_Master_Log_Pos on slave.
Sure the sleep should be removed.
That's right to wait for a proper status on the slave side, but it can
not be Exec_Master_Log_Pos because it's set after a transaction is
committed on slave.
> modified:
> mysql-test/extra/rpl_tests/rpl_deadlock.test
>
> === modified file 'mysql-test/extra/rpl_tests/rpl_deadlock.test'
> --- a/mysql-test/extra/rpl_tests/rpl_deadlock.test 2008-02-03 09:00:49 +0000
> +++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test 2008-09-15 07:46:42 +0000
> @@ -44,6 +44,7 @@ enable_query_log;
> insert into t1 values(1);
> commit;
> save_master_pos;
> +let $master_pos= query_get_value(show master status, Position, 1);
>
> connection slave;
> begin;
In our case the transaction is going to deadlock
and as it must happen the slave should have Last_SQL_Errno to
correspond to the deadlock error code.
I think these pair what should be waited for instead of your try below.
> @@ -59,12 +60,15 @@ enable_query_log;
> select * from t1 for update; # t1,t2 on local slave's
> start slave;
>
> -# bad option, todo: replicate a non-transactional t_sync with the transaction
> -# and use wait_until_rows_count macro below
> ---real_sleep 3 # hope that slave is blocked now
> -#let $count=11;
> -#let $table=t_sync;
> -#--include wait_until_rows_count.inc
This alternative i wrote w/o knowing about wait_for_slave_param the
wonderful macro.
> +# wait while slave read all events from master
> +let $slave_param= Read_Master_Log_Pos;
> +let $slave_param_value= $master_pos;
> +--source include/wait_for_slave_param.inc
> +
> +# wait while slave executed up to start of transaction
> +let $slave_param= Exec_Master_Log_Pos;
> +let $slave_param_value= 549;
> +--source include/wait_for_slave_param.inc
>
> select * from t2 for update /* dl */; # provoke deadlock, repl-ed
> should be victim
let $slave_param=Last_SQL_Errno
let $slave_param_value= `ER_LOCK_DEADLOCK' // don't know how not to
// use the actual number
// maybe you can figure
// that out
--source include/wait_for_slave_param.inc
Does it look okay for you?
cheers,
Andrei