1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-16264 prerequisite patch, ha_preshutdown.

This is a prerequisite patch required to remove Innodb's
thd_destructor_proxy thread.

The patch implement pre-shutdown functionality for handlers.

A storage engine might need to perform some work after all user
connections are shut down, but before killing off the plugins.

The reason is that an SE could still be using some of the
server infrastructure. In case of Innodb this would be purge threads,
that call into the server to calculate results of virtual function,
acquire MDL locks on tables, or possibly also use the audit plugins.
This commit is contained in:
Vladislav Vaintroub
2019-10-29 18:32:14 +01:00
parent e7549917e1
commit 7e08dd85d6
3 changed files with 32 additions and 1 deletions

View File

@ -868,6 +868,33 @@ void ha_end_backup()
}
/*
Inform plugin of the server shutdown.
Called after all connections are down.
Under some circumstances, storage engine might need to
so some work, before deinit() can be safely called.
(an example is Innodb purge that might call into server
to calculate virtual columns, which might potentially also
invoke other plugins, such as audit
*/
static my_bool plugin_pre_shutdown(THD *, plugin_ref plugin, void *)
{
handlerton *hton= plugin_hton(plugin);
if (hton->pre_shutdown)
hton->pre_shutdown();
return FALSE;
}
void ha_pre_shutdown()
{
plugin_foreach_with_mask(0, plugin_pre_shutdown,
MYSQL_STORAGE_ENGINE_PLUGIN,
PLUGIN_IS_DELETED | PLUGIN_IS_READY, 0);
}
/* ========================================================================
======================= TRANSACTIONS ===================================*/