Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions mysql-test/suite/encryption/r/innodb-encr-threads.result
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,34 @@ insert t1 values (1);
drop table t1;
set global innodb_encryption_threads = 0;
set global innodb_encryption_rotate_key_age = 1;
#
# MDEV-41055 innodb_encryption_threads=0 hangs indefinitely
# when rotation IOPS is zero
#
connect con1,localhost,root,,,,,;
connection default;
SET @old_encrypt_tables= @@GLOBAL.innodb_encrypt_tables;
SET @old_threads= @@GLOBAL.innodb_encryption_threads;
SET @old_iops= @@GLOBAL.innodb_encryption_rotation_iops;
SET GLOBAL innodb_encryption_threads= 0;
SET GLOBAL innodb_encrypt_tables= OFF;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
SET GLOBAL innodb_encryption_rotation_iops= 0;
SET GLOBAL innodb_encryption_threads= 1;
SET GLOBAL innodb_encrypt_tables= ON;
SELECT COUNT(*) AS rotating
FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE ROTATING_OR_FLUSHING <> 0;
rotating
0
connection con1;
SET GLOBAL innodb_encryption_threads= 0;
connection default;
SELECT @@GLOBAL.innodb_encryption_threads;
@@GLOBAL.innodb_encryption_threads
0
disconnect con1;
DROP TABLE t1;
SET GLOBAL innodb_encryption_rotation_iops= @old_iops;
SET GLOBAL innodb_encrypt_tables= @old_encrypt_tables;
SET GLOBAL innodb_encryption_threads= @old_threads;
1 change: 1 addition & 0 deletions mysql-test/suite/encryption/t/innodb-encr-threads.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--innodb_tablespaces_encryption
40 changes: 40 additions & 0 deletions mysql-test/suite/encryption/t/innodb-encr-threads.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,43 @@ drop table t1;
set global innodb_encryption_threads = 0;
set global innodb_encryption_rotate_key_age = 1;

--echo #
--echo # MDEV-41055 innodb_encryption_threads=0 hangs indefinitely
--echo # when rotation IOPS is zero
--echo #
--connect (con1,localhost,root,,,,,)
--connection default

SET @old_encrypt_tables= @@GLOBAL.innodb_encrypt_tables;
SET @old_threads= @@GLOBAL.innodb_encryption_threads;
SET @old_iops= @@GLOBAL.innodb_encryption_rotation_iops;

SET GLOBAL innodb_encryption_threads= 0;
SET GLOBAL innodb_encrypt_tables= OFF;

CREATE TABLE t1 (a INT) ENGINE=InnoDB;

SET GLOBAL innodb_encryption_rotation_iops= 0;
SET GLOBAL innodb_encryption_threads= 1;
SET GLOBAL innodb_encrypt_tables= ON;

let $wait_condition=
SELECT COUNT(*) > 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE ENCRYPTION_SCHEME = 1 AND MIN_KEY_VERSION = 0;
--source include/wait_condition.inc
Comment on lines +35 to +38

SELECT COUNT(*) AS rotating
FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION
WHERE ROTATING_OR_FLUSHING <> 0;

--connection con1
SET GLOBAL innodb_encryption_threads= 0;

--connection default
SELECT @@GLOBAL.innodb_encryption_threads;
--disconnect con1

DROP TABLE t1;
SET GLOBAL innodb_encryption_rotation_iops= @old_iops;
SET GLOBAL innodb_encrypt_tables= @old_encrypt_tables;
SET GLOBAL innodb_encryption_threads= @old_threads;
3 changes: 3 additions & 0 deletions storage/innobase/fil/fil0crypt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2363,6 +2363,9 @@ void fil_crypt_set_thread_cnt(const uint new_cnt)
}

pthread_cond_broadcast(&fil_crypt_threads_cond);
/* Thread waiting on fil_crypt_iops_cond too. They must
be woken as well */
pthread_cond_broadcast(&fil_crypt_iops_cond);

while (srv_n_fil_crypt_threads_started != srv_n_fil_crypt_threads) {
my_cond_wait(&fil_crypt_cond,
Expand Down