mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
a168cfb396
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)
46 lines
1.7 KiB
C++
46 lines
1.7 KiB
C++
/*
|
|
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
|
Copyright (c) 2009, 2019, MariaDB Corporation.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
|
|
enum xa_states {XA_NOTR=0, XA_ACTIVE, XA_IDLE, XA_PREPARED, XA_ROLLBACK_ONLY};
|
|
class XID_cache_element;
|
|
|
|
struct XID_STATE {
|
|
/* For now, this is only used to catch duplicated external xids */
|
|
XID xid; // transaction identifier
|
|
enum xa_states xa_state; // used by external XA only
|
|
XID_cache_element *xid_cache_element;
|
|
|
|
bool check_has_uncommitted_xa() const;
|
|
bool is_explicit_XA() const { return xid_cache_element != 0; }
|
|
void set_error(uint error);
|
|
void er_xaer_rmfail() const;
|
|
};
|
|
|
|
void xid_cache_init(void);
|
|
void xid_cache_free(void);
|
|
bool xid_cache_insert(XID *xid);
|
|
bool xid_cache_insert(THD *thd, XID_STATE *xid_state);
|
|
void xid_cache_delete(THD *thd, XID_STATE *xid_state);
|
|
|
|
bool trans_xa_start(THD *thd);
|
|
bool trans_xa_end(THD *thd);
|
|
bool trans_xa_prepare(THD *thd);
|
|
bool trans_xa_commit(THD *thd);
|
|
bool trans_xa_rollback(THD *thd);
|
|
bool mysql_xa_recover(THD *thd);
|