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.
Showing
Please register or sign in to comment