diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-01-17 11:52:31 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-01-17 12:09:23 +0200 |
commit | c849b7df616cc8a5378609f243898644c7689f44 (patch) | |
tree | fd51fc08435d0b95ec1f0f54ba52598ba4389ce9 | |
parent | bb109aeea3e696f89357c946a3c04ca112925d11 (diff) | |
download | mariadb-git-c849b7df616cc8a5378609f243898644c7689f44.tar.gz |
MDEV-11785 Remove INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO
The INFORMATION_SCHEMA view INNODB_TEMP_TABLE_INFO was added to
MySQL 5.7 as part of the work to implement temporary tables
without any redo logging.
The only use case of this view was SELECT COUNT(*) in some tests,
to see how many temporary tables exist in InnoDB. The columns do
not report much useful information. For example, the table name
would not be the user-specified table name, but a generated #sql
name. Also, the session that created the table is not identified.
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 1 | ||||
-rw-r--r-- | storage/innobase/handler/i_s.cc | 283 | ||||
-rw-r--r-- | storage/innobase/handler/i_s.h | 3 |
3 files changed, 2 insertions, 285 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9e9a6a5994d..4e1d8e3367b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -23396,7 +23396,6 @@ i_s_innodb_cmp_per_index_reset, i_s_innodb_buffer_page, i_s_innodb_buffer_page_lru, i_s_innodb_buffer_stats, -i_s_innodb_temp_table_info, i_s_innodb_metrics, i_s_innodb_ft_default_stopword, i_s_innodb_ft_deleted, diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 4a13faa480f..01fadaf8e10 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. -Copyrigth (c) 2014, 2016, MariaDB Corporation +Copyrigth (c) 2014, 2017, MariaDB Corporation 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 the Free Software @@ -4097,287 +4097,6 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_config = STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; -/* Fields of the dynamic table INNODB_TEMP_TABLE_INFO. */ -static ST_FIELD_INFO i_s_innodb_temp_table_info_fields_info[] = -{ -#define IDX_TEMP_TABLE_ID 0 - {STRUCT_FLD(field_name, "TABLE_ID"), - STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define IDX_TEMP_TABLE_NAME 1 - {STRUCT_FLD(field_name, "NAME"), - STRUCT_FLD(field_length, MAX_TABLE_UTF8_LEN), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define IDX_TEMP_TABLE_N_COLS 2 - {STRUCT_FLD(field_name, "N_COLS"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define IDX_TEMP_TABLE_SPACE_ID 3 - {STRUCT_FLD(field_name, "SPACE"), - STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), - STRUCT_FLD(field_type, MYSQL_TYPE_LONG), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define IDX_TEMP_TABLE_PTT 4 - {STRUCT_FLD(field_name, "PER_TABLE_TABLESPACE"), - STRUCT_FLD(field_length, 64), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - -#define IDX_TEMP_TABLE_IS_COMPRESSED 5 - {STRUCT_FLD(field_name, "IS_COMPRESSED"), - STRUCT_FLD(field_length, 64), - STRUCT_FLD(field_type, MYSQL_TYPE_STRING), - STRUCT_FLD(value, 0), - STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), - STRUCT_FLD(old_name, ""), - STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, - END_OF_ST_FIELD_INFO -}; - -struct temp_table_info_t{ - table_id_t m_table_id; - char m_table_name[MAX_TABLE_UTF8_LEN]; - unsigned m_n_cols; - unsigned m_space_id; - char m_per_table_tablespace[64]; - char m_is_compressed[64]; -}; - -typedef std::vector<temp_table_info_t, ut_allocator<temp_table_info_t> > - temp_table_info_cache_t; - -/*******************************************************************//** -Fill Information Schema table INNODB_TEMP_TABLE_INFO for a particular -temp-table -@return 0 on success, 1 on failure */ -static -int -i_s_innodb_temp_table_info_fill( -/*=============================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables - to fill */ - const temp_table_info_t* info) /*!< in: temp-table - information */ -{ - TABLE* table; - Field** fields; - - DBUG_ENTER("i_s_innodb_temp_table_info_fill"); - - table = tables->table; - - fields = table->field; - - OK(fields[IDX_TEMP_TABLE_ID]->store(info->m_table_id, true)); - - OK(field_store_string( - fields[IDX_TEMP_TABLE_NAME], info->m_table_name)); - - OK(fields[IDX_TEMP_TABLE_N_COLS]->store(info->m_n_cols)); - - OK(fields[IDX_TEMP_TABLE_SPACE_ID]->store(info->m_space_id)); - - OK(field_store_string( - fields[IDX_TEMP_TABLE_PTT], info->m_per_table_tablespace)); - - OK(field_store_string( - fields[IDX_TEMP_TABLE_IS_COMPRESSED], info->m_is_compressed)); - - DBUG_RETURN(schema_table_store_record(thd, table)); -} - -/*******************************************************************//** -Populate current table information to cache */ -static -void -innodb_temp_table_populate_cache( -/*=============================*/ - const dict_table_t* table, /*! in: table */ - temp_table_info_t* cache) /*! in/out: populate data in this - cache */ -{ - cache->m_table_id = table->id; - - char db_utf8[MAX_DB_UTF8_LEN]; - char table_utf8[MAX_TABLE_UTF8_LEN]; - - dict_fs2utf8(table->name.m_name, - db_utf8, sizeof(db_utf8), - table_utf8, sizeof(table_utf8)); - strcpy(cache->m_table_name, table_utf8); - - cache->m_n_cols = table->n_cols; - - cache->m_space_id = table->space; - - if (fsp_is_system_temporary(table->space)) { - strcpy(cache->m_per_table_tablespace, "FALSE"); - } else { - strcpy(cache->m_per_table_tablespace, "TRUE"); - } - - if (dict_table_page_size(table).is_compressed()) { - strcpy(cache->m_is_compressed, "TRUE"); - } else { - strcpy(cache->m_is_compressed, "FALSE"); - } -} - -/*******************************************************************//** -This function will iterate over all available table and will fill -stats for temp-tables to INNODB_TEMP_TABLE_INFO. -@return 0 on success, 1 on failure */ -static -int -i_s_innodb_temp_table_info_fill_table( -/*===================================*/ - THD* thd, /*!< in: thread */ - TABLE_LIST* tables, /*!< in/out: tables to fill */ - Item* ) /*!< in: condition (ignored) */ -{ - int status = 0; - dict_table_t* table = NULL; - - DBUG_ENTER("i_s_innodb_temp_table_info_fill_table"); - - /* Only allow the PROCESS privilege holder to access the stats */ - if (check_global_access(thd, PROCESS_ACL)) { - DBUG_RETURN(0); - } - - /* First populate all temp-table info by acquiring dict_sys->mutex. - Note: Scan is being done on NON-LRU list which mainly has system - table entries and temp-table entries. This means 2 things: list - is smaller so processing would be faster and most of the data - is relevant */ - temp_table_info_cache_t all_temp_info_cache; - all_temp_info_cache.reserve(UT_LIST_GET_LEN(dict_sys->table_non_LRU)); - - mutex_enter(&dict_sys->mutex); - for (table = UT_LIST_GET_FIRST(dict_sys->table_non_LRU); - table != NULL; - table = UT_LIST_GET_NEXT(table_LRU, table)) { - - if (!dict_table_is_temporary(table)) { - continue; - } - - temp_table_info_t current_temp_table_info; - - innodb_temp_table_populate_cache( - table, ¤t_temp_table_info); - - all_temp_info_cache.push_back(current_temp_table_info); - } - mutex_exit(&dict_sys->mutex); - - /* Now populate the info to MySQL table */ - temp_table_info_cache_t::const_iterator end = all_temp_info_cache.end(); - for (temp_table_info_cache_t::const_iterator it - = all_temp_info_cache.begin(); - it != end; - it++) { - status = i_s_innodb_temp_table_info_fill(thd, tables, &(*it)); - if (status) { - break; - } - } - - DBUG_RETURN(status); -} - -/*******************************************************************//** -Bind the dynamic table INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO. -@return 0 on success, 1 on failure */ -static -int -i_s_innodb_temp_table_info_init( -/*=============================*/ - void* p) /*!< in/out: table schema object */ -{ - ST_SCHEMA_TABLE* schema; - - DBUG_ENTER("i_s_innodb_temp_table_info_init"); - - schema = reinterpret_cast<ST_SCHEMA_TABLE*>(p); - - schema->fields_info = i_s_innodb_temp_table_info_fields_info; - schema->fill_table = i_s_innodb_temp_table_info_fill_table; - - DBUG_RETURN(0); -} - -struct st_maria_plugin i_s_innodb_temp_table_info = -{ - /* the plugin type (a MYSQL_XXX_PLUGIN value) */ - /* int */ - STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), - - /* pointer to type-specific plugin descriptor */ - /* void* */ - STRUCT_FLD(info, &i_s_info), - - /* plugin name */ - /* const char* */ - STRUCT_FLD(name, "INNODB_TEMP_TABLE_INFO"), - - /* plugin author (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(author, plugin_author), - - /* general descriptive text (for SHOW PLUGINS) */ - /* const char* */ - STRUCT_FLD(descr, "InnoDB Temp Table Stats"), - - /* the plugin license (PLUGIN_LICENSE_XXX) */ - /* int */ - STRUCT_FLD(license, PLUGIN_LICENSE_GPL), - - /* the function to invoke when plugin is loaded */ - /* int (*)(void*); */ - STRUCT_FLD(init, i_s_innodb_temp_table_info_init), - - /* the function to invoke when plugin is unloaded */ - /* int (*)(void*); */ - STRUCT_FLD(deinit, i_s_common_deinit), - - /* plugin version (for SHOW PLUGINS) */ - /* unsigned int */ - STRUCT_FLD(version, INNODB_VERSION_SHORT), - - /* struct st_mysql_show_var* */ - STRUCT_FLD(status_vars, NULL), - - /* struct st_mysql_sys_var** */ - STRUCT_FLD(system_vars, NULL), - - STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA) -}; - /* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */ static ST_FIELD_INFO i_s_innodb_buffer_stats_fields_info[] = { diff --git a/storage/innobase/handler/i_s.h b/storage/innobase/handler/i_s.h index d272490dd27..8d34fbf8fbb 100644 --- a/storage/innobase/handler/i_s.h +++ b/storage/innobase/handler/i_s.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyrigth (c) 2014, 2016, MariaDB Corporation +Copyrigth (c) 2014, 2017, MariaDB Corporation 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 the Free Software @@ -50,7 +50,6 @@ extern struct st_maria_plugin i_s_innodb_ft_config; extern struct st_maria_plugin i_s_innodb_buffer_page; extern struct st_maria_plugin i_s_innodb_buffer_page_lru; extern struct st_maria_plugin i_s_innodb_buffer_stats; -extern struct st_maria_plugin i_s_innodb_temp_table_info; extern struct st_maria_plugin i_s_innodb_sys_tables; extern struct st_maria_plugin i_s_innodb_sys_tablestats; extern struct st_maria_plugin i_s_innodb_sys_indexes; |