-
Konstantin Osipov authored
------------------------------------------------------------ revno: 2617.65.6 committer: Dmitry Lenev <dlenev@mysql.com> branch nick: mysql-azalea-bg39674 timestamp: Sat 2009-07-25 00:28:43 +0400 message: Fix for bug #39674 "On shutdown mdl_destroy() called before plugin_shutdown()". Attempt to shutdown PBXT engine plugin led to assertion failure caused by using already destroyed mutex in metadata locking subsystem. This problem stemmed from the fact that we MDL subsystem and table definition cache were deinitialized before plugin shutdown while PBXT plugin during its shutdown process accessed tables and therefore expected them to be in working shape. This patch solves this problem by moving deinitialization of these two subsystems after plugins are shut down. No test case is provided since such test case would require using PBXT or other plugin which accesses tables during its shutdown process. sql/mysql_priv.h: Introduced table_def_start_shutdown() function which informs table definition cache that shutdown process has been started so it has to keep number of TABLE and TABLE_SHARE objects minimal in order to reduce number of references to pluggable engines. sql/mysqld.cc: Destroy table definition cache and meta-data locking subsystem after shutting down plugins. This allows plugins to work with tables during their shutdown. Since table definition cache hold references to storage engine plugins we have to remove unused tables from it before shutting down plugins and keep number of these references minimal during the process (by immediately removing tables opened during this process from the table definition cache). sql/sql_base.cc: Introduced table_def_start_shutdown() function which informs table definition cache that shutdown process has been started so it has to keep number of TABLE and TABLE_SHARE objects minimal in order to reduce number of references to pluggable engines. This allows to smoothly shutdown such plugins without completely prohibiting access to tables/table definition cache while shutting down other plugins.
aeb502d6