Commit 3a24f1cf authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-9307 - provide info about DATA/INDEX directory in INFORMATION_SCHEMA.TA

BLES (in CREATE_OPTIONS column)
parent ff25158d
......@@ -101,3 +101,8 @@ SELECT * FROM information_schema.partitions
WHERE table_schema= 'test' AND table_name= 'v1';
DROP TABLE t1;
DROP VIEW v1;
CREATE TABLE t1(i int) ENGINE=Innodb ROW_FORMAT=REDUNDANT DATA DIRECTORY='MYSQLTEST_VARDIR/tmp';
SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME='t1';
CREATE_OPTIONS
row_format=REDUNDANT DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/'
DROP TABLE t1;
......@@ -3715,7 +3715,7 @@ CREATE TEMPORARY TABLE `TABLES` (
`CHECK_TIME` datetime DEFAULT NULL,
`TABLE_COLLATION` varchar(32) DEFAULT NULL,
`CHECKSUM` bigint(21) unsigned DEFAULT NULL,
`CREATE_OPTIONS` varchar(255) DEFAULT NULL,
`CREATE_OPTIONS` varchar(2048) DEFAULT NULL,
`TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
......
......@@ -133,7 +133,7 @@ def information_schema TABLES TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63
def information_schema TABLES TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63
def information_schema TABLES TABLES TABLE_COLLATION Collation 253 32 0 Y 0 0 8
def information_schema TABLES TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63
def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8
def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 2048 0 Y 0 0 8
def information_schema TABLES TABLES TABLE_COMMENT Comment 253 2048 0 N 1 0 8
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
show databases;
......@@ -935,7 +935,7 @@ def information_schema TABLES TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 1 0 33
def information_schema TABLES TABLES ENGINE ENGINE 253 192 6 Y 0 0 33
def information_schema TABLES TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33
def information_schema TABLES TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 0 0 33
def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 765 0 Y 0 0 33
def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 6144 0 Y 0 0 33
def information_schema TABLES TABLES TABLE_COMMENT TABLE_COMMENT 253 6144 0 N 1 0 33
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT
def test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci
......
......@@ -202,6 +202,9 @@ t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
select create_options from information_schema.tables where table_name='t1';
create_options
DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
# CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
# options should not fail. Per documentation newly created table
# should not inherit value of these options from the original table.
......
......@@ -363,7 +363,7 @@ def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 N
def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select
def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select
def information_schema TABLES CHECK_TIME 17 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select
def information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_general_ci varchar(255) select
def information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema TABLES CREATE_TIME 15 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select
def information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select
def information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select
......@@ -906,7 +906,7 @@ NULL information_schema TABLES UPDATE_TIME datetime NULL NULL NULL NULL datetime
NULL information_schema TABLES CHECK_TIME datetime NULL NULL NULL NULL datetime
3.0000 information_schema TABLES TABLE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32)
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 CREATE_OPTIONS varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema TABLES TABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
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)
......
......@@ -47,7 +47,7 @@ UPDATE_TIME datetime YES NULL
CHECK_TIME datetime YES NULL
TABLE_COLLATION varchar(32) YES NULL
CHECKSUM bigint(21) unsigned YES NULL
CREATE_OPTIONS varchar(255) YES NULL
CREATE_OPTIONS varchar(2048) YES NULL
TABLE_COMMENT varchar(2048) NO
SHOW CREATE TABLE information_schema.TABLES;
Table Create Table
......@@ -71,7 +71,7 @@ TABLES CREATE TEMPORARY TABLE `TABLES` (
`CHECK_TIME` datetime DEFAULT NULL,
`TABLE_COLLATION` varchar(32) DEFAULT NULL,
`CHECKSUM` bigint(21) unsigned DEFAULT NULL,
`CREATE_OPTIONS` varchar(255) DEFAULT NULL,
`CREATE_OPTIONS` varchar(2048) DEFAULT NULL,
`TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
SHOW COLUMNS FROM information_schema.TABLES;
......@@ -95,7 +95,7 @@ UPDATE_TIME datetime YES NULL
CHECK_TIME datetime YES NULL
TABLE_COLLATION varchar(32) YES NULL
CHECKSUM bigint(21) unsigned YES NULL
CREATE_OPTIONS varchar(255) YES NULL
CREATE_OPTIONS varchar(2048) YES NULL
TABLE_COMMENT varchar(2048) NO
SELECT table_catalog, table_schema, table_name
FROM information_schema.tables WHERE table_catalog IS NULL OR table_catalog <> 'def';
......
......@@ -109,3 +109,9 @@ CREATE TABLE t1 engine = InnoDB AS
DROP TABLE t1;
DROP VIEW v1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t1(i int) ENGINE=Innodb ROW_FORMAT=REDUNDANT DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME='t1';
DROP TABLE t1;
......@@ -292,6 +292,8 @@ eval create table t1 (a int primary key) engine=myisam
index directory="$MYSQLTEST_VARDIR/run";
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
show create table t1;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
select create_options from information_schema.tables where table_name='t1';
--echo # CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
--echo # options should not fail. Per documentation newly created table
--echo # should not inherit value of these options from the original table.
......
......@@ -5036,6 +5036,15 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
}
append_create_options(thd, &str, share->option_list, false, 0);
if (file)
{
HA_CREATE_INFO create_info;
memset(&create_info, 0, sizeof(create_info));
file->update_create_info(&create_info);
append_directory(thd, &str, "DATA", create_info.data_file_name);
append_directory(thd, &str, "INDEX", create_info.index_file_name);
}
if (str.length())
table->field[19]->store(str.ptr()+1, str.length()-1, cs);
......@@ -8300,8 +8309,8 @@ ST_FIELD_INFO tables_fields_info[]=
OPEN_FRM_ONLY},
{"CHECKSUM", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", OPEN_FULL_TABLE},
{"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options",
OPEN_FRM_ONLY},
{"CREATE_OPTIONS", 2048, MYSQL_TYPE_STRING, 0, 1, "Create_options",
OPEN_FULL_TABLE},
{"TABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
"Comment", OPEN_FRM_ONLY},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment