From 34e01f80e4b68aa4fc9791637c516cdafdf03d5b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 28 May 2015 10:03:12 +0200 Subject: [PATCH] restore innodb_encrypt_tables validation function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit that was apparently lost in 20c23048: commit 20c23048c1d2f28942f2f99e4150a58b6545c0cd Author: Jan Lindström Date: Sun May 17 14:14:16 2015 +0300 MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing This also reverts 8635c4b4: commit 8635c4b4e66712558330d9534491af0c9025e4dc Author: Jan Lindström Date: Thu May 21 11:02:03 2015 +0300 Fix test failure. --- .../sys_vars/r/innodb_encrypt_tables_basic.result | 10 ++++++++-- .../suite/sys_vars/t/innodb_encrypt_tables_basic.test | 3 +++ storage/innobase/handler/ha_innodb.cc | 2 +- storage/xtradb/handler/ha_innodb.cc | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/innodb_encrypt_tables_basic.result b/mysql-test/suite/sys_vars/r/innodb_encrypt_tables_basic.result index bcca96b8cd7..ff48f6dfab0 100644 --- a/mysql-test/suite/sys_vars/r/innodb_encrypt_tables_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_encrypt_tables_basic.result @@ -19,17 +19,23 @@ where variable_name='innodb_encrypt_tables'; VARIABLE_NAME VARIABLE_VALUE INNODB_ENCRYPT_TABLES OFF set global innodb_encrypt_tables=ON; +ERROR 42000: Variable 'innodb_encrypt_tables' can't be set to the value of 'ON' +show warnings; +Level Code Message +Warning 138 InnoDB: cannot enable encryption, encryption plugin is not available +Error 1231 Variable 'innodb_encrypt_tables' can't be set to the value of 'ON' select @@global.innodb_encrypt_tables; @@global.innodb_encrypt_tables -ON +OFF set global innodb_encrypt_tables=OFF; select @@global.innodb_encrypt_tables; @@global.innodb_encrypt_tables OFF set global innodb_encrypt_tables=1; +ERROR 42000: Variable 'innodb_encrypt_tables' can't be set to the value of '1' select @@global.innodb_encrypt_tables; @@global.innodb_encrypt_tables -ON +OFF set session innodb_encrypt_tables=1; ERROR HY000: Variable 'innodb_encrypt_tables' is a GLOBAL variable and should be set with SET GLOBAL set global innodb_encrypt_tables=1.1; diff --git a/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test b/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test index 6d6c6b94c0f..555b67f2a28 100644 --- a/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_encrypt_tables_basic.test @@ -19,10 +19,13 @@ where variable_name='innodb_encrypt_tables'; # # show that it's writable # +--error ER_WRONG_VALUE_FOR_VAR set global innodb_encrypt_tables=ON; +show warnings; select @@global.innodb_encrypt_tables; set global innodb_encrypt_tables=OFF; select @@global.innodb_encrypt_tables; +--error ER_WRONG_VALUE_FOR_VAR set global innodb_encrypt_tables=1; select @@global.innodb_encrypt_tables; --error ER_GLOBAL_VARIABLE diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f1c6d03114a..fb6818a800e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19201,7 +19201,7 @@ static MYSQL_SYSVAR_ENUM(encrypt_tables, srv_encrypt_tables, PLUGIN_VAR_OPCMDARG, "Enable encryption for tables. " "Don't forget to enable --innodb-encrypt-log too", - NULL, + innodb_encrypt_tables_validate, innodb_encrypt_tables_update, 0, &srv_encrypt_tables_typelib); diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 99216f022fb..5a2e6b7123c 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -20383,7 +20383,7 @@ static MYSQL_SYSVAR_ENUM(encrypt_tables, srv_encrypt_tables, PLUGIN_VAR_OPCMDARG, "Enable encryption for tables. " "Don't forget to enable --innodb-encrypt-log too", - NULL, + innodb_encrypt_tables_validate, innodb_encrypt_tables_update, 0, &srv_encrypt_tables_typelib);