Skip to content

Commit d973217

Browse files
author
Rahul Agarkar
committed
WL#12179 Deprecate TABLESPACE=innodb_file_per_table and TABLESPACE=innodb_temporary phrases while creating temporary tables
- Added deprecation warnings while attempting to create temporary tables using TABLESPACE=innodb_file_per_table or TABLESPACE=innodb_temporary phrases RB# 20140 Reviewed by: Kevin Lewis ([email protected])
1 parent bb214b8 commit d973217

File tree

4 files changed

+113
-7
lines changed

4 files changed

+113
-7
lines changed

mysql-test/suite/innodb/r/create_table.result

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ SET DEBUG ='-d, simulate_max_char_col';
2424
"Try creating temporary table with innodb_file_per_table option with STRICT mode"
2525
SET innodb_strict_mode = ON;
2626
CREATE TEMPORARY TABLE t1(c1 int) TABLESPACE innodb_file_per_table;
27-
ERROR HY000: InnoDB: innodb_file_per_table option not supported for temporary tables.
27+
ERROR HY000: InnoDB: TABLESPACE=innodb_file_per_table option is disallowed for temporary tables with INNODB_STRICT_NODE=ON. This option is deprecated and will be removed in a future release
2828
SELECT COUNT(*) FROM t1;
2929
ERROR 42S02: Table 'test.t1' doesn't exist
3030
"Try creating temporary table with innodb_file_per_table option without STRICT mode"
3131
SET innodb_strict_mode = OFF;
3232
CREATE TEMPORARY TABLE t1(c1 int) TABLESPACE innodb_file_per_table;
3333
Warnings:
34-
Warning 1478 InnoDB: innodb_file_per_table option ignored while creating temporary table with INNODB_STRICT_MODE=OFF.
34+
Warning 1478 InnoDB: TABLESPACE=innodb_file_per_table option is ignored. This option is deprecated and will be removed in a future release.
3535
SHOW WARNINGS;
3636
Level Code Message
37-
Warning 1478 InnoDB: innodb_file_per_table option ignored while creating temporary table with INNODB_STRICT_MODE=OFF.
37+
Warning 1478 InnoDB: TABLESPACE=innodb_file_per_table option is ignored. This option is deprecated and will be removed in a future release.
3838
SELECT COUNT(*) FROM t1;
3939
COUNT(*)
4040
0

mysql-test/suite/innodb/r/create_tablespace.result

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,7 +1311,69 @@ Level Code Message
13111311
Error 1478 InnoDB: Tablespace `innodb_temporary` can only contain TEMPORARY tables.
13121312
Error 1478 Table storage engine 'InnoDB' does not support the create option 'TABLESPACE'
13131313
DROP TABLE t_not_temp;
1314+
#
1315+
# Try to create or move a temporary table in innodb_file_per_table
1316+
# or innodb_temporary tablespaces with STRICT_MODE ON and OFF
1317+
#
13141318
CREATE TEMPORARY TABLE t_my_temp (a int, b text) TABLESPACE=`innodb_temporary`;
1319+
Warnings:
1320+
Warning 1478 InnoDB: TABLESPACE=innodb_temporary option is deprecated and will be removed in a future release.
1321+
SHOW CREATE TABLE t_my_temp;
1322+
Table Create Table
1323+
t_my_temp CREATE TEMPORARY TABLE `t_my_temp` (
1324+
`a` int(11) DEFAULT NULL,
1325+
`b` text
1326+
) /*!50100 TABLESPACE `innodb_temporary` */ ENGINE=InnoDB DEFAULT CHARSET=latin1
1327+
DROP TABLE t_my_temp;
1328+
SET innodb_strict_mode = OFF;
1329+
CREATE TEMPORARY TABLE t_my_temp (a int, b text);
1330+
SHOW CREATE TABLE t_my_temp;
1331+
Table Create Table
1332+
t_my_temp CREATE TEMPORARY TABLE `t_my_temp` (
1333+
`a` int(11) DEFAULT NULL,
1334+
`b` text
1335+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1336+
ALTER TABLE t_my_temp TABLESPACE innodb_temporary;
1337+
Warnings:
1338+
Warning 1478 InnoDB: TABLESPACE=innodb_temporary option is deprecated and will be removed in a future release.
1339+
SHOW WARNINGS;
1340+
Level Code Message
1341+
Warning 1478 InnoDB: TABLESPACE=innodb_temporary option is deprecated and will be removed in a future release.
1342+
SHOW CREATE TABLE t_my_temp;
1343+
Table Create Table
1344+
t_my_temp CREATE TEMPORARY TABLE `t_my_temp` (
1345+
`a` int(11) DEFAULT NULL,
1346+
`b` text
1347+
) /*!50100 TABLESPACE `innodb_temporary` */ ENGINE=InnoDB DEFAULT CHARSET=latin1
1348+
ALTER TABLE t_my_temp TABLESPACE innodb_file_per_table;
1349+
Warnings:
1350+
Warning 1478 InnoDB: TABLESPACE=innodb_file_per_table option is ignored. This option is deprecated and will be removed in a future release.
1351+
SHOW WARNINGS;
1352+
Level Code Message
1353+
Warning 1478 InnoDB: TABLESPACE=innodb_file_per_table option is ignored. This option is deprecated and will be removed in a future release.
1354+
SHOW CREATE TABLE t_my_temp;
1355+
Table Create Table
1356+
t_my_temp CREATE TEMPORARY TABLE `t_my_temp` (
1357+
`a` int(11) DEFAULT NULL,
1358+
`b` text
1359+
) /*!50100 TABLESPACE `innodb_file_per_table` */ ENGINE=InnoDB DEFAULT CHARSET=latin1
1360+
DROP TABLE t_my_temp;
1361+
SET innodb_strict_mode = ON;
1362+
CREATE TEMPORARY TABLE t_my_temp (a int, b text);
1363+
SHOW CREATE TABLE t_my_temp;
1364+
Table Create Table
1365+
t_my_temp CREATE TEMPORARY TABLE `t_my_temp` (
1366+
`a` int(11) DEFAULT NULL,
1367+
`b` text
1368+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1369+
ALTER TABLE t_my_temp TABLESPACE=innodb_file_per_table;
1370+
ERROR HY000: InnoDB: TABLESPACE=innodb_file_per_table option is disallowed for temporary tables with INNODB_STRICT_NODE=ON. This option is deprecated and will be removed in a future release
1371+
ALTER TABLE t_my_temp TABLESPACE=innodb_temporary;
1372+
Warnings:
1373+
Warning 1478 InnoDB: TABLESPACE=innodb_temporary option is deprecated and will be removed in a future release.
1374+
SHOW WARNINGS;
1375+
Level Code Message
1376+
Warning 1478 InnoDB: TABLESPACE=innodb_temporary option is deprecated and will be removed in a future release.
13151377
SHOW CREATE TABLE t_my_temp;
13161378
Table Create Table
13171379
t_my_temp CREATE TEMPORARY TABLE `t_my_temp` (

mysql-test/suite/innodb/t/create_tablespace.test

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,10 +787,42 @@ ALTER TABLE t_not_temp TABLESPACE=`innodb_temporary`;
787787
SHOW WARNINGS;
788788
DROP TABLE t_not_temp;
789789

790+
--echo #
791+
--echo # Try to create or move a temporary table in innodb_file_per_table
792+
--echo # or innodb_temporary tablespaces with STRICT_MODE ON and OFF
793+
--echo #
790794
CREATE TEMPORARY TABLE t_my_temp (a int, b text) TABLESPACE=`innodb_temporary`;
791795
SHOW CREATE TABLE t_my_temp;
792796
DROP TABLE t_my_temp;
793797

798+
SET innodb_strict_mode = OFF;
799+
800+
CREATE TEMPORARY TABLE t_my_temp (a int, b text);
801+
SHOW CREATE TABLE t_my_temp;
802+
803+
ALTER TABLE t_my_temp TABLESPACE innodb_temporary;
804+
SHOW WARNINGS;
805+
SHOW CREATE TABLE t_my_temp;
806+
807+
ALTER TABLE t_my_temp TABLESPACE innodb_file_per_table;
808+
SHOW WARNINGS;
809+
SHOW CREATE TABLE t_my_temp;
810+
811+
DROP TABLE t_my_temp;
812+
813+
SET innodb_strict_mode = ON;
814+
CREATE TEMPORARY TABLE t_my_temp (a int, b text);
815+
SHOW CREATE TABLE t_my_temp;
816+
817+
--error ER_ILLEGAL_HA_CREATE_OPTION
818+
ALTER TABLE t_my_temp TABLESPACE=innodb_file_per_table;
819+
820+
ALTER TABLE t_my_temp TABLESPACE=innodb_temporary;
821+
SHOW WARNINGS;
822+
SHOW CREATE TABLE t_my_temp;
823+
824+
DROP TABLE t_my_temp;
825+
794826
--echo #
795827
--echo # Try to create or move a table into the redo tablespace
796828
--echo # or any tablespace using the reserved `innodb_` prefix.

storage/innobase/handler/ha_innodb.cc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10727,16 +10727,21 @@ create_table_info_t::create_option_tablespace_is_valid()
1072710727
if (THDVAR(m_thd, strict_mode)) {
1072810728
/* Return error if STRICT mode is enabled. */
1072910729
my_printf_error(ER_ILLEGAL_HA_CREATE_OPTION,
10730-
"InnoDB: innodb_file_per_table option"
10731-
" not supported for temporary tables.", MYF(0));
10730+
"InnoDB: TABLESPACE=%s option"
10731+
" is disallowed for temporary tables"
10732+
" with INNODB_STRICT_NODE=ON. This option is"
10733+
" deprecated and will be removed in a future release",
10734+
MYF(0), m_create_info->tablespace);
1073210735
return(false);
1073310736
}
1073410737
/* STRICT mode turned off. Proceed with the
1073510738
execution with a warning. */
1073610739
push_warning_printf(m_thd, Sql_condition::SL_WARNING,
1073710740
ER_ILLEGAL_HA_CREATE_OPTION,
10738-
"InnoDB: innodb_file_per_table option ignored"
10739-
" while creating temporary table with INNODB_STRICT_MODE=OFF.");
10741+
"InnoDB: TABLESPACE=%s option is ignored."
10742+
" This option is deprecated and will be"
10743+
" removed in a future release.",
10744+
m_create_info->tablespace);
1074010745
}
1074110746
return(true);
1074210747
}
@@ -11522,6 +11527,13 @@ create_table_info_t::innobase_table_flags()
1152211527
m_flags2 |= DICT_TF2_INTRINSIC;
1152311528
innodb_row_format = REC_FORMAT_DYNAMIC;
1152411529
}
11530+
if (m_create_info->tablespace != NULL &&
11531+
strcmp(m_create_info->tablespace, reserved_temporary_space_name) == 0) {
11532+
push_warning_printf(m_thd, Sql_condition::SL_WARNING,
11533+
ER_ILLEGAL_HA_CREATE_OPTION,
11534+
"InnoDB: TABLESPACE=innodb_temporary option is"
11535+
" deprecated and will be removed in a future release.");
11536+
}
1152511537
}
1152611538

1152711539
/* Set the table flags */

0 commit comments

Comments
 (0)