← Back to team overview

maria-developers team mailing list archive

Re: b723778: MDEV-6997: SET STATEMENT last_insert_id FOR ... does not affect the value written to the binlog

 

Hi, Sanja!

Ok to push, thanks.
But see one confusing typo below.

On Mar 13, sanja@xxxxxxxxxxx wrote:
> revision-id: b7237786f5b8e74ba9558db8325d29a64f1a1d9b
> parent(s): ba3573cae8f0d269452cc6213f1a8243e455830e
> committer: Oleksandr Byelkin
> branch nick: server
> timestamp: 2015-03-13 16:32:47 +0100
> message:
> 
> MDEV-6997: SET STATEMENT last_insert_id FOR ... does not affect the value written to the binlog
> 
> Problem was in reinitialization of first_successful_insert_id_in_prev_stmt_for_binlog after setting variables.
> 
> diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
> index 0837a70..41df891 100644
> --- a/sql/sql_parse.cc
> +++ b/sql/sql_parse.cc
> @@ -2743,6 +2743,18 @@ static bool do_execute_sp(THD *thd, sp_head *sp)
>        lex->restore_set_statement_var();
>        goto error;
>      }
> +    /*
> +      The value of last_insert_id is remembered in THD to be written to binlog

Hmm, I thought you'll put it in the commit comment.
But ok, having it in the code is fine too, whatever you prefer.

> +      when it's used *the first time* in the statement. But SET STATEMENT
> +      must read the old value of last_insert_id to be able to restore it at
> +      the end. This should not count at "reading of last_insert_id" and
> +      should not remember last_insert_id for binlog. That is, it should set

typo: it should *reset* (or *clear*) not *set*

> +      stmt_depends_on_first_successful_insert_id_in_prev_stmt flag.
> +    */
> +    if (!thd->in_sub_stmt)
> +    {
> +      thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
> +    }
>    }

Regards,
Sergei