@@ -154,12 +154,9 @@ innodb_check_deprecated(void);
154154
155155#ifdef WITH_WSREP
156156#include "dict0priv.h"
157- #include "../storage/innobase/include/ ut0byte.h"
157+ #include "ut0byte.h"
158158#include <mysql/service_md5.h>
159159
160- class binlog_trx_data;
161- extern handlerton *binlog_hton;
162-
163160extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log;
164161
165162static inline wsrep_ws_handle_t*
@@ -1957,14 +1954,11 @@ thd_innodb_tmpdir(
19571954}
19581955
19591956/** Obtain the InnoDB transaction of a MySQL thread.
1960- @param[in,out] thdMySQL thread handler.
1957+ @param[in,out] thd thread handle
19611958@return reference to transaction pointer */
1962- MY_ATTRIBUTE((warn_unused_result))
1963- trx_t*&
1964- thd_to_trx(
1965- THD* thd)
1959+ static trx_t* thd_to_trx(THD* thd)
19661960{
1967- return(*( trx_t**) thd_ha_data(thd, innodb_hton_ptr));
1961+ return *reinterpret_cast< trx_t**>( thd_ha_data(thd, innodb_hton_ptr));
19681962}
19691963
19701964#ifdef WITH_WSREP
@@ -2873,20 +2867,19 @@ check_trx_exists(
28732867/*=============*/
28742868THD* thd) /*!< in: user thread handle */
28752869{
2876- trx_t*& trx = thd_to_trx(thd);
2877-
2878- if (trx == NULL) {
2870+ if (trx_t* trx = thd_to_trx(thd)) {
2871+ ut_a(trx->magic_n == TRX_MAGIC_N);
2872+ innobase_trx_init(thd, trx);
2873+ return trx;
2874+ } else {
28792875trx = innobase_trx_allocate(thd);
28802876/* User trx can be forced to rollback,
28812877so we unset the disable flag. */
28822878ut_ad(trx->in_innodb & TRX_FORCE_ROLLBACK_DISABLE);
28832879trx->in_innodb &= TRX_FORCE_ROLLBACK_MASK;
2884- } else {
2885- ut_a(trx->magic_n == TRX_MAGIC_N);
2886- innobase_trx_init(thd, trx);
2880+ thd_set_ha_data(thd, innodb_hton_ptr, trx);
2881+ return trx;
28872882}
2888-
2889- return(trx);
28902883}
28912884
28922885/*************************************************************************
@@ -2896,8 +2889,7 @@ innobase_get_trx()
28962889{
28972890THD *thd=current_thd;
28982891if (likely(thd != 0)) {
2899- trx_t*& trx = thd_to_trx(thd);
2900- return(trx);
2892+ return thd_to_trx(thd);
29012893} else {
29022894return(NULL);
29032895}
0 commit comments