Commit 5e7e7153 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-22452: Missing call to wsrep_commit_ordered in trx_t::commit()

This is a follow-up fix to the changes that were made in MDEV-7962.

assert_trx_is_free(): Assert !is_wsrep().

trx_init(): Do not initialize trx->wsrep, because it must have been
initialized already.

trx_t::commit_in_memory(): Invoke wsrep_commit_ordered(). This call
was being skipped, because the transaction object had already been
freed to the pool.

trx_rollback_for_mysql(), innobase_commit_low(),
innobase_close_connection(): Always reset trx->wsrep.
parent f5cff898
...@@ -4356,27 +4356,35 @@ innobase_commit_low( ...@@ -4356,27 +4356,35 @@ innobase_commit_low(
{ {
#ifdef WITH_WSREP #ifdef WITH_WSREP
const char* tmp = 0; const char* tmp = 0;
if (trx->is_wsrep()) { const bool is_wsrep = trx->is_wsrep();
THD* thd = trx->mysql_thd;
if (is_wsrep) {
#ifdef WSREP_PROC_INFO #ifdef WSREP_PROC_INFO
char info[64]; char info[64];
info[sizeof(info) - 1] = '\0'; info[sizeof(info) - 1] = '\0';
snprintf(info, sizeof(info) - 1, snprintf(info, sizeof(info) - 1,
"innobase_commit_low():trx_commit_for_mysql(%lld)", "innobase_commit_low():trx_commit_for_mysql(%lld)",
(long long) wsrep_thd_trx_seqno(trx->mysql_thd)); (long long) wsrep_thd_trx_seqno(thd));
tmp = thd_proc_info(trx->mysql_thd, info); tmp = thd_proc_info(thd, info);
#else #else
tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()"); tmp = thd_proc_info(thd, "innobase_commit_low()");
#endif /* WSREP_PROC_INFO */ #endif /* WSREP_PROC_INFO */
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
if (trx_is_started(trx)) { if (trx_is_started(trx)) {
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
} else {
trx->will_lock = 0;
#ifdef WITH_WSREP
trx->wsrep = false;
#endif /* WITH_WSREP */
} }
trx->will_lock = 0;
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (trx->is_wsrep()) { thd_proc_info(trx->mysql_thd, tmp); } if (is_wsrep) {
thd_proc_info(thd, tmp);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
}
} }
/*****************************************************************//** /*****************************************************************//**
...@@ -4739,6 +4747,9 @@ innobase_rollback_trx( ...@@ -4739,6 +4747,9 @@ innobase_rollback_trx(
if (!trx->has_logged()) { if (!trx->has_logged()) {
trx->will_lock = 0; trx->will_lock = 0;
#ifdef WITH_WSREP
trx->wsrep = false;
#endif
DBUG_RETURN(0); DBUG_RETURN(0);
} }
......
...@@ -443,6 +443,7 @@ Check transaction state */ ...@@ -443,6 +443,7 @@ Check transaction state */
ut_ad(!(t)->id); \ ut_ad(!(t)->id); \
ut_ad(!(t)->has_logged()); \ ut_ad(!(t)->has_logged()); \
ut_ad(!(t)->is_referenced()); \ ut_ad(!(t)->is_referenced()); \
ut_ad(!(t)->is_wsrep()); \
ut_ad(!(t)->read_view.is_open()); \ ut_ad(!(t)->read_view.is_open()); \
ut_ad((t)->lock.wait_thr == NULL); \ ut_ad((t)->lock.wait_thr == NULL); \
ut_ad(UT_LIST_GET_LEN((t)->lock.trx_locks) == 0); \ ut_ad(UT_LIST_GET_LEN((t)->lock.trx_locks) == 0); \
......
...@@ -228,6 +228,9 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) ...@@ -228,6 +228,9 @@ dberr_t trx_rollback_for_mysql(trx_t* trx)
case TRX_STATE_NOT_STARTED: case TRX_STATE_NOT_STARTED:
trx->will_lock = 0; trx->will_lock = 0;
ut_ad(trx->mysql_thd); ut_ad(trx->mysql_thd);
#ifdef WITH_WSREP
trx->wsrep = false;
#endif
return(DB_SUCCESS); return(DB_SUCCESS);
case TRX_STATE_ACTIVE: case TRX_STATE_ACTIVE:
......
...@@ -109,9 +109,6 @@ trx_init( ...@@ -109,9 +109,6 @@ trx_init(
trx->state = TRX_STATE_NOT_STARTED; trx->state = TRX_STATE_NOT_STARTED;
trx->is_recovered = false; trx->is_recovered = false;
#ifdef WITH_WSREP
trx->wsrep = false;
#endif /* WITH_WSREP */
trx->op_info = ""; trx->op_info = "";
...@@ -1504,6 +1501,17 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr) ...@@ -1504,6 +1501,17 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
DBUG_LOG("trx", "Commit in memory: " << this); DBUG_LOG("trx", "Commit in memory: " << this);
state= TRX_STATE_NOT_STARTED; state= TRX_STATE_NOT_STARTED;
#ifdef WITH_WSREP
/* Serialization history has been written and the transaction is
committed in memory, which makes this commit ordered. Release commit
order critical section. */
if (wsrep)
{
wsrep= false;
wsrep_commit_ordered(mysql_thd);
}
#endif /* WITH_WSREP */
assert_trx_is_free(this); assert_trx_is_free(this);
trx_init(this); trx_init(this);
trx_mutex_exit(this); trx_mutex_exit(this);
...@@ -1581,13 +1589,6 @@ void trx_t::commit() ...@@ -1581,13 +1589,6 @@ void trx_t::commit()
local_mtr.start(); local_mtr.start();
} }
commit_low(mtr); commit_low(mtr);
#ifdef WITH_WSREP
/* Serialization history has been written and the transaction is
committed in memory, which makes this commit ordered. Release commit
order critical section. */
if (mtr && is_wsrep())
wsrep_commit_ordered(mysql_thd);
#endif /* WITH_WSREP */
} }
/****************************************************************//** /****************************************************************//**
......
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