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
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
On Thu, Jun 21, 2012 at 12:35 AM, Stewart Smith
> On Wed, 20 Jun 2012 13:22:50 -0400, Zardosht Kasheff <zardosht@stripped>
>> 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