Skip to content

Commit 9c41b35

Browse files
committed
MDEV-8220 Server crashes if started with --enforce-storage-engine option
1 parent d602574 commit 9c41b35

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
2+
Warnings:
3+
Note 1266 Using storage engine MyISAM for table 't1'
4+
show create table t1;
5+
Table Create Table
6+
t1 CREATE TABLE `t1` (
7+
`c1` int(11) NOT NULL AUTO_INCREMENT,
8+
`c2` varchar(10) DEFAULT NULL,
9+
PRIMARY KEY (`c1`)
10+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
11+
set session sql_mode='no_engine_substitution';
12+
create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
13+
ERROR 42000: Unknown storage engine 'MEMORY'
14+
drop table t1;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--enforce-storage-engine=myisam
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
2+
show create table t1;
3+
set session sql_mode='no_engine_substitution';
4+
--error 1286
5+
create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
6+
drop table t1;

sql/sql_plugin.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3107,6 +3107,9 @@ void plugin_thdvar_init(THD *thd)
31073107
if (global_system_variables.tmp_table_plugin)
31083108
thd->variables.tmp_table_plugin=
31093109
intern_plugin_lock(NULL, global_system_variables.tmp_table_plugin);
3110+
if (global_system_variables.enforced_table_plugin)
3111+
thd->variables.enforced_table_plugin=
3112+
intern_plugin_lock(NULL, global_system_variables.enforced_table_plugin);
31103113
intern_plugin_unlock(NULL, old_table_plugin);
31113114
intern_plugin_unlock(NULL, old_tmp_table_plugin);
31123115
intern_plugin_unlock(NULL, old_enforced_table_plugin);

0 commit comments

Comments
 (0)