MDEV-7962 post-push fixes

This is a partial backport of
commit 5e7e7153b439ea1b12588f5830d66b3a0cf13414 from 10.4.

assert_trx_is_free(): Assert !is_wsrep().

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

trx_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_rollback_trx(): Always reset trx->wsrep.
This commit is contained in:
Marko Mäkelä 2020-05-04 18:57:55 +03:00
parent 5a270e6acc
commit d467bb7e5e
4 changed files with 26 additions and 11 deletions

View File

@ -4467,29 +4467,37 @@ 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; trx->will_lock = 0;
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (trx->is_wsrep()) { thd_proc_info(trx->mysql_thd, tmp); } trx->wsrep = false;
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
} }
#ifdef WITH_WSREP
if (is_wsrep) {
thd_proc_info(thd, tmp);
#endif /* WITH_WSREP */
}
}
/*****************************************************************//** /*****************************************************************//**
Creates an InnoDB transaction struct for the thd if it does not yet have one. Creates an InnoDB transaction struct for the thd if it does not yet have one.
Starts a new InnoDB transaction if a transaction is not yet started. And Starts a new InnoDB transaction if a transaction is not yet started. And
@ -4836,6 +4844,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);
} }

View File

@ -553,6 +553,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(!MVCC::is_view_active((t)->read_view)); \ ut_ad(!MVCC::is_view_active((t)->read_view)); \
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); \

View File

@ -189,6 +189,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->in_mysql_trx_list); ut_ad(trx->in_mysql_trx_list);
#ifdef WITH_WSREP
trx->wsrep = false;
#endif
return(DB_SUCCESS); return(DB_SUCCESS);
case TRX_STATE_ACTIVE: case TRX_STATE_ACTIVE:

View File

@ -102,9 +102,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 = "";
@ -1821,6 +1818,9 @@ trx_commit_in_memory(
DBUG_LOG("trx", "Commit in memory: " << trx); DBUG_LOG("trx", "Commit in memory: " << trx);
trx->state = TRX_STATE_NOT_STARTED; trx->state = TRX_STATE_NOT_STARTED;
#ifdef WITH_WSREP
trx->wsrep = false;
#endif
/* trx->in_mysql_trx_list would hold between /* trx->in_mysql_trx_list would hold between
trx_allocate_for_mysql() and trx_free_for_mysql(). It does not trx_allocate_for_mysql() and trx_free_for_mysql(). It does not