-
Gopal Shankar authored
This patch implements I_S.FILES as a system view over data dictionary tables, and remove 5.7 code that uses a temporary table to represent I_S view. Following changes are made in the patch: * Define a system view over data dictionary tables representing I_S.FILES. * Remove 5.7 code from sql_show.cc for I_S.PARTITIONS. * Add new handler API handlerton::get_tablespace_statistics_t with following signature. typedef bool handlerton::(*get_tablespace_statistics_t)( const char *tablespace_name, const dd::Properties &ts_se_private_data, ha_tablespace_statistics *stats); This handler provides following data to I_S.FILES, ID, TYPE, LOGFILE_GROUP_NAME, // To be used by NDB LOGFILE_GROUP_NUMBER, // To be used by NDB FREE_EXTENTS, TOTAL_EXTENTS, EXTENT_SIZE, INITIAL_SIZE, MAXIMUM_SIZE, AUTOEXTEND_SIZE, VERSION, // To be used by NDB ROW_FORMAT, // To be used by NDB DATA_FREE, STATUS * Add new internal native functions to fetch above statistics for I_S.FILES. INTERNAL_TABLESPACE_ID() INTERNAL_TABLESPACE_TYPE() INTERNAL_TABLESPACE_FREE_EXTENTS() INTERNAL_TABLESPACE_TOTAL_EXTENTS() INTERNAL_TABLESPACE_EXTENT_SIZE() INTERNAL_TABLESPACE_INITIAL_SIZE() INTERNAL_TABLESPACE_MAXIMUM_SIZE() INTERNAL_TABLESPACE_AUTOEXTEND_SIZE() INTERNAL_TABLESPACE_DATA_FREE() INTERNAL_TABLESPACE_STATUS() * Added new per statistics cache class dd::info_schema::Tablespace_statistics to store statistics retrived by SE to be used when processing single row of a I_S query. This avoids internal native functions to invoke SE API only once per row. * Renamed dd::info_schema::Statistics_cache to dd::info_schema::Table_statistics because we now have not only table statistics by tablespace statistics to be cached. * Added ORDER BY clauses in some of I_S query to force order of tuple returned. Because, now the optimizer returns the rows and not read from temporary table as in 5.7 I_S design. * Add new error message that can be reported when by I_S.FILES when tablespace is missing when fetching tablespaces statistics. * Remove part of test case in main.information_schema. Because, - The problem reported back then is only applicable for 5.7 code. - The output of EXPLAIN ... <select on I_S system view> goes through optimizer and then plan return might vary. * Suppress additional warnings generated which report missing tablespaces. This happens now, because of one of following, case1) If .ibd is copy by user manually on file-system, then DD is not updated and hence I_S do not see it. The 5.7 behavior is that it looks at .ibd file in file-system and not in DD. case2) Once I_S query execution starts we see the content of DD as of the time I_S query started. If there is a new tablespace added or removed, then I_S would not see it. * MySQL 5.7 does prefix './' with all .ibd files which are to be stored in data directory. MySQL 8.0 had skipped it. I_S.FILES system view prefixes './' if filename does not have explicit patch already specified by user. Perhaps this should need a fix in server or innodb. Probably the concern raised in Bug#26518545 is the same. We might need to change I_S.FILES.FILE_NAME definition after the bug fix. * Test case for Bug#23477214 is removed now. Because the race condition does not apply now after I_S.FILES becomes a system view. * Record result files with capital I_S column names, this is expected. See WL6599 for more info. * We now show 1024 character of partition comment string, unlike just 80 characters shown in 5.7 by I_S.
Gopal Shankar authoredThis patch implements I_S.FILES as a system view over data dictionary tables, and remove 5.7 code that uses a temporary table to represent I_S view. Following changes are made in the patch: * Define a system view over data dictionary tables representing I_S.FILES. * Remove 5.7 code from sql_show.cc for I_S.PARTITIONS. * Add new handler API handlerton::get_tablespace_statistics_t with following signature. typedef bool handlerton::(*get_tablespace_statistics_t)( const char *tablespace_name, const dd::Properties &ts_se_private_data, ha_tablespace_statistics *stats); This handler provides following data to I_S.FILES, ID, TYPE, LOGFILE_GROUP_NAME, // To be used by NDB LOGFILE_GROUP_NUMBER, // To be used by NDB FREE_EXTENTS, TOTAL_EXTENTS, EXTENT_SIZE, INITIAL_SIZE, MAXIMUM_SIZE, AUTOEXTEND_SIZE, VERSION, // To be used by NDB ROW_FORMAT, // To be used by NDB DATA_FREE, STATUS * Add new internal native functions to fetch above statistics for I_S.FILES. INTERNAL_TABLESPACE_ID() INTERNAL_TABLESPACE_TYPE() INTERNAL_TABLESPACE_FREE_EXTENTS() INTERNAL_TABLESPACE_TOTAL_EXTENTS() INTERNAL_TABLESPACE_EXTENT_SIZE() INTERNAL_TABLESPACE_INITIAL_SIZE() INTERNAL_TABLESPACE_MAXIMUM_SIZE() INTERNAL_TABLESPACE_AUTOEXTEND_SIZE() INTERNAL_TABLESPACE_DATA_FREE() INTERNAL_TABLESPACE_STATUS() * Added new per statistics cache class dd::info_schema::Tablespace_statistics to store statistics retrived by SE to be used when processing single row of a I_S query. This avoids internal native functions to invoke SE API only once per row. * Renamed dd::info_schema::Statistics_cache to dd::info_schema::Table_statistics because we now have not only table statistics by tablespace statistics to be cached. * Added ORDER BY clauses in some of I_S query to force order of tuple returned. Because, now the optimizer returns the rows and not read from temporary table as in 5.7 I_S design. * Add new error message that can be reported when by I_S.FILES when tablespace is missing when fetching tablespaces statistics. * Remove part of test case in main.information_schema. Because, - The problem reported back then is only applicable for 5.7 code. - The output of EXPLAIN ... <select on I_S system view> goes through optimizer and then plan return might vary. * Suppress additional warnings generated which report missing tablespaces. This happens now, because of one of following, case1) If .ibd is copy by user manually on file-system, then DD is not updated and hence I_S do not see it. The 5.7 behavior is that it looks at .ibd file in file-system and not in DD. case2) Once I_S query execution starts we see the content of DD as of the time I_S query started. If there is a new tablespace added or removed, then I_S would not see it. * MySQL 5.7 does prefix './' with all .ibd files which are to be stored in data directory. MySQL 8.0 had skipped it. I_S.FILES system view prefixes './' if filename does not have explicit patch already specified by user. Perhaps this should need a fix in server or innodb. Probably the concern raised in Bug#26518545 is the same. We might need to change I_S.FILES.FILE_NAME definition after the bug fix. * Test case for Bug#23477214 is removed now. Because the race condition does not apply now after I_S.FILES becomes a system view. * Record result files with capital I_S column names, this is expected. See WL6599 for more info. * We now show 1024 character of partition comment string, unlike just 80 characters shown in 5.7 by I_S.
Loading