diff options
author | V S Murthy Sidagam <venkata.sidagam@oracle.com> | 2015-04-27 23:50:13 +0530 |
---|---|---|
committer | V S Murthy Sidagam <venkata.sidagam@oracle.com> | 2015-04-27 23:50:13 +0530 |
commit | c3870e089a0f9ba50adcf17c8795871132e81697 (patch) | |
tree | 742274b0ec760644b9c9b534babef1c061bccb5a /sql/sql_show.h | |
parent | 7797ef4dec59fae2b5a4adacfe2583281bd79f4a (diff) | |
download | mariadb-git-c3870e089a0f9ba50adcf17c8795871132e81697.tar.gz |
Bug #18592390 QUERY TO I_S.TABLES AND I_S.COLUMNS LEADS TO HUGE MEMORY USAGE
Description: On an example MySQL instance with 28k empty
InnoDB tables, a specific query to information_schema.tables
and information_schema.columns leads to memory consumption
over 38GB RSS.
Analysis: In get_all_tables() call, we fill the I_S tables
from frm files and storage engine. As part of that process
we call make_table_name_list() and allocate memory for all
the 28k frm file names in the THD mem_root through
make_lex_string_root(). Since it has been called around
28k * 28k times there is a huge memory getting hogged in
THD mem_root. This causes the RSS to grow to 38GB.
Fix: As part of fix we are creating a temporary mem_root
in get_all_tables and passing it to fill_fiels(). There we
replace the THD mem_root with the temporary mem_root and
allocates the file names in temporary mem_root and frees
it once we fill the I_S tables in get_all_tables and
re-assign the original mem_root back to THD mem_root.
Note: Checked the massif out put with the fix now the memory growth is just around 580MB at peak.
Diffstat (limited to 'sql/sql_show.h')
-rw-r--r-- | sql/sql_show.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/sql_show.h b/sql/sql_show.h index b6d520441c7..16bfc5cdb69 100644 --- a/sql/sql_show.h +++ b/sql/sql_show.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -82,7 +82,8 @@ enum find_files_result { #define IS_FILES_EXTRA 37 find_files_result find_files(THD *thd, List<LEX_STRING> *files, const char *db, - const char *path, const char *wild, bool dir); + const char *path, const char *wild, bool dir, + MEM_ROOT *tmp_mem_root); int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet, HA_CREATE_INFO *create_info_arg, bool show_database); |