1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fix for bug #50908 "Assertion `handler_tables_hash.records == 0'

failed in enter_locked_tables_mode".

Server was aborted due to assertion failure when one tried to 
execute statement requiring prelocking (i.e. firing triggers
or using stored functions) while having open HANDLERs.

The problem was that THD::enter_locked_tables_mode() method
which was called at the beginning of execution of prelocked 
statement assumed there are no open HANDLERs. It had to do 
so because corresponding THD::leave_locked_tables_mode()
method was unable to properly restore MDL sentinel when
leaving LOCK TABLES/prelocked mode in the presence of open 
HANDLERs.

This patch solves this problem by changing the latter method
to properly restore MDL sentinel and thus removing need for 
this assumption. As a side-effect, it lifts unjustified
limitation by allowing to keep HANDLERs open when entering 
LOCK TABLES mode.
This commit is contained in:
Dmitry Lenev
2010-02-12 10:05:43 +03:00
parent bca1fec83e
commit 0ec868ca0e
8 changed files with 580 additions and 59 deletions

View File

@ -2683,17 +2683,11 @@ public:
void enter_locked_tables_mode(enum_locked_tables_mode mode_arg)
{
DBUG_ASSERT(locked_tables_mode == LTM_NONE);
DBUG_ASSERT(handler_tables_hash.records == 0);
mdl_context.set_trans_sentinel();
locked_tables_mode= mode_arg;
}
void leave_locked_tables_mode()
{
locked_tables_mode= LTM_NONE;
/* Make sure we don't release the global read lock when leaving LTM. */
mdl_context.reset_trans_sentinel(global_read_lock.global_shared_lock());
}
void leave_locked_tables_mode();
int decide_logging_format(TABLE_LIST *tables);
private: