Skip to content

Commit

Permalink
MDEV-20142 encryption.innodb_encrypt_temporary_tables fails
Browse files Browse the repository at this point in the history
The data type of the column INFORMATION_SCHEMA.GLOBAL_STATUS.VARIABLE_VALUE
is a character string. Therefore, if we want to compare some values as
integers, we must explicitly cast them to integer type, to avoid an
awkward comparison where '10'<'9' because the first digit is smaller.
  • Loading branch information
dr-m committed Dec 10, 2023
1 parent 02d67ce commit 5775df0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
SELECT variable_value into @old_encrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) INTO @old_encrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
SELECT variable_value into @old_decrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) INTO @old_decrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192;
Expand All @@ -12,11 +14,13 @@ COUNT(*)
SELECT COUNT(*) FROM t2;
COUNT(*)
8192
SELECT variable_value > @old_encrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) > @old_encrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';
variable_value > @old_encrypted
CAST(variable_value AS INT) > @old_encrypted
1
SELECT variable_value > @old_decrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) > @old_decrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';
variable_value > @old_decrypted
CAST(variable_value AS INT) > @old_decrypted
1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc

SELECT variable_value into @old_encrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) INTO @old_encrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';

SELECT variable_value into @old_decrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) INTO @old_decrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';

CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB;
Expand All @@ -17,8 +19,10 @@ INSERT INTO t2 (f1,f2,f3) SELECT '', '', '' FROM seq_1_to_8192;
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t2;

SELECT variable_value > @old_encrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) > @old_encrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted';

SELECT variable_value > @old_decrypted FROM information_schema.global_status
SELECT CAST(variable_value AS INT) > @old_decrypted
FROM information_schema.global_status
WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted';

0 comments on commit 5775df0

Please sign in to comment.