MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:June 7 2010 1:41pm
Subject:bzr commit into mysql-trunk-runtime branch (kostja:3042)
View as plain text  
#At file:///opt/local/work/trunk-runtime/ based on revid:kostja@stripped

 3042 Konstantin Osipov	2010-06-07
      Backport two small cleanups from trunk-iplus tree:
      
      1) No mutex and no function call if we're not using
      plugins.
      2) If we're above the table definition cache limit,
      delete the oldest unused share, not the share on our hands.
     @ sql/sql_base.cc
        If we're above the table definition cache limit,
        delete the oldest unused share, not the share on our hands.
     @ sql/sql_lex.cc
        No mutex and no function call if we're not using
        plugins.

    modified:
      sql/sql_base.cc
      sql/sql_lex.cc
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2010-06-07 07:06:55 +0000
+++ b/sql/sql_base.cc	2010-06-07 13:40:58 +0000
@@ -686,7 +686,6 @@ static TABLE_SHARE
 
 void release_table_share(TABLE_SHARE *share)
 {
-  bool to_be_deleted= 0;
   DBUG_ENTER("release_table_share");
   DBUG_PRINT("enter",
              ("share: 0x%lx  table: %s.%s  ref_count: %u  version: %lu",
@@ -700,7 +699,7 @@ void release_table_share(TABLE_SHARE *sh
   {
     if (share->version != refresh_version ||
         table_def_shutdown_in_progress)
-      to_be_deleted=1;
+      my_hash_delete(&table_def_cache, (uchar*) share);
     else
     {
       /* Link share last in used_table_share list */
@@ -712,15 +711,14 @@ void release_table_share(TABLE_SHARE *sh
       end_of_unused_share.prev= &share->next;
       share->next= &end_of_unused_share;
 
-      to_be_deleted= (table_def_cache.records > table_def_size);
+      if (table_def_cache.records > table_def_size)
+      {
+        /* Delete the least used share to preserve LRU order. */
+        my_hash_delete(&table_def_cache, (uchar*) oldest_unused_share);
+      }
     }
   }
 
-  if (to_be_deleted)
-  {
-    DBUG_PRINT("info", ("Deleting share"));
-    my_hash_delete(&table_def_cache, (uchar*) share);
-  }
   DBUG_VOID_RETURN;
 }
 

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2010-06-06 11:19:29 +0000
+++ b/sql/sql_lex.cc	2010-06-07 13:40:58 +0000
@@ -435,8 +435,11 @@ void lex_end(LEX *lex)
   DBUG_PRINT("enter", ("lex: 0x%lx", (long) lex));
 
   /* release used plugins */
-  plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer, 
-                     lex->plugins.elements);
+  if (lex->plugins.elements) /* No function call and no mutex if no plugins. */
+  {
+    plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer, 
+                       lex->plugins.elements);
+  }
   reset_dynamic(&lex->plugins);
 
   DBUG_VOID_RETURN;


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20100607134058-wjduu0mskvl5lxhq.bundle
Thread
bzr commit into mysql-trunk-runtime branch (kostja:3042)Konstantin Osipov7 Jun