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:
parent
dbcd3384e0
commit
ce699df905
@ -1818,6 +1818,10 @@ err:
|
|||||||
ha_rollback_trans(thd, all);
|
ha_rollback_trans(thd, all);
|
||||||
else
|
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);
|
MYSQL_ROLLBACK_TRANSACTION(thd->m_transaction_psi);
|
||||||
thd->m_transaction_psi= NULL;
|
thd->m_transaction_psi= NULL;
|
||||||
WSREP_DEBUG("rollback skipped %p %d",thd->rgi_slave,
|
WSREP_DEBUG("rollback skipped %p %d",thd->rgi_slave,
|
||||||
|
@ -1396,9 +1396,11 @@ void THD::update_all_stats()
|
|||||||
|
|
||||||
void THD::init_for_queries()
|
void THD::init_for_queries()
|
||||||
{
|
{
|
||||||
set_time();
|
DBUG_ASSERT(transaction->on);
|
||||||
ha_enable_transaction(this,TRUE);
|
DBUG_ASSERT(m_transaction_psi == NULL);
|
||||||
|
|
||||||
|
/* Set time for --init-file queries */
|
||||||
|
set_time();
|
||||||
reset_root_defaults(mem_root, variables.query_alloc_block_size,
|
reset_root_defaults(mem_root, variables.query_alloc_block_size,
|
||||||
variables.query_prealloc_size);
|
variables.query_prealloc_size);
|
||||||
reset_root_defaults(&transaction->mem_root,
|
reset_root_defaults(&transaction->mem_root,
|
||||||
@ -1550,6 +1552,8 @@ void THD::cleanup(void)
|
|||||||
trans_rollback(this);
|
trans_rollback(this);
|
||||||
|
|
||||||
DBUG_ASSERT(open_tables == NULL);
|
DBUG_ASSERT(open_tables == NULL);
|
||||||
|
DBUG_ASSERT(m_transaction_psi == NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
If the thread was in the middle of an ongoing transaction (rolled
|
If the thread was in the middle of an ongoing transaction (rolled
|
||||||
back a few lines above) or under LOCK TABLES (unlocked the tables
|
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;
|
abort_on_warning= 0;
|
||||||
free_connection_done= 0;
|
free_connection_done= 0;
|
||||||
m_command= COM_CONNECT;
|
m_command= COM_CONNECT;
|
||||||
|
transaction->on= 1;
|
||||||
#if defined(ENABLED_PROFILING)
|
#if defined(ENABLED_PROFILING)
|
||||||
profiling.reset();
|
profiling.reset();
|
||||||
#endif
|
#endif
|
||||||
|
@ -1279,7 +1279,6 @@ void prepare_new_connection_state(THD* thd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
thd->proc_info=0;
|
thd->proc_info=0;
|
||||||
thd->init_for_queries();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user