-
Alexander Nozdrin authored
```--------------------------------------------------------- revno: 3124 revision-id: dlenev@mysql.com-20100831090419-rzr5ktekby2gspm1 parent: alik@sun.com-20100827083901-x4wvtc10u9p7gcs9 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-5.5-rt-56137 timestamp: Tue 2010-08-31 13:04:19 +0400 message: Bug #56137 "Assertion `thd->lock == 0' failed on upgrading from 5.1.50 to 5.5.6". Debug builds of the server aborted due to an assertion failure when DROP DATABASE statement was run on an installation which had outdated or corrupt mysql.proc table. Particularly this affected the mysql_upgrade tool which is run as part of 5.1 to 5.5 upgrade. The problem was that sp_drop_db_routines(), which was invoked during dropping of the database, could have returned without closing and unlocking mysql.proc table in cases when this table was not up-to-date with the current server. As a result further attempt to open and lock the mysql.event table, which was necessary to complete dropping of the database, ended up with an assert. This patch solves this problem by ensuring that sp_drop_db_routines() always closes mysql.proc table and releases metadata locks on it. This is achieved by changing open_proc_table_for_update() function to close tables and release metadata locks acquired by it in case of failure. This step also makes behavior of the latter function consistent with behavior of open_proc_table_for_read()/ open_and_lock_tables(). Test case for this bug was added to sp-destruct.test. ``` ---------------------------------------------------------
55c1da5a