List:Internals« Previous MessageNext Message »
From:Zardosht Kasheff Date:June 21 2012 2:45pm
Subject:Re: purpose of thd_mark_transaction_to_rollback
View as plain text  
Here is a problem I am encountering, and I don't understand what
MySQL's specification and how it relates to the XA spec found in
http://pubs.opengroup.org/onlinepubs/009680699/toc.pdf

when in an XA transaction, if one of the statements returns a deadlock
detected, and the user then runs "xa end", for InnoDB, XA_RBDEADLOCK
is returned, but for us, nothing is returned. The reason is that
InnoDB executes thd_mark_transaction_to_rollback.

What I want to know is if our engine hits a deadlock, and we have NOT
aborted the transaction internally, are we required to call
thd_mark_transaction_to_rollback so that "xa end" properly then
returns the right error. If so, this seems weird, as MySQL got the
error code earlier, and MySQL should just ensure that "xa end" returns
the right error without requiring the engine to make an additional
call.

Thoughts?

On Thu, Jun 21, 2012 at 12:35 AM, Stewart Smith
<stewart@stripped> wrote:
> On Wed, 20 Jun 2012 13:22:50 -0400, Zardosht Kasheff <zardosht@stripped>
> wrote:
>> Thank you for your response. Why does InnoDB do this when a deadlock
>> is detected? Does every storage engine need to do this? Is this part
>> of some specification that calls for this? Or is it some sort of
>> performance optimization?
>
> Any storage engine that initiates rollback needs to call it. This
> basically means any transactional engine, as there are situtions where
> ROLLBACK is inevitable (e.g. ENOSPC if you're lucky enough to be able to
> handle it).
>
> It's not a performance optimization, it's about correctness. This is
> telling the MySQL server that anybody else involved in the transaction
> should now execute ROLLBACK as you've already done it. e.g. to ensure
> that binlog doesn't contain operations that have been rolled back by
> your engine.
>
> --
> Stewart Smith
Thread
purpose of thd_mark_transaction_to_rollbackZardosht Kasheff19 Jun
  • Re: purpose of thd_mark_transaction_to_rollbackDmitry Lenev19 Jun
    • Re: purpose of thd_mark_transaction_to_rollbackZardosht Kasheff20 Jun
      • Re: purpose of thd_mark_transaction_to_rollbackStewart Smith21 Jun
        • Re: purpose of thd_mark_transaction_to_rollbackZardosht Kasheff21 Jun
          • Re: purpose of thd_mark_transaction_to_rollbackStewart Smith22 Jun
      • Re: purpose of thd_mark_transaction_to_rollbackDmitry Lenev21 Jun