summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-12-13 08:04:45 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-12-13 08:04:45 +0200
commit6b066ec33285c089ce770c2d1eb50bc49787ee92 (patch)
treefcc01b7b13566923c26ecba34e81324e181704a4
parent0745db71798ea7179140f4ffe85d6d69c9ba7da6 (diff)
downloadmariadb-git-6b066ec33285c089ce770c2d1eb50bc49787ee92.tar.gz
MDEV-27235: Crash on SET GLOBAL innodb_encrypt_tables
fil_crypt_set_encrypt_tables(): If no encryption threads have been initialized, do nothing.
-rw-r--r--mysql-test/suite/innodb/r/temporary_table.result1
-rw-r--r--mysql-test/suite/innodb/t/temporary_table.test2
-rw-r--r--storage/innobase/fil/fil0crypt.cc4
3 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/temporary_table.result b/mysql-test/suite/innodb/r/temporary_table.result
index 0307ba88200..9a11b7561af 100644
--- a/mysql-test/suite/innodb/r/temporary_table.result
+++ b/mysql-test/suite/innodb/r/temporary_table.result
@@ -136,6 +136,7 @@ show tables;
Tables_in_test
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
+SET GLOBAL innodb_encrypt_tables=DEFAULT;
# test various bad start-up parameters
FOUND 2 /InnoDB: Unable to create temporary file/ in mysqld.1.err
FOUND 1 /innodb_temporary and innodb_system file names seem to be the same/ in mysqld.1.err
diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test
index d7fe66e2efb..46ac867c1c2 100644
--- a/mysql-test/suite/innodb/t/temporary_table.test
+++ b/mysql-test/suite/innodb/t/temporary_table.test
@@ -121,6 +121,8 @@ show tables;
--error ER_CANT_CREATE_TABLE
create temporary table t1 (keyc int, c1 char(100), c2 char(100)) engine = innodb;
+SET GLOBAL innodb_encrypt_tables=DEFAULT;
+
--echo # test various bad start-up parameters
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 46fc12ee6b0..a8ffa3e2578 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -2470,6 +2470,10 @@ void
fil_crypt_set_encrypt_tables(
uint val)
{
+ if (!fil_crypt_threads_inited) {
+ return;
+ }
+
mutex_enter(&fil_system->mutex);
srv_encrypt_tables = val;