1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

thd->m_transaction_psi was not properly cleared for new connections

This happend when using XA transactions. I also added some extra asserts
to ensure that m_transactions are properly cleared.

Other things:
- Removed set_time() from THD::init_for_queries() as dispatch_command()
  is already doing that.
- Removed duplicate init_for_queries() from prepare_new_connection_state().
  The init_for_queries() functions should only be called once per
  connection.
This commit is contained in:
Monty
2020-07-22 17:57:07 +03:00
parent dbcd3384e0
commit ce699df905
4 changed files with 12 additions and 3 deletions

View File

@ -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