diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2019-04-21 13:27:27 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2019-04-25 15:06:40 +0400 |
commit | a168cfb39698d98a9906160a8f60b9522372c5e9 (patch) | |
tree | a678e25265decf1e55aa54ae7814acb93d9f2c7a /sql/transaction.cc | |
parent | f189f34ed4b8e00c7b88253b03ffc271452fe4d5 (diff) | |
download | mariadb-git-a168cfb39698d98a9906160a8f60b9522372c5e9.tar.gz |
Move XID_state::xa_state handing inside xa.cc
Let xid_cache_insert()/xid_cache_delete() handle xa_state.
Let session tracker use is_explicit_XA() rather than xa_state != XA_NOTR.
Fixed open_tables() to refuse data access in XA_ROLLBACK_ONLY state.
Removed dead code from THD::cleanup(). It was supposed to be a reminder,
but it got messed up over time.
spider_internal_start_trx() is called either with XA_NOTR or XA_ACTIVE,
which is guarded by server callers. Thus is_explicit_XA() is acceptable
replacement for XA_ACTIVE check (which was likely wrong anyway).
Setting xa_state to XA_PREPARED in spider_internal_xa_prepare() isn't
meaningful, as this value is never accessed later. It can't be accessed
by current thread and it can't be recovered either. It can only be
accessed by spider internally, which never happens.
Make spider_xa_lock()/spider_xa_unlock() static.
Part of MDEV-7974 - backport fix for mysql bug#12161 (XA and binlog)
Diffstat (limited to 'sql/transaction.cc')
-rw-r--r-- | sql/transaction.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sql/transaction.cc b/sql/transaction.cc index 15c45425528..bb8aaabbcb9 100644 --- a/sql/transaction.cc +++ b/sql/transaction.cc @@ -66,7 +66,6 @@ void trans_reset_one_shot_chistics(THD *thd) /* Conditions under which the transaction state must not change. */ static bool trans_check(THD *thd) { - enum xa_states xa_state= thd->transaction.xid_state.xa_state; DBUG_ENTER("trans_check"); /* @@ -77,8 +76,8 @@ static bool trans_check(THD *thd) if (unlikely(thd->in_sub_stmt)) my_error(ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG, MYF(0)); - if (xa_state != XA_NOTR) - my_error(ER_XAER_RMFAIL, MYF(0), xa_state_names[xa_state]); + if (thd->transaction.xid_state.is_explicit_XA()) + thd->transaction.xid_state.er_xaer_rmfail(); else DBUG_RETURN(FALSE); |