* Davi Arnaut <Davi.Arnaut@stripped> [08/10/16 19:10]:
> 2707 Davi Arnaut 2008-10-16
> Bug#28323: Server crashed in xid cache operations
>
> The problem was that the server did not robustly handle a
> unilateral roll back issued by the Resource Manager (RM)
> due to a resource deadlock within the transaction branch.
> By not acknowledging the roll back, the server (TM) would
> eventually corrupt the XA transaction state and crash.
>
> The solution is to mark the transaction as rollback-only
> if the RM indicates that it rolled back its branch of the
> transaction.
> +/**
> + Mark a XA transaction as rollback-only if the RM unilaterally
> + rolled back the transaction branch.
> +
> + @note If a rollback was requested by the RM, this function sets
> + the appropriate rollback error code and transits the state
> + to XA_ROLLBACK_ONLY.
> +*/
> +static bool xa_trans_rolled_back(THD *thd, XID_STATE *xid_state)
> +{
> + if (xid_state->rm_error)
> + {
> + switch (xid_state->rm_error) {
You shouldn't be looking at the value of the error code, but
at thd->transaction_rollback_request. Also take a look at
thd_mark_transaction_for_rollback().
--