Hi Luis and Davi,
I am afraid that we cannot do what you said.
As the error should be sent to slave by protocol->end_statement(), which
is out of mysql_binlog_send. The faked error has to be kept until has
been sent to slave.
And the low level has been printed to master's error log, before
+ thd->stmt_da->reset_diagnostics_area();
is called. So I think calling thd->stmt_da->reset_diagnostics_area()
at the end of mysql_binlog_send is safe.
On Mon, 2010-12-13 at 07:39 -0200, Davi Arnaut wrote:
> On 12/7/10 9:48 AM, Luís Soares wrote:
> > 1. Using a fake stmt_da during the lifetime of mysql_binlog_send
> > and then setting the correct reference in stmt_da before
> > pushing the error? In such case, we would avoid the explicit
> > reset at the end, something like:
> >
> > mysql_binlog_send(...)
> > {
> > Diagnostics_area fake_da;
> > Diagnostics_area *saved_da= thd->stmt_da;
> > thd->stmt_da= &fake_da;
> >
> > (...)
> >
> > end:
> > thd->stmt_da= saved_da;
> > (...)
> >
> > error:
> > (...)
> > thd->stmt_da= saved_da;
> > my_message(my_errno, errmsg, MYF(0));
> > DBUG_VOID_RETURN;
> > }
>
> Having looked at how the said code does error handling, I agree with
> Luis. If we wish to ignore any pushed errors and generate our own, the
> best thing is to push and pop the diagnostics area.
>
> Regards,
>
> Davi
>
--
Your Sincerely,
Libing Song
==================================
MySQL Replication Team
Software Engineer
Email : Li-Bing.Song@stripped
Skype : libing.song
MSN : slb_database@stripped
Phone : +86 010-6505-4020 ext. 319
Mobile: +86 138-1144-2038
==================================