summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/handler.cc4
-rw-r--r--sql/sql_class.cc9
-rw-r--r--sql/sql_connect.cc1
-rw-r--r--sql/xa.cc1
4 files changed, 12 insertions, 3 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 48bae864125..58f1c60edf9 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1818,6 +1818,10 @@ err:
ha_rollback_trans(thd, all);
else
{
+ /*
+ We are not really doing a rollback here, but the code in trans_commit()
+ requres that m_transaction_psi is 0 when we return from this function.
+ */
MYSQL_ROLLBACK_TRANSACTION(thd->m_transaction_psi);
thd->m_transaction_psi= NULL;
WSREP_DEBUG("rollback skipped %p %d",thd->rgi_slave,
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 484c90d706b..a900e485cd7 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -1396,9 +1396,11 @@ void THD::update_all_stats()
void THD::init_for_queries()
{
- set_time();
- ha_enable_transaction(this,TRUE);
+ DBUG_ASSERT(transaction->on);
+ DBUG_ASSERT(m_transaction_psi == NULL);
+ /* Set time for --init-file queries */
+ set_time();
reset_root_defaults(mem_root, variables.query_alloc_block_size,
variables.query_prealloc_size);
reset_root_defaults(&transaction->mem_root,
@@ -1550,6 +1552,8 @@ void THD::cleanup(void)
trans_rollback(this);
DBUG_ASSERT(open_tables == NULL);
+ DBUG_ASSERT(m_transaction_psi == NULL);
+
/*
If the thread was in the middle of an ongoing transaction (rolled
back a few lines above) or under LOCK TABLES (unlocked the tables
@@ -1650,6 +1654,7 @@ void THD::reset_for_reuse()
abort_on_warning= 0;
free_connection_done= 0;
m_command= COM_CONNECT;
+ transaction->on= 1;
#if defined(ENABLED_PROFILING)
profiling.reset();
#endif
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index 420a054a1b2..83f4de1b5df 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1279,7 +1279,6 @@ void prepare_new_connection_state(THD* thd)
}
thd->proc_info=0;
- thd->init_for_queries();
}
}
diff --git a/sql/xa.cc b/sql/xa.cc
index 7d6d7187bce..e8e6dc43c56 100644
--- a/sql/xa.cc
+++ b/sql/xa.cc
@@ -843,6 +843,7 @@ bool trans_xa_detach(THD *thd)
thd->transaction->all.ha_list= 0;
thd->transaction->all.no_2pc= 0;
+ thd->m_transaction_psi= 0;
return false;
}