Skip to content

Commit 9af8429

Browse files
author
Paweł Olchawa
committed
Fix for failures of tests:
- rpl_gtid.rpl_gtids_table_disable_binlog_on_slave, - rpl_gtid.rpl_mts_xa_retry, - rpl_gtid.rpl_xa_with_filters_error_msg. Reviewed-by: Jakub Łopuszański <jakub.lopuszanski@oracle.com> Reviewed-by: Nikša Skeledžija <niksa.skeledzija@oracle.com>
1 parent 0ad18f0 commit 9af8429

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

storage/innobase/trx/trx0trx.cc

+11-5
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,17 @@ static void trx_release_impl_and_expl_locks(trx_t *trx, bool serialised) {
17751775
bool trx_sys_latch_is_needed =
17761776
(trx->id > 0) || trx_state_eq(trx, TRX_STATE_PREPARED);
17771777

1778+
/* Check and get GTID to be persisted. Do it outside mutex. It must be done
1779+
before trx->state is changed to TRX_STATE_COMMITTED_IN_MEMORY, because the
1780+
gtid_persistor.get_gtid_info() calls gtid_persistor.has_gtid() which checks
1781+
if trx->state is TRX_STATE_PREPARED when thd == nullptr, and updates the thd
1782+
with thd_get_current_thd() in such case. */
1783+
Gtid_desc gtid_desc;
1784+
if (serialised) {
1785+
auto &gtid_persistor = clone_sys->get_gtid_persistor();
1786+
gtid_persistor.get_gtid_info(trx, gtid_desc);
1787+
}
1788+
17781789
if (trx_sys_latch_is_needed) {
17791790
trx_sys_mutex_enter();
17801791
}
@@ -1823,11 +1834,6 @@ static void trx_release_impl_and_expl_locks(trx_t *trx, bool serialised) {
18231834
become purged (because trx->no would no longer protect them). */
18241835

18251836
if (serialised) {
1826-
/* Check and get GTID to be persisted. Do it outside mutex. */
1827-
Gtid_desc gtid_desc;
1828-
auto &gtid_persistor = clone_sys->get_gtid_persistor();
1829-
gtid_persistor.get_gtid_info(trx, gtid_desc);
1830-
18311837
trx_sys_serialisation_mutex_enter();
18321838

18331839
/* Add GTID to be persisted to disk table. It must be done ...

0 commit comments

Comments
 (0)