mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#2511 - Add a new table to the Information Schema for TABLESPACE's
Implemented a new INFORMATION_SCHEMA table, which is intended to provide information about tablespaces. mysql-test/r/information_schema.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. mysql-test/r/information_schema_db.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. mysql-test/r/mysqlshow.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. mysql-test/suite/funcs_1/r/is_columns_is.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. mysql-test/suite/funcs_1/r/is_tables_is.result: Updated test result according to WL#2511. With this WL I_S has new TABLESPACES schema. sql/handler.h: Added SCH_TABLESPACES to enum_schema_tables. sql/mysql_priv.h: Added human readable definitions for I_S.TABLESPACES field identifiers. sql/sql_show.cc: Added I_S.TABLESPACES schema. The code which handles I_S.FILES is capable to handle I_S.TABLESPACES as well. Thus we reuse this code and let functions/variables have more generic names.
This commit is contained in:
@ -65,6 +65,7 @@ SESSION_STATUS
|
||||
SESSION_VARIABLES
|
||||
STATISTICS
|
||||
TABLES
|
||||
TABLESPACES
|
||||
TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES
|
||||
TRIGGERS
|
||||
@ -103,6 +104,7 @@ inner join information_schema.TABLES v2 on (v1.c=v2.table_name)
|
||||
where v1.c like "t%";
|
||||
c table_name
|
||||
TABLES TABLES
|
||||
TABLESPACES TABLESPACES
|
||||
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES TABLE_PRIVILEGES
|
||||
TRIGGERS TRIGGERS
|
||||
@ -122,6 +124,7 @@ left join information_schema.TABLES v2 on (v1.c=v2.table_name)
|
||||
where v1.c like "t%";
|
||||
c table_name
|
||||
TABLES TABLES
|
||||
TABLESPACES TABLESPACES
|
||||
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES TABLE_PRIVILEGES
|
||||
TRIGGERS TRIGGERS
|
||||
@ -141,6 +144,7 @@ right join information_schema.TABLES v2 on (v1.c=v2.table_name)
|
||||
where v1.c like "t%";
|
||||
c table_name
|
||||
TABLES TABLES
|
||||
TABLESPACES TABLESPACES
|
||||
TABLE_CONSTRAINTS TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES TABLE_PRIVILEGES
|
||||
TRIGGERS TRIGGERS
|
||||
@ -628,6 +632,7 @@ COLLATIONS SYSTEM VIEW MEMORY
|
||||
show tables from information_schema like "T%";
|
||||
Tables_in_information_schema (T%)
|
||||
TABLES
|
||||
TABLESPACES
|
||||
TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES
|
||||
TRIGGERS
|
||||
@ -637,6 +642,7 @@ use information_schema;
|
||||
show full tables like "T%";
|
||||
Tables_in_information_schema (T%) Table_type
|
||||
TABLES SYSTEM VIEW
|
||||
TABLESPACES SYSTEM VIEW
|
||||
TABLE_CONSTRAINTS SYSTEM VIEW
|
||||
TABLE_PRIVILEGES SYSTEM VIEW
|
||||
TRIGGERS SYSTEM VIEW
|
||||
@ -649,6 +655,7 @@ use information_schema;
|
||||
show tables like "T%";
|
||||
Tables_in_information_schema (T%)
|
||||
TABLES
|
||||
TABLESPACES
|
||||
TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES
|
||||
TRIGGERS
|
||||
@ -855,7 +862,7 @@ table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest')
|
||||
AND table_name not like 'ndb%' AND table_name not like 'innodb_%'
|
||||
GROUP BY TABLE_SCHEMA;
|
||||
table_schema count(*)
|
||||
information_schema 28
|
||||
information_schema 29
|
||||
mysql 22
|
||||
create table t1 (i int, j int);
|
||||
create trigger trg1 before insert on t1 for each row
|
||||
@ -1317,6 +1324,7 @@ SESSION_STATUS information_schema.SESSION_STATUS 1
|
||||
SESSION_VARIABLES information_schema.SESSION_VARIABLES 1
|
||||
STATISTICS information_schema.STATISTICS 1
|
||||
TABLES information_schema.TABLES 1
|
||||
TABLESPACES information_schema.TABLESPACES 1
|
||||
TABLE_CONSTRAINTS information_schema.TABLE_CONSTRAINTS 1
|
||||
TABLE_PRIVILEGES information_schema.TABLE_PRIVILEGES 1
|
||||
TRIGGERS information_schema.TRIGGERS 1
|
||||
|
@ -28,6 +28,7 @@ SESSION_STATUS
|
||||
SESSION_VARIABLES
|
||||
STATISTICS
|
||||
TABLES
|
||||
TABLESPACES
|
||||
TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES
|
||||
TRIGGERS
|
||||
@ -36,6 +37,7 @@ VIEWS
|
||||
show tables from INFORMATION_SCHEMA like 'T%';
|
||||
Tables_in_information_schema (T%)
|
||||
TABLES
|
||||
TABLESPACES
|
||||
TABLE_CONSTRAINTS
|
||||
TABLE_PRIVILEGES
|
||||
TRIGGERS
|
||||
|
@ -102,6 +102,7 @@ Database: information_schema
|
||||
| SESSION_VARIABLES |
|
||||
| STATISTICS |
|
||||
| TABLES |
|
||||
| TABLESPACES |
|
||||
| TABLE_CONSTRAINTS |
|
||||
| TABLE_PRIVILEGES |
|
||||
| TRIGGERS |
|
||||
@ -142,6 +143,7 @@ Database: INFORMATION_SCHEMA
|
||||
| SESSION_VARIABLES |
|
||||
| STATISTICS |
|
||||
| TABLES |
|
||||
| TABLESPACES |
|
||||
| TABLE_CONSTRAINTS |
|
||||
| TABLE_PRIVILEGES |
|
||||
| TRIGGERS |
|
||||
|
@ -252,6 +252,15 @@ def information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 u
|
||||
def information_schema TABLES TABLE_TYPE 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
def information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
|
||||
def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
|
||||
def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
|
||||
def information_schema TABLESPACES ENGINE 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
|
||||
def information_schema TABLESPACES LOGFILE_GROUP_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
|
||||
def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
|
||||
def information_schema TABLESPACES TABLESPACE_COMMENT 9 NULL YES varchar 2048 6144 NULL NULL utf8 utf8_general_ci varchar(2048) select
|
||||
def information_schema TABLESPACES TABLESPACE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
def information_schema TABLESPACES TABLESPACE_TYPE 3 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
def information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
|
||||
def information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
def information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
|
||||
@ -607,6 +616,15 @@ NULL information_schema TABLES CHECK_TIME datetime NULL NULL NULL NULL datetime
|
||||
NULL information_schema TABLES CHECKSUM bigint NULL NULL NULL NULL bigint(21) unsigned
|
||||
3.0000 information_schema TABLES CREATE_OPTIONS varchar 255 765 utf8 utf8_general_ci varchar(255)
|
||||
3.0000 information_schema TABLES TABLE_COMMENT varchar 80 240 utf8 utf8_general_ci varchar(80)
|
||||
3.0000 information_schema TABLESPACES TABLESPACE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema TABLESPACES ENGINE varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema TABLESPACES TABLESPACE_TYPE varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema TABLESPACES LOGFILE_GROUP_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
NULL information_schema TABLESPACES EXTENT_SIZE bigint NULL NULL NULL NULL bigint(21) unsigned
|
||||
NULL information_schema TABLESPACES AUTOEXTEND_SIZE bigint NULL NULL NULL NULL bigint(21) unsigned
|
||||
NULL information_schema TABLESPACES MAXIMUM_SIZE bigint NULL NULL NULL NULL bigint(21) unsigned
|
||||
NULL information_schema TABLESPACES NODEGROUP_ID bigint NULL NULL NULL NULL bigint(21) unsigned
|
||||
3.0000 information_schema TABLESPACES TABLESPACE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
|
||||
3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
|
||||
3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
3.0000 information_schema TABLE_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
|
||||
|
@ -521,6 +521,29 @@ user_comment
|
||||
Separator -----------------------------------------------------
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA information_schema
|
||||
TABLE_NAME TABLESPACES
|
||||
TABLE_TYPE SYSTEM VIEW
|
||||
ENGINE MEMORY
|
||||
VERSION 10
|
||||
ROW_FORMAT Fixed
|
||||
TABLE_ROWS #TBLR#
|
||||
AVG_ROW_LENGTH #ARL#
|
||||
DATA_LENGTH #DL#
|
||||
MAX_DATA_LENGTH #MDL#
|
||||
INDEX_LENGTH #IL#
|
||||
DATA_FREE #DF#
|
||||
AUTO_INCREMENT NULL
|
||||
CREATE_TIME #CRT#
|
||||
UPDATE_TIME #UT#
|
||||
CHECK_TIME #CT#
|
||||
TABLE_COLLATION utf8_general_ci
|
||||
CHECKSUM NULL
|
||||
CREATE_OPTIONS #CO#
|
||||
TABLE_COMMENT #TC#
|
||||
user_comment
|
||||
Separator -----------------------------------------------------
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA information_schema
|
||||
TABLE_NAME TABLE_CONSTRAINTS
|
||||
TABLE_TYPE SYSTEM VIEW
|
||||
ENGINE MEMORY
|
||||
@ -1159,6 +1182,29 @@ user_comment
|
||||
Separator -----------------------------------------------------
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA information_schema
|
||||
TABLE_NAME TABLESPACES
|
||||
TABLE_TYPE SYSTEM VIEW
|
||||
ENGINE MEMORY
|
||||
VERSION 10
|
||||
ROW_FORMAT Fixed
|
||||
TABLE_ROWS #TBLR#
|
||||
AVG_ROW_LENGTH #ARL#
|
||||
DATA_LENGTH #DL#
|
||||
MAX_DATA_LENGTH #MDL#
|
||||
INDEX_LENGTH #IL#
|
||||
DATA_FREE #DF#
|
||||
AUTO_INCREMENT NULL
|
||||
CREATE_TIME #CRT#
|
||||
UPDATE_TIME #UT#
|
||||
CHECK_TIME #CT#
|
||||
TABLE_COLLATION utf8_general_ci
|
||||
CHECKSUM NULL
|
||||
CREATE_OPTIONS #CO#
|
||||
TABLE_COMMENT #TC#
|
||||
user_comment
|
||||
Separator -----------------------------------------------------
|
||||
TABLE_CATALOG def
|
||||
TABLE_SCHEMA information_schema
|
||||
TABLE_NAME TABLE_CONSTRAINTS
|
||||
TABLE_TYPE SYSTEM VIEW
|
||||
ENGINE MEMORY
|
||||
|
@ -546,6 +546,7 @@ enum enum_schema_tables
|
||||
SCH_STATISTICS,
|
||||
SCH_STATUS,
|
||||
SCH_TABLES,
|
||||
SCH_TABLESPACES,
|
||||
SCH_TABLE_CONSTRAINTS,
|
||||
SCH_TABLE_NAMES,
|
||||
SCH_TABLE_PRIVILEGES,
|
||||
|
@ -2458,6 +2458,17 @@ inline void kill_delayed_threads(void) {}
|
||||
#define IS_FILES_CHECKSUM 35
|
||||
#define IS_FILES_STATUS 36
|
||||
#define IS_FILES_EXTRA 37
|
||||
|
||||
#define IS_TABLESPACES_TABLESPACE_NAME 0
|
||||
#define IS_TABLESPACES_ENGINE 1
|
||||
#define IS_TABLESPACES_TABLESPACE_TYPE 2
|
||||
#define IS_TABLESPACES_LOGFILE_GROUP_NAME 3
|
||||
#define IS_TABLESPACES_EXTENT_SIZE 4
|
||||
#define IS_TABLESPACES_AUTOEXTEND_SIZE 5
|
||||
#define IS_TABLESPACES_MAXIMUM_SIZE 6
|
||||
#define IS_TABLESPACES_NODEGROUP_ID 7
|
||||
#define IS_TABLESPACES_TABLESPACE_COMMENT 8
|
||||
|
||||
void init_fill_schema_files_row(TABLE* table);
|
||||
bool schema_table_store_record(THD *thd, TABLE *table);
|
||||
|
||||
|
@ -6252,17 +6252,17 @@ bool get_schema_tables_result(JOIN *join,
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
struct run_hton_fill_schema_files_args
|
||||
struct run_hton_fill_schema_table_args
|
||||
{
|
||||
TABLE_LIST *tables;
|
||||
COND *cond;
|
||||
};
|
||||
|
||||
static my_bool run_hton_fill_schema_files(THD *thd, plugin_ref plugin,
|
||||
static my_bool run_hton_fill_schema_table(THD *thd, plugin_ref plugin,
|
||||
void *arg)
|
||||
{
|
||||
struct run_hton_fill_schema_files_args *args=
|
||||
(run_hton_fill_schema_files_args *) arg;
|
||||
struct run_hton_fill_schema_table_args *args=
|
||||
(run_hton_fill_schema_table_args *) arg;
|
||||
handlerton *hton= plugin_data(plugin, handlerton *);
|
||||
if (hton->fill_is_table && hton->state == SHOW_OPTION_YES)
|
||||
hton->fill_is_table(hton, thd, args->tables, args->cond,
|
||||
@ -6270,15 +6270,15 @@ static my_bool run_hton_fill_schema_files(THD *thd, plugin_ref plugin,
|
||||
return false;
|
||||
}
|
||||
|
||||
int fill_schema_files(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
int hton_fill_schema_table(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
{
|
||||
DBUG_ENTER("fill_schema_files");
|
||||
DBUG_ENTER("hton_fill_schema_table");
|
||||
|
||||
struct run_hton_fill_schema_files_args args;
|
||||
struct run_hton_fill_schema_table_args args;
|
||||
args.tables= tables;
|
||||
args.cond= cond;
|
||||
|
||||
plugin_foreach(thd, run_hton_fill_schema_files,
|
||||
plugin_foreach(thd, run_hton_fill_schema_table,
|
||||
MYSQL_STORAGE_ENGINE_PLUGIN, &args);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
@ -6860,6 +6860,29 @@ ST_FIELD_INFO referential_constraints_fields_info[]=
|
||||
};
|
||||
|
||||
|
||||
ST_FIELD_INFO tablespaces_fields_info[]=
|
||||
{
|
||||
{"TABLESPACE_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
|
||||
SKIP_OPEN_TABLE},
|
||||
{"ENGINE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE},
|
||||
{"TABLESPACE_TYPE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL,
|
||||
0, SKIP_OPEN_TABLE},
|
||||
{"LOGFILE_GROUP_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL,
|
||||
0, SKIP_OPEN_TABLE},
|
||||
{"EXTENT_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE},
|
||||
{"AUTOEXTEND_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE},
|
||||
{"MAXIMUM_SIZE", 21, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE},
|
||||
{"NODEGROUP_ID", 21, MYSQL_TYPE_LONGLONG, 0,
|
||||
MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED, 0, SKIP_OPEN_TABLE},
|
||||
{"TABLESPACE_COMMENT", 2048, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0,
|
||||
SKIP_OPEN_TABLE},
|
||||
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Description of ST_FIELD_INFO in table.h
|
||||
|
||||
@ -6890,7 +6913,7 @@ ST_SCHEMA_TABLE schema_tables[]=
|
||||
0, make_old_format, 0, -1, -1, 0, 0},
|
||||
#endif
|
||||
{"FILES", files_fields_info, create_schema_table,
|
||||
fill_schema_files, 0, 0, -1, -1, 0, 0},
|
||||
hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
|
||||
{"GLOBAL_STATUS", variables_fields_info, create_schema_table,
|
||||
fill_status, make_old_format, 0, 0, -1, 0, 0},
|
||||
{"GLOBAL_VARIABLES", variables_fields_info, create_schema_table,
|
||||
@ -6931,6 +6954,8 @@ ST_SCHEMA_TABLE schema_tables[]=
|
||||
{"TABLES", tables_fields_info, create_schema_table,
|
||||
get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0,
|
||||
OPTIMIZE_I_S_TABLE},
|
||||
{"TABLESPACES", tablespaces_fields_info, create_schema_table,
|
||||
hton_fill_schema_table, 0, 0, -1, -1, 0, 0},
|
||||
{"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table,
|
||||
get_all_tables, 0, get_schema_constraints_record, 3, 4, 0,
|
||||
OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
|
||||
|
Reference in New Issue
Block a user