summaryrefslogtreecommitdiff
path: root/sql/sql_servers.cc
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/june.mysql.com>2008-03-20 11:57:30 +0400
committerunknown <svoj@mysql.com/june.mysql.com>2008-03-20 11:57:30 +0400
commitb31a1622e33b92d926e7e4346a027694156353c0 (patch)
tree6337875ba32b8946975e209ccfe433bb9298adc3 /sql/sql_servers.cc
parentca629f8618f16d669e835b76f4ed5393beb640e6 (diff)
downloadmariadb-git-b31a1622e33b92d926e7e4346a027694156353c0.tar.gz
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: Reload servers table on FLUSH PRIVILEGES. sql/sql_servers.cc: 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.
Diffstat (limited to 'sql/sql_servers.cc')
-rw-r--r--sql/sql_servers.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index 8203ca92eed..42abd9b4eb5 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -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_LIST *tables)
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)))