From: Sergei Golubchik Date: July 21 2008 9:13am Subject: bzr commit into mysql-5.1 branch (serg:2671) Bug#34409 List-Archive: http://lists.mysql.com/commits/50100 X-Bug: 34409 Message-Id: <20080721091325.396.qmail@janus.mylan> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///usr/home/serg/Abk/mysql/5.1/ 2671 Sergei Golubchik 2008-07-21 Bug#34409 LOCK_plugin contention via ha_release_temporary_latches/plugin_foreach use thread-local data structures in ha_release_temporary_latches() modified: sql/handler.cc per-file messages: sql/handler.cc Bug#34409 LOCK_plugin contention via ha_release_temporary_latches/plugin_foreach use thread-local data structures in ha_release_temporary_latches() === modified file 'sql/handler.cc' --- a/sql/handler.cc 2008-05-18 08:42:55 +0000 +++ b/sql/handler.cc 2008-07-21 09:13:17 +0000 @@ -1618,23 +1618,23 @@ bool mysql_xa_recover(THD *thd) @return always 0 */ -static my_bool release_temporary_latches(THD *thd, plugin_ref plugin, - void *unused) -{ - handlerton *hton= plugin_data(plugin, handlerton *); - - if (hton->state == SHOW_OPTION_YES && hton->release_temporary_latches) - hton->release_temporary_latches(hton, thd); - - return FALSE; -} - int ha_release_temporary_latches(THD *thd) { - plugin_foreach(thd, release_temporary_latches, MYSQL_STORAGE_ENGINE_PLUGIN, - NULL); + bool seen[MAX_HA]; + TABLE *table; + bzero(seen, sizeof(seen)); + for (table= thd->open_tables; table; table= table->next) + { + handlerton *hton= table->s->db_type(); + if (hton && !seen[hton->slot]) + { + seen[hton->slot]=true; + if (hton->release_temporary_latches) + hton->release_temporary_latches(hton, thd); + } + } return 0; }