From 9c41b35b6aa7eba86273f8634dd6d633b140211e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 1 Jun 2015 16:33:41 +0200 Subject: MDEV-8220 Server crashes if started with --enforce-storage-engine option --- mysql-test/r/enforce_storage_engine_opt.result | 14 ++++++++++++++ mysql-test/t/enforce_storage_engine_opt.opt | 1 + mysql-test/t/enforce_storage_engine_opt.test | 6 ++++++ sql/sql_plugin.cc | 3 +++ 4 files changed, 24 insertions(+) create mode 100644 mysql-test/r/enforce_storage_engine_opt.result create mode 100644 mysql-test/t/enforce_storage_engine_opt.opt create mode 100644 mysql-test/t/enforce_storage_engine_opt.test diff --git a/mysql-test/r/enforce_storage_engine_opt.result b/mysql-test/r/enforce_storage_engine_opt.result new file mode 100644 index 00000000000..a28461ef091 --- /dev/null +++ b/mysql-test/r/enforce_storage_engine_opt.result @@ -0,0 +1,14 @@ +create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; +Warnings: +Note 1266 Using storage engine MyISAM for table 't1' +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` int(11) NOT NULL AUTO_INCREMENT, + `c2` varchar(10) DEFAULT NULL, + PRIMARY KEY (`c1`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +set session sql_mode='no_engine_substitution'; +create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; +ERROR 42000: Unknown storage engine 'MEMORY' +drop table t1; diff --git a/mysql-test/t/enforce_storage_engine_opt.opt b/mysql-test/t/enforce_storage_engine_opt.opt new file mode 100644 index 00000000000..9f09b57e395 --- /dev/null +++ b/mysql-test/t/enforce_storage_engine_opt.opt @@ -0,0 +1 @@ +--enforce-storage-engine=myisam diff --git a/mysql-test/t/enforce_storage_engine_opt.test b/mysql-test/t/enforce_storage_engine_opt.test new file mode 100644 index 00000000000..82cc4117cdb --- /dev/null +++ b/mysql-test/t/enforce_storage_engine_opt.test @@ -0,0 +1,6 @@ +create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; +show create table t1; +set session sql_mode='no_engine_substitution'; +--error 1286 +create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory; +drop table t1; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 85e2151d888..847669d84ea 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -3107,6 +3107,9 @@ void plugin_thdvar_init(THD *thd) if (global_system_variables.tmp_table_plugin) thd->variables.tmp_table_plugin= intern_plugin_lock(NULL, global_system_variables.tmp_table_plugin); + if (global_system_variables.enforced_table_plugin) + thd->variables.enforced_table_plugin= + intern_plugin_lock(NULL, global_system_variables.enforced_table_plugin); intern_plugin_unlock(NULL, old_table_plugin); intern_plugin_unlock(NULL, old_tmp_table_plugin); intern_plugin_unlock(NULL, old_enforced_table_plugin); -- cgit v1.2.1