← Back to team overview

maria-developers team mailing list archive

Re: Conservative parallel slave is "too optimistic" for certain engines


Kristian, Sergey, hello!

> Sergey Petrunia <sergey@xxxxxxxxxxx> writes:
>> == Symptoms == 
>> When one runs a parallel slave (mode=conservative) and replicates DML for 

> Nice analysis. Normally it is guaranteed to be safe to start the next
> transaction in parallel with the commit step of a prior. But as you
> describe, RBR on table with no primary key is special, since it does not
> really correspond to any SQL-level operation.
>> 2. Change parallel slave to wait *for commit*. This should only be done if
>> tables that are updated do not support Gap Locking. This is hard, it will
>> require making risky changes on the SQL layer.
> I think you can just call thd->wait_for_prior_commit() in the code that does
> the RBR table scan on a table with no primary key. Eg.
> Rows_log_event::find_row():
>   if (m_key_info)
>   {
>     ...
>   }
>   else
>   {
>     DBUG_PRINT("info",("locating record using table scan (rnd_next)"));
>     thd->wait_for_prior_commit();
>     ...
>   }
> (Or do it only once, maybe in Rows_log_event::find_key() or similar, and
> only if rli->mi->parallel_mode==SLAVE_PARALLEL_CONSERVATIVE).

Right, without the if the OPTIMISTIC could not be called such :-).
To me it's the best feasible solution, consistent with the name.