-
Dmitry Lenev authored
m_tickets.front() == m_trans_sentinel'". Debug build of server crashed due to assert failure in MDL subsystem when one tried to execute multi-table REPAIR or OPTIMIZE in autocommit=0 mode. The assert failure occured when multi-table REPAIR or OPTIMIZE started processing of second table from its table list and tried to acquire upgradable metadata lock on this table. The cause of the assert failure were MDL locks left over from processing of previous table. It turned out that in autocommit=0 mode close_thread_tables() which happens at the end of table processing doesn't release metadata locks. This fix solves problem by releasing locks explicitly using MDL_context::release_trans_locks() call. mysql-test/r/repair.result: Added test for bug #50784 "MDL: Assertion `m_tickets.is_empty() || m_tickets.front() == m_trans_sentinel'". mysql-test/t/repair.test: Added test for bug #50784 "MDL: Assertion `m_tickets.is_empty() || m_tickets.front() == m_trans_sentinel'". sql/sql_table.cc: Ensure that metadata locks are released after multi-table REPAIR/ OPTIMIZE/... processes each table. close_thread_tables() which is called after processing each table doesn't release metadata locks if we are in autocommit=0 mode. So this have to be done explicitly by calling MDL_context::release_trans_locks().
9ebc7af0