summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2010-04-14 13:53:59 +0400
committerSergey Vojtovich <svoj@sun.com>2010-04-14 13:53:59 +0400
commitb89feb5b28176daa27c4a3bdc32f2c70f6a996e2 (patch)
treeb63efe0cd130b6f27ed369fb7438cca073cabe69 /sql/handler.cc
parent8a96640e87360f5e588f51fe99e51d8d6d481ae3 (diff)
downloadmariadb-git-b89feb5b28176daa27c4a3bdc32f2c70f6a996e2.tar.gz
BUG#39053 - UNISTALL PLUGIN does not allow the storage engine
to cleanup open connections It was possible to UNINSTALL storage engine plugin when binding between THD object and storage engine is still active (e.g. in the middle of transaction). To avoid unclean deactivation (uninstall) of storage engine plugin in the middle of transaction, additional storage engine plugin lock is acquired by thd_set_ha_data(). If ha_data is not null and storage engine plugin was not locked by thd_set_ha_data() in this connection before, storage engine plugin gets locked. If ha_data is null and storage engine plugin was locked by thd_set_ha_data() in this connection before, storage engine plugin lock gets released. If handlerton::close_connection() didn't reset ha_data, server does it immediately after calling handlerton::close_connection(). Note that this is just a framework fix, storage engines must switch to thd_set_ha_data() from thd_ha_data() if they want to see fit.
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 216228ed509..19f397ef09f 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -159,7 +159,7 @@ redo:
}
-plugin_ref ha_lock_engine(THD *thd, handlerton *hton)
+plugin_ref ha_lock_engine(THD *thd, const handlerton *hton)
{
if (hton)
{
@@ -601,9 +601,13 @@ static my_bool closecon_handlerton(THD *thd, plugin_ref plugin,
there's no need to rollback here as all transactions must
be rolled back already
*/
- if (hton->state == SHOW_OPTION_YES && hton->close_connection &&
- thd_get_ha_data(thd, hton))
- hton->close_connection(hton, thd);
+ if (hton->state == SHOW_OPTION_YES && thd_get_ha_data(thd, hton))
+ {
+ if (hton->close_connection)
+ hton->close_connection(hton, thd);
+ /* make sure ha_data is reset and ha_data_lock is released */
+ thd_set_ha_data(thd, hton, NULL);
+ }
return FALSE;
}