List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:July 21 2008 9:13am
Subject:bzr commit into mysql-5.1 branch (serg:2671) Bug#34409
View as plain text  
#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;
 }
 

Thread
bzr commit into mysql-5.1 branch (serg:2671) Bug#34409Sergei Golubchik21 Jul