List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:April 13 2011 12:14pm
Subject:Re: bzr commit into mysql-5.5 branch (jon.hauglid:3440) Bug#12352846
View as plain text  
Hi Jon,

On 4/13/11 7:44 AM, Jon Olav Hauglid wrote:
> #At file:///export/home/x/mysql-5.5-bug12352846/ based on
> revid:dmitry.lenev@stripped
>
>   3440 Jon Olav Hauglid	2011-04-13
>        Bug#12352846 - TRANS_XA_START(THD*):
>                       ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL()
>                       FAILED
>
>        The triggered assert checks that the previous XA transaction has
>        done proper cleanup before a new XA transaction is started.
>        The bug that caused it to be triggered was that XA COMMIT did not
>        clean up error state if XA COMMIT discovered that the current XA
>        transaction had to be rolled back.
>
>        This patch fixes the problem by resetting the XA error state
>        before XA COMMIT calls ha_rollback_trans(). This allows following
>        XA transactions to be started without triggering the assert.
>

[...]

>
> === modified file 'sql/transaction.cc'
> --- a/sql/transaction.cc	2011-04-12 10:57:02 +0000
> +++ b/sql/transaction.cc	2011-04-13 10:44:48 +0000
> @@ -649,6 +649,12 @@ bool trans_xa_commit(THD *thd)
>
>     if (xa_trans_rolled_back(&thd->transaction.xid_state))
>     {
> +    /*
> +      We must reset rm_error before calling ha_rollback(),
> +      so thd->transaction.xid structure gets reset
> +      by ha_rollback()/THD::transaction::cleanup().
> +    */
> +    thd->transaction.xid_state.rm_error= 0;
>       if (ha_rollback_trans(thd, TRUE))
>         my_error(ER_XAER_RMERR, MYF(0));

There is another piece of code exactly like this in trans_xa_rollback:

   /*
     Resource Manager error is meaningless at this point, as we perform
     explicit rollback request by user. We must reset rm_error before
     calling ha_rollback(), so thd->transaction.xid structure gets reset
     by ha_rollback()/THD::transaction::cleanup().
   */
   thd->transaction.xid_state.rm_error= 0;
   if ((res= test(ha_rollback_trans(thd, TRUE))))
     my_error(ER_XAER_RMERR, MYF(0));

Can you combine these two in a single static function? Suggest to name 
it to something around the lines of xa_trans_force_rollback(). Use the 
comments to form a new doxygen comment for the function.

Regards,

Davi
Thread
bzr commit into mysql-5.5 branch (jon.hauglid:3440) Bug#12352846Jon Olav Hauglid13 Apr
  • Re: bzr commit into mysql-5.5 branch (jon.hauglid:3440) Bug#12352846Davi Arnaut13 Apr