Commit 210855ce authored by Sergey Vojtovich's avatar Sergey Vojtovich

Move XID_STATE::xid to XID_cache_element

Part of MDEV-7974 - backport fix for mysql bug#12161 (XA and binlog)
parent b7fd7ce2
...@@ -2618,7 +2618,6 @@ class THD: public THD_count, /* this must be first */ ...@@ -2618,7 +2618,6 @@ class THD: public THD_count, /* this must be first */
st_transactions() st_transactions()
{ {
bzero((char*)this, sizeof(*this)); bzero((char*)this, sizeof(*this));
xid_state.xid.null();
implicit_xid.null(); implicit_xid.null();
init_sql_alloc(&mem_root, "THD::transactions", init_sql_alloc(&mem_root, "THD::transactions",
ALLOC_ROOT_MIN_BLOCK_SIZE, 0, ALLOC_ROOT_MIN_BLOCK_SIZE, 0,
......
This diff is collapsed.
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
class XID_cache_element; class XID_cache_element;
struct XID_STATE { struct XID_STATE {
/* For now, this is only used to catch duplicated external xids */
XID xid; // transaction identifier
XID_cache_element *xid_cache_element; XID_cache_element *xid_cache_element;
bool check_has_uncommitted_xa() const; bool check_has_uncommitted_xa() const;
...@@ -34,7 +32,7 @@ struct XID_STATE { ...@@ -34,7 +32,7 @@ struct XID_STATE {
void xid_cache_init(void); void xid_cache_init(void);
void xid_cache_free(void); void xid_cache_free(void);
bool xid_cache_insert(XID *xid); bool xid_cache_insert(XID *xid);
bool xid_cache_insert(THD *thd, XID_STATE *xid_state); bool xid_cache_insert(THD *thd, XID_STATE *xid_state, XID *xid);
void xid_cache_delete(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_start(THD *thd);
......
...@@ -1708,7 +1708,8 @@ int spider_check_and_set_time_zone( ...@@ -1708,7 +1708,8 @@ int spider_check_and_set_time_zone(
} }
static int spider_xa_lock( static int spider_xa_lock(
XID_STATE *xid_state XID_STATE *xid_state,
XID *xid
) { ) {
THD *thd = current_thd; THD *thd = current_thd;
int error_num; int error_num;
...@@ -1726,7 +1727,7 @@ static int spider_xa_lock( ...@@ -1726,7 +1727,7 @@ static int spider_xa_lock(
#endif #endif
old_proc_info = thd_proc_info(thd, "Locking xid by Spider"); old_proc_info = thd_proc_info(thd, "Locking xid by Spider");
#ifdef SPIDER_XID_USES_xid_cache_iterate #ifdef SPIDER_XID_USES_xid_cache_iterate
if (xid_cache_insert(thd, xid_state)) if (xid_cache_insert(thd, xid_state, xid))
{ {
error_num = (spider_stmt_da_sql_errno(thd) == ER_XAER_DUPID ? error_num = (spider_stmt_da_sql_errno(thd) == ER_XAER_DUPID ?
ER_SPIDER_XA_LOCKED_NUM : HA_ERR_OUT_OF_MEM); ER_SPIDER_XA_LOCKED_NUM : HA_ERR_OUT_OF_MEM);
...@@ -1948,11 +1949,10 @@ int spider_internal_start_trx( ...@@ -1948,11 +1949,10 @@ int spider_internal_start_trx(
thd->server_id)); thd->server_id));
#endif #endif
trx->internal_xid_state.xid.set(&trx->xid);
#ifdef SPIDER_XID_STATE_HAS_in_thd #ifdef SPIDER_XID_STATE_HAS_in_thd
trx->internal_xid_state.in_thd = 1; trx->internal_xid_state.in_thd = 1;
#endif #endif
if ((error_num = spider_xa_lock(&trx->internal_xid_state))) if ((error_num = spider_xa_lock(&trx->internal_xid_state, &trx->xid)))
{ {
if (error_num == ER_SPIDER_XA_LOCKED_NUM) if (error_num == ER_SPIDER_XA_LOCKED_NUM)
my_message(error_num, ER_SPIDER_XA_LOCKED_STR, MYF(0)); my_message(error_num, ER_SPIDER_XA_LOCKED_STR, MYF(0));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment