From 337c1b3ee83033a185daa4e2df8c8a36f54c2bf7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 19 Apr 2013 20:35:37 +0200 Subject: [PATCH] fix plugin locking/unlocking when assisted discovery fails --- sql/sql_table.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8ad9f10bc24..60fd630001a 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -4420,6 +4420,16 @@ bool mysql_create_table_no_lock(THD *thd, goto err; ha_err= hton->discover_table_structure(hton, thd, &share, create_info); + + /* + if discovery failed, the plugin will be auto-unlocked, as it + was locked on the THD, see above. + if discovery succeeded, the plugin was replaced by a globally + locked plugin, that will be unlocked by free_table_share() + */ + if (ha_err) + share.db_plugin= 0; // will be auto-freed, locked above on the THD + free_table_share(&share); if (ha_err)