Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
b7fd7ce2
Commit
b7fd7ce2
authored
Apr 19, 2019
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved normal transaction xid to implicit_xid
Part of MDEV-7974 - backport fix for mysql bug#12161 (XA and binlog)
parent
228514e5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
16 deletions
+26
-16
sql/handler.cc
sql/handler.cc
+9
-3
sql/session_tracker.cc
sql/session_tracker.cc
+1
-1
sql/sql_class.cc
sql/sql_class.cc
+5
-3
sql/sql_class.h
sql/sql_class.h
+3
-3
sql/wsrep_applier.cc
sql/wsrep_applier.cc
+0
-6
sql/xa.cc
sql/xa.cc
+7
-0
sql/xa.h
sql/xa.h
+1
-0
No files found.
sql/handler.cc
View file @
b7fd7ce2
...
@@ -1199,8 +1199,11 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
...
@@ -1199,8 +1199,11 @@ void trans_register_ha(THD *thd, bool all, handlerton *ht_arg)
ha_info->register_ha(trans, ht_arg);
ha_info->register_ha(trans, ht_arg);
trans->no_2pc|=(ht_arg->prepare==0);
trans->no_2pc|=(ht_arg->prepare==0);
if
(
thd
->
transaction
.
xid_state
.
xid
.
is_null
())
thd
->
transaction
.
xid_state
.
xid
.
set
(
thd
->
query_id
);
/* Set implicit xid even if there's explicit XA, it will be ignored anyway. */
if (thd->transaction.implicit_xid.is_null())
thd->transaction.implicit_xid.set(thd->query_id);
DBUG_VOID_RETURN;
DBUG_VOID_RETURN;
}
}
...
@@ -1541,7 +1544,10 @@ int ha_commit_trans(THD *thd, bool all)
...
@@ -1541,7 +1544,10 @@ int ha_commit_trans(THD *thd, bool all)
need_prepare_ordered= FALSE;
need_prepare_ordered= FALSE;
need_commit_ordered= FALSE;
need_commit_ordered= FALSE;
xid
=
thd
->
transaction
.
xid_state
.
xid
.
get_my_xid
();
DBUG_ASSERT(thd->transaction.implicit_xid.get_my_xid() ==
thd->transaction.implicit_xid.quick_get_my_xid());
xid= thd->transaction.xid_state.is_explicit_XA() ? 0 :
thd->transaction.implicit_xid.quick_get_my_xid();
for (Ha_trx_info *hi= ha_info; hi; hi= hi->next())
for (Ha_trx_info *hi= ha_info; hi; hi= hi->next())
{
{
...
...
sql/session_tracker.cc
View file @
b7fd7ce2
...
@@ -1285,7 +1285,7 @@ bool Transaction_state_tracker::store(THD *thd, String *buf)
...
@@ -1285,7 +1285,7 @@ bool Transaction_state_tracker::store(THD *thd, String *buf)
if
((
tx_curr_state
&
TX_EXPLICIT
)
&&
is_xa
)
if
((
tx_curr_state
&
TX_EXPLICIT
)
&&
is_xa
)
{
{
XID
*
xid
=
&
thd
->
transaction
.
xid_state
.
xid
;
XID
*
xid
=
thd
->
transaction
.
xid_state
.
get_xid
()
;
long
glen
,
blen
;
long
glen
,
blen
;
buf
->
append
(
STRING_WITH_LEN
(
"XA START"
));
buf
->
append
(
STRING_WITH_LEN
(
"XA START"
));
...
...
sql/sql_class.cc
View file @
b7fd7ce2
...
@@ -1159,10 +1159,12 @@ void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid)
...
@@ -1159,10 +1159,12 @@ void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid)
if
(
!
thd
->
wsrep_xid
.
is_null
())
if
(
!
thd
->
wsrep_xid
.
is_null
())
{
{
*
xid
=
*
(
MYSQL_XID
*
)
&
thd
->
wsrep_xid
;
*
xid
=
*
(
MYSQL_XID
*
)
&
thd
->
wsrep_xid
;
return
;
}
}
else
#endif
/* WITH_WSREP */
#endif
/* WITH_WSREP */
*
xid
=
*
(
MYSQL_XID
*
)
&
thd
->
transaction
.
xid_state
.
xid
;
*
xid
=
thd
->
transaction
.
xid_state
.
is_explicit_XA
()
?
*
(
MYSQL_XID
*
)
thd
->
transaction
.
xid_state
.
get_xid
()
:
*
(
MYSQL_XID
*
)
&
thd
->
transaction
.
implicit_xid
;
}
}
...
@@ -1386,7 +1388,7 @@ void THD::init_for_queries()
...
@@ -1386,7 +1388,7 @@ void THD::init_for_queries()
variables
.
trans_alloc_block_size
,
variables
.
trans_alloc_block_size
,
variables
.
trans_prealloc_size
);
variables
.
trans_prealloc_size
);
DBUG_ASSERT
(
!
transaction
.
xid_state
.
is_explicit_XA
());
DBUG_ASSERT
(
!
transaction
.
xid_state
.
is_explicit_XA
());
DBUG_ASSERT
(
transaction
.
xid_state
.
xid
.
is_null
());
DBUG_ASSERT
(
transaction
.
implicit_
xid
.
is_null
());
}
}
...
...
sql/sql_class.h
View file @
b7fd7ce2
...
@@ -2582,6 +2582,7 @@ class THD: public THD_count, /* this must be first */
...
@@ -2582,6 +2582,7 @@ class THD: public THD_count, /* this must be first */
THD_TRANS
stmt
;
// Trans for current statement
THD_TRANS
stmt
;
// Trans for current statement
bool
on
;
// see ha_enable_transaction()
bool
on
;
// see ha_enable_transaction()
XID_STATE
xid_state
;
XID_STATE
xid_state
;
XID
implicit_xid
;
WT_THD
wt
;
///< for deadlock detection
WT_THD
wt
;
///< for deadlock detection
Rows_log_event
*
m_pending_rows_event
;
Rows_log_event
*
m_pending_rows_event
;
...
@@ -2606,9 +2607,7 @@ class THD: public THD_count, /* this must be first */
...
@@ -2606,9 +2607,7 @@ class THD: public THD_count, /* this must be first */
DBUG_ENTER
(
"THD::st_transactions::cleanup"
);
DBUG_ENTER
(
"THD::st_transactions::cleanup"
);
changed_tables
=
0
;
changed_tables
=
0
;
savepoints
=
0
;
savepoints
=
0
;
/* xid_cache_delete() resets xid of explicitly started XA transaction */
implicit_xid
.
null
();
if
(
!
xid_state
.
is_explicit_XA
())
xid_state
.
xid
.
null
();
free_root
(
&
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
free_root
(
&
mem_root
,
MYF
(
MY_KEEP_PREALLOC
));
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -2620,6 +2619,7 @@ class THD: public THD_count, /* this must be first */
...
@@ -2620,6 +2619,7 @@ class THD: public THD_count, /* this must be first */
{
{
bzero
((
char
*
)
this
,
sizeof
(
*
this
));
bzero
((
char
*
)
this
,
sizeof
(
*
this
));
xid_state
.
xid
.
null
();
xid_state
.
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
,
MYF
(
MY_THREAD_SPECIFIC
));
MYF
(
MY_THREAD_SPECIFIC
));
...
...
sql/wsrep_applier.cc
View file @
b7fd7ce2
...
@@ -184,12 +184,6 @@ int wsrep_apply_events(THD* thd,
...
@@ -184,12 +184,6 @@ int wsrep_apply_events(THD* thd,
thd
->
set_server_id
(
ev
->
server_id
);
thd
->
set_server_id
(
ev
->
server_id
);
thd
->
set_time
();
// time the query
thd
->
set_time
();
// time the query
thd
->
transaction
.
start_time
.
reset
(
thd
);
thd
->
transaction
.
start_time
.
reset
(
thd
);
//#define mariadb_10_4_0
#ifdef mariadb_10_4_0
wsrep_xid_init
(
&
thd
->
transaction
.
xid_state
.
xid
,
thd
->
wsrep_trx_meta
.
gtid
.
uuid
,
thd
->
wsrep_trx_meta
.
gtid
.
seqno
);
#endif
thd
->
lex
->
current_select
=
0
;
thd
->
lex
->
current_select
=
0
;
if
(
!
ev
->
when
)
if
(
!
ev
->
when
)
{
{
...
...
sql/xa.cc
View file @
b7fd7ce2
...
@@ -188,6 +188,13 @@ bool XID_STATE::check_has_uncommitted_xa() const
...
@@ -188,6 +188,13 @@ bool XID_STATE::check_has_uncommitted_xa() const
}
}
XID
*
XID_STATE
::
get_xid
()
const
{
DBUG_ASSERT
(
is_explicit_XA
());
return
const_cast
<
XID
*>
(
&
xid
);
}
void
xid_cache_init
()
void
xid_cache_init
()
{
{
xid_cache_inited
=
true
;
xid_cache_inited
=
true
;
...
...
sql/xa.h
View file @
b7fd7ce2
...
@@ -28,6 +28,7 @@ struct XID_STATE {
...
@@ -28,6 +28,7 @@ struct XID_STATE {
bool
is_explicit_XA
()
const
{
return
xid_cache_element
!=
0
;
}
bool
is_explicit_XA
()
const
{
return
xid_cache_element
!=
0
;
}
void
set_error
(
uint
error
);
void
set_error
(
uint
error
);
void
er_xaer_rmfail
()
const
;
void
er_xaer_rmfail
()
const
;
XID
*
get_xid
()
const
;
};
};
void
xid_cache_init
(
void
);
void
xid_cache_init
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment