Skip to content

Commit 3a24f1c

Browse files
committed
MDEV-9307 - provide info about DATA/INDEX directory in INFORMATION_SCHEMA.TA
BLES (in CREATE_OPTIONS column)
1 parent ff25158 commit 3a24f1c

File tree

9 files changed

+35
-10
lines changed

9 files changed

+35
-10
lines changed

mysql-test/r/information_schema_inno.result

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,8 @@ SELECT * FROM information_schema.partitions
101101
WHERE table_schema= 'test' AND table_name= 'v1';
102102
DROP TABLE t1;
103103
DROP VIEW v1;
104+
CREATE TABLE t1(i int) ENGINE=Innodb ROW_FORMAT=REDUNDANT DATA DIRECTORY='MYSQLTEST_VARDIR/tmp';
105+
SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME='t1';
106+
CREATE_OPTIONS
107+
row_format=REDUNDANT DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/'
108+
DROP TABLE t1;

mysql-test/r/mysqldump.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3715,7 +3715,7 @@ CREATE TEMPORARY TABLE `TABLES` (
37153715
`CHECK_TIME` datetime DEFAULT NULL,
37163716
`TABLE_COLLATION` varchar(32) DEFAULT NULL,
37173717
`CHECKSUM` bigint(21) unsigned DEFAULT NULL,
3718-
`CREATE_OPTIONS` varchar(255) DEFAULT NULL,
3718+
`CREATE_OPTIONS` varchar(2048) DEFAULT NULL,
37193719
`TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
37203720
) ENGINE=MEMORY DEFAULT CHARSET=utf8;
37213721
/*!40101 SET character_set_client = @saved_cs_client */;

mysql-test/r/show_check.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def information_schema TABLES TABLES UPDATE_TIME Update_time 12 19 0 Y 128 0 63
133133
def information_schema TABLES TABLES CHECK_TIME Check_time 12 19 0 Y 128 0 63
134134
def information_schema TABLES TABLES TABLE_COLLATION Collation 253 32 0 Y 0 0 8
135135
def information_schema TABLES TABLES CHECKSUM Checksum 8 21 0 Y 32800 0 63
136-
def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 255 0 Y 0 0 8
136+
def information_schema TABLES TABLES CREATE_OPTIONS Create_options 253 2048 0 Y 0 0 8
137137
def information_schema TABLES TABLES TABLE_COMMENT Comment 253 2048 0 N 1 0 8
138138
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
139139
show databases;
@@ -935,7 +935,7 @@ def information_schema TABLES TABLES TABLE_TYPE TABLE_TYPE 253 192 10 N 1 0 33
935935
def information_schema TABLES TABLES ENGINE ENGINE 253 192 6 Y 0 0 33
936936
def information_schema TABLES TABLES ROW_FORMAT ROW_FORMAT 253 30 5 Y 0 0 33
937937
def information_schema TABLES TABLES TABLE_COLLATION TABLE_COLLATION 253 96 17 Y 0 0 33
938-
def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 765 0 Y 0 0 33
938+
def information_schema TABLES TABLES CREATE_OPTIONS CREATE_OPTIONS 253 6144 0 Y 0 0 33
939939
def information_schema TABLES TABLES TABLE_COMMENT TABLE_COMMENT 253 6144 0 N 1 0 33
940940
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE ROW_FORMAT TABLE_COLLATION CREATE_OPTIONS TABLE_COMMENT
941941
def test t1 BASE TABLE MyISAM Fixed latin1_swedish_ci

mysql-test/r/symlink.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,9 @@ t1 CREATE TABLE `t1` (
202202
`a` int(11) NOT NULL,
203203
PRIMARY KEY (`a`)
204204
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
205+
select create_options from information_schema.tables where table_name='t1';
206+
create_options
207+
DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
205208
# CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
206209
# options should not fail. Per documentation newly created table
207210
# should not inherit value of these options from the original table.

mysql-test/suite/funcs_1/r/is_columns_is.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 N
363363
def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select
364364
def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select
365365
def information_schema TABLES CHECK_TIME 17 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select
366-
def information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 255 765 NULL NULL NULL utf8 utf8_general_ci varchar(255) select
366+
def information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select
367367
def information_schema TABLES CREATE_TIME 15 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select
368368
def information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select
369369
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
906906
NULL information_schema TABLES CHECK_TIME datetime NULL NULL NULL NULL datetime
907907
3.0000 information_schema TABLES TABLE_COLLATION varchar 32 96 utf8 utf8_general_ci varchar(32)
908908
NULL information_schema TABLES CHECKSUM bigint NULL NULL NULL NULL bigint(21) unsigned
909-
3.0000 information_schema TABLES CREATE_OPTIONS varchar 255 765 utf8 utf8_general_ci varchar(255)
909+
3.0000 information_schema TABLES CREATE_OPTIONS varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
910910
3.0000 information_schema TABLES TABLE_COMMENT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
911911
3.0000 information_schema TABLESPACES TABLESPACE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
912912
3.0000 information_schema TABLESPACES ENGINE varchar 64 192 utf8 utf8_general_ci varchar(64)

mysql-test/suite/funcs_1/r/is_tables.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ UPDATE_TIME datetime YES NULL
4747
CHECK_TIME datetime YES NULL
4848
TABLE_COLLATION varchar(32) YES NULL
4949
CHECKSUM bigint(21) unsigned YES NULL
50-
CREATE_OPTIONS varchar(255) YES NULL
50+
CREATE_OPTIONS varchar(2048) YES NULL
5151
TABLE_COMMENT varchar(2048) NO
5252
SHOW CREATE TABLE information_schema.TABLES;
5353
Table Create Table
@@ -71,7 +71,7 @@ TABLES CREATE TEMPORARY TABLE `TABLES` (
7171
`CHECK_TIME` datetime DEFAULT NULL,
7272
`TABLE_COLLATION` varchar(32) DEFAULT NULL,
7373
`CHECKSUM` bigint(21) unsigned DEFAULT NULL,
74-
`CREATE_OPTIONS` varchar(255) DEFAULT NULL,
74+
`CREATE_OPTIONS` varchar(2048) DEFAULT NULL,
7575
`TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
7676
) ENGINE=MEMORY DEFAULT CHARSET=utf8
7777
SHOW COLUMNS FROM information_schema.TABLES;
@@ -95,7 +95,7 @@ UPDATE_TIME datetime YES NULL
9595
CHECK_TIME datetime YES NULL
9696
TABLE_COLLATION varchar(32) YES NULL
9797
CHECKSUM bigint(21) unsigned YES NULL
98-
CREATE_OPTIONS varchar(255) YES NULL
98+
CREATE_OPTIONS varchar(2048) YES NULL
9999
TABLE_COMMENT varchar(2048) NO
100100
SELECT table_catalog, table_schema, table_name
101101
FROM information_schema.tables WHERE table_catalog IS NULL OR table_catalog <> 'def';

mysql-test/t/information_schema_inno.test

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,9 @@ CREATE TABLE t1 engine = InnoDB AS
109109

110110
DROP TABLE t1;
111111
DROP VIEW v1;
112+
113+
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
114+
eval CREATE TABLE t1(i int) ENGINE=Innodb ROW_FORMAT=REDUNDANT DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp';
115+
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
116+
SELECT CREATE_OPTIONS FROM INFORMATION_SCHEMA.TABLES where TABLE_NAME='t1';
117+
DROP TABLE t1;

mysql-test/t/symlink.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,8 @@ eval create table t1 (a int primary key) engine=myisam
292292
index directory="$MYSQLTEST_VARDIR/run";
293293
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
294294
show create table t1;
295+
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
296+
select create_options from information_schema.tables where table_name='t1';
295297
--echo # CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
296298
--echo # options should not fail. Per documentation newly created table
297299
--echo # should not inherit value of these options from the original table.

sql/sql_show.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5036,6 +5036,15 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
50365036
}
50375037
append_create_options(thd, &str, share->option_list, false, 0);
50385038

5039+
if (file)
5040+
{
5041+
HA_CREATE_INFO create_info;
5042+
memset(&create_info, 0, sizeof(create_info));
5043+
file->update_create_info(&create_info);
5044+
append_directory(thd, &str, "DATA", create_info.data_file_name);
5045+
append_directory(thd, &str, "INDEX", create_info.index_file_name);
5046+
}
5047+
50395048
if (str.length())
50405049
table->field[19]->store(str.ptr()+1, str.length()-1, cs);
50415050

@@ -8300,8 +8309,8 @@ ST_FIELD_INFO tables_fields_info[]=
83008309
OPEN_FRM_ONLY},
83018310
{"CHECKSUM", MY_INT64_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONGLONG, 0,
83028311
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Checksum", OPEN_FULL_TABLE},
8303-
{"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options",
8304-
OPEN_FRM_ONLY},
8312+
{"CREATE_OPTIONS", 2048, MYSQL_TYPE_STRING, 0, 1, "Create_options",
8313+
OPEN_FULL_TABLE},
83058314
{"TABLE_COMMENT", TABLE_COMMENT_MAXLEN, MYSQL_TYPE_STRING, 0, 0,
83068315
"Comment", OPEN_FRM_ONLY},
83078316
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}

0 commit comments

Comments
 (0)