List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:March 20 2008 7:57am
Subject:bk commit into 5.1 tree (svoj:1.2569) BUG#34789
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of svoj.  When svoj does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-03-20 11:57:30+04:00, svoj@stripped +2 -0
  BUG#34789 - drop server/create server leaks memory !
  
  When CREATE SERVER is issued, it allocates memory on memory root
  to store cached server structure. When DROP SERVER is issued,
  it doesn't release this memory, as it is impossible with the
  memory root.
  
  We use the same allocation strategy for plugins and acl. The problem
  here that there was no way (except for the server restart) to force
  'servers' code to release this memory.
  
  With this fix it is possible to release unused server cache memory
  by FLUSH PRIVILEGES.
  
  No test case for this fix.

  sql/sql_parse.cc@stripped, 2008-03-20 11:57:28+04:00, svoj@stripped +2 -0
    Reload servers table on FLUSH PRIVILEGES.

  sql/sql_servers.cc@stripped, 2008-03-20 11:57:28+04:00, svoj@stripped +5 -3
    Instead of just marking memory blocks as unused, release memory
    used by servers cache and initialize new memory root.
    
    This is needed for FLUSH PRIVILEGES to release unused memory
    blocks.

diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc
--- a/sql/sql_parse.cc	2008-03-17 19:11:24 +04:00
+++ b/sql/sql_parse.cc	2008-03-20 11:57:28 +04:00
@@ -6486,6 +6486,8 @@ bool reload_acl_and_cache(THD *thd, ulon
         result= 1;
       if (grant_reload(thd))
         result= 1;
+      if (servers_reload(thd))
+        result= 1;
     }
     if (tmp_thd)
     {
diff -Nrup a/sql/sql_servers.cc b/sql/sql_servers.cc
--- a/sql/sql_servers.cc	2007-12-12 19:20:56 +04:00
+++ b/sql/sql_servers.cc	2008-03-20 11:57:28 +04:00
@@ -166,6 +166,9 @@ end:
   RETURN VALUES
     FALSE  Success
     TRUE   Error
+
+  TODO
+    Revert back to old list if we failed to load new one.
 */
 
 static bool servers_load(THD *thd, TABLE_LIST *tables)
@@ -175,10 +178,9 @@ static bool servers_load(THD *thd, TABLE
   bool return_val= TRUE;
   DBUG_ENTER("servers_load");
 
-  /* first, send all cached rows to sleep with the fishes, oblivion!
-     I expect this crappy comment replaced */
-  free_root(&mem, MYF(MY_MARK_BLOCKS_FREE));
   my_hash_reset(&servers_cache);
+  free_root(&mem, MYF(0));
+  init_alloc_root(&mem, ACL_ALLOC_BLOCK_SIZE, 0);
 
   init_read_record(&read_record_info,thd,table=tables[0].table,NULL,1,0);
   while (!(read_record_info.read_record(&read_record_info)))
Thread
bk commit into 5.1 tree (svoj:1.2569) BUG#34789Sergey Vojtovich20 Mar
Re: bk commit into 5.1 tree (svoj:1.2569) BUG#34789Ingo Strüwing20 Mar