mirror of
https://github.com/MariaDB/server.git
synced 2025-08-31 22:22:30 +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:
@@ -3283,14 +3283,6 @@ end_with_restore_list:
|
||||
break;
|
||||
case SQLCOM_LOCK_TABLES:
|
||||
thd->locked_tables_list.unlock_locked_tables(thd);
|
||||
/*
|
||||
As of 5.5, entering LOCK TABLES mode implicitly closes all
|
||||
open HANDLERs. Both HANDLER code and LOCK TABLES mode use
|
||||
the sentinel mechanism in MDL subsystem and thus could not be
|
||||
used at the same time. All HANDLER operations are prohibited
|
||||
under LOCK TABLES anyway.
|
||||
*/
|
||||
mysql_ha_cleanup(thd);
|
||||
/* we must end the trasaction first, regardless of anything */
|
||||
if (trans_commit_implicit(thd))
|
||||
goto error;
|
||||
|
Reference in New Issue
Block a user