diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 619b8825527..98ce0d59923 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4467,27 +4467,35 @@ innobase_commit_low( { #ifdef WITH_WSREP 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 char info[64]; info[sizeof(info) - 1] = '\0'; snprintf(info, sizeof(info) - 1, "innobase_commit_low():trx_commit_for_mysql(%lld)", - (long long) wsrep_thd_trx_seqno(trx->mysql_thd)); - tmp = thd_proc_info(trx->mysql_thd, info); + (long long) wsrep_thd_trx_seqno(thd)); + tmp = thd_proc_info(thd, info); #else - tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()"); + tmp = thd_proc_info(thd, "innobase_commit_low()"); #endif /* WSREP_PROC_INFO */ } #endif /* WITH_WSREP */ if (trx_is_started(trx)) { - trx_commit_for_mysql(trx); - } - trx->will_lock = 0; + } else { + trx->will_lock = 0; #ifdef WITH_WSREP - if (trx->is_wsrep()) { thd_proc_info(trx->mysql_thd, tmp); } + trx->wsrep = false; #endif /* WITH_WSREP */ + } + +#ifdef WITH_WSREP + if (is_wsrep) { + thd_proc_info(thd, tmp); +#endif /* WITH_WSREP */ + } } /*****************************************************************//** @@ -4836,6 +4844,9 @@ innobase_rollback_trx( if (!trx->has_logged()) { trx->will_lock = 0; +#ifdef WITH_WSREP + trx->wsrep = false; +#endif DBUG_RETURN(0); } diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 60e6fc58089..57ecf7717d1 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -553,6 +553,7 @@ Check transaction state */ ut_ad(!(t)->id); \ ut_ad(!(t)->has_logged()); \ ut_ad(!(t)->is_referenced()); \ + ut_ad(!(t)->is_wsrep()); \ ut_ad(!MVCC::is_view_active((t)->read_view)); \ ut_ad((t)->lock.wait_thr == NULL); \ ut_ad(UT_LIST_GET_LEN((t)->lock.trx_locks) == 0); \ diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 20494133e8b..0e03346bb9d 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -189,6 +189,9 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) case TRX_STATE_NOT_STARTED: trx->will_lock = 0; ut_ad(trx->in_mysql_trx_list); +#ifdef WITH_WSREP + trx->wsrep = false; +#endif return(DB_SUCCESS); case TRX_STATE_ACTIVE: diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 80de62b8b28..85667e91d13 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -102,9 +102,6 @@ trx_init( trx->state = TRX_STATE_NOT_STARTED; trx->is_recovered = false; -#ifdef WITH_WSREP - trx->wsrep = false; -#endif /* WITH_WSREP */ trx->op_info = ""; @@ -1821,6 +1818,9 @@ trx_commit_in_memory( DBUG_LOG("trx", "Commit in memory: " << trx); trx->state = TRX_STATE_NOT_STARTED; +#ifdef WITH_WSREP + trx->wsrep = false; +#endif /* trx->in_mysql_trx_list would hold between trx_allocate_for_mysql() and trx_free_for_mysql(). It does not