SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
-mysql/innodb_table_stats
-mysql/innodb_index_stats
test/t1
test/t2
-innodb_system
# t1 yes on expecting NOT FOUND
NOT FOUND /foobarsecret/ in t1.ibd
# t2 ... on expecting NOT FOUND
@@ -30,10 +27,16 @@
# Now turn off encryption and wait for threads to decrypt everything
SET GLOBAL innodb_encrypt_tables = off;
# Wait max 10 min for key encryption threads to decrypt all spaces
+Timeout in wait_condition.inc for SELECT COUNT(*) = 5 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND CURRENT_KEY_VERSION = 0;
+Id User Host db Command Time State Info Progress
+1 system user NULL Daemon NULL InnoDB purge coordinator NULL 0.000
+2 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+3 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+4 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+5 system user NULL Daemon NULL InnoDB shutdown handler NULL 0.000
+8 root localhost test Query 0 init show full processlist 0.000
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
This is a basic race condition.
The test assumes, that all existing tablespaces are immediately visible in INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION, and then only the key version changes when the tablespaces get encrypted; but it is not so. It takes time for tablespaces to appear in the I_S table, the simple crude test below shows it (it's for demonstration purposes only, do not put it in the test suite!):
I'll leave it to jplindst to decide whether it's the test that has unreasonable expectations, or something goes wrong with INNODB_TABLESPACES_ENCRYPTION.
Upd:
While it doesn't seem to be happening in buildbot on 10.1, the same race condition technically applies there, so I've added it to Affects/Fix versions.
Elena Stepanova
added a comment - - edited This is a basic race condition.
The test assumes, that all existing tablespaces are immediately visible in INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION , and then only the key version changes when the tablespaces get encrypted; but it is not so. It takes time for tablespaces to appear in the I_S table, the simple crude test below shows it (it's for demonstration purposes only, do not put it in the test suite!):
suite/encryption/t/t1.opt
--innodb-encrypt-tables=ON
--innodb-encrypt-log=ON
--innodb-encryption-rotate-key-age=15
--innodb-encryption-threads=4
--innodb-tablespaces-encryption
--plugin-load-add=file_key_management
--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
suite/encryption/t/t1.test
-- source include/have_innodb.inc
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION ORDER BY NAME ;
--sleep 5
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION ORDER BY NAME ;
If you run it with --repeat=N --force-restart , you get all kinds of results:
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION ORDER BY NAME ;
NAME
innodb_system
mysql/innodb_index_stats
mysql/innodb_table_stats
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION ORDER BY NAME ;
NAME
innodb_system
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION ORDER BY NAME ;
NAME
innodb_system
mysql/innodb_table_stats
etc.
I'll leave it to jplindst to decide whether it's the test that has unreasonable expectations, or something goes wrong with INNODB_TABLESPACES_ENCRYPTION .
Upd:
While it doesn't seem to be happening in buildbot on 10.1, the same race condition technically applies there, so I've added it to Affects/Fix versions.
# Wait max 10 min for key encryption threads to encrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
+innodb_system
test/t3
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
-innodb_system
-mysql/innodb_index_stats
-mysql/innodb_table_stats
-mysql/transaction_registry
test/t1
test/t2
# t1 yes on expecting NOT FOUND
@@ -31,12 +28,17 @@
# Now turn off encryption and wait for threads to decrypt everything
SET GLOBAL innodb_encrypt_tables = off;
# Wait max 10 min for key encryption threads to decrypt all spaces
+Timeout in wait_condition.inc for SELECT COUNT(*) = 6 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND CURRENT_KEY_VERSION = 0;
+Id User Host db Command Time State Info Progress
+2 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+1 system user NULL Daemon NULL InnoDB purge coordinator NULL 0.000
+3 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+4 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+5 system user NULL Daemon NULL InnoDB shutdown handler NULL 0.000
+8 root localhost test Query 0 Init show full processlist 0.000
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
innodb_system
-mysql/innodb_index_stats
-mysql/innodb_table_stats
-mysql/transaction_registry
test/t2
test/t3
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
# Wait max 10 min for key encryption threads to encrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
+innodb_system
test/t3
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
-innodb_system
-mysql/innodb_index_stats
-mysql/innodb_table_stats
-mysql/transaction_registry
test/t1
test/t2
# t1 yes on expecting NOT FOUND
mysqltest: Result length mismatch
Alice Sherepa
added a comment - 10.4 http://buildbot.askmonty.org/buildbot/builders/kvm-rpm-centos6-amd64/builds/18962/steps/mtr/logs/stdio
encryption.encrypt_and_grep 'ctr,innodb' w4 [ fail ]
Test ended at 2020-07-01 12:38:27
CURRENT_TEST: encryption.encrypt_and_grep
--- /usr/share/mysql-test/suite/encryption/r/encrypt_and_grep.result 2020-07-01 10:02:48.000000000 +0300
+++ /dev/shm/var/4/log/encrypt_and_grep.reject 2020-07-01 12:38:27.516151145 +0300
@@ -10,13 +10,10 @@
# Wait max 10 min for key encryption threads to encrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
+innodb_system
test/t3
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
-innodb_system
-mysql/innodb_index_stats
-mysql/innodb_table_stats
-mysql/transaction_registry
test/t1
test/t2
# t1 yes on expecting NOT FOUND
@@ -31,12 +28,17 @@
# Now turn off encryption and wait for threads to decrypt everything
SET GLOBAL innodb_encrypt_tables = off;
# Wait max 10 min for key encryption threads to decrypt all spaces
+Timeout in wait_condition.inc for SELECT COUNT(*) = 6 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND CURRENT_KEY_VERSION = 0;
+Id User Host db Command Time State Info Progress
+2 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+1 system user NULL Daemon NULL InnoDB purge coordinator NULL 0.000
+3 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+4 system user NULL Daemon NULL InnoDB purge worker NULL 0.000
+5 system user NULL Daemon NULL InnoDB shutdown handler NULL 0.000
+8 root localhost test Query 0 Init show full processlist 0.000
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
innodb_system
-mysql/innodb_index_stats
-mysql/innodb_table_stats
-mysql/transaction_registry
test/t2
test/t3
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
mysqltest: Result length mismatch
10.5 http://buildbot.askmonty.org/buildbot/builders/kvm-bintar-trusty-amd64/builds/17864/steps/mtr/logs/stdio
encryption.encrypt_and_grep 'cbc,innodb' w2 [ fail ]
Test ended at 2020-07-06 10:59:40
CURRENT_TEST: encryption.encrypt_and_grep
--- /usr/local/mariadb-10.5.5-linux-x86_64/mysql-test/suite/encryption/r/encrypt_and_grep.result 2020-07-06 10:10:00.000000000 +0000
+++ /usr/local/mariadb-10.5.5-linux-x86_64/mysql-test/suite/encryption/r/encrypt_and_grep.reject 2020-07-06 10:59:40.282586978 +0000
@@ -10,13 +10,10 @@
# Wait max 10 min for key encryption threads to encrypt all spaces
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
NAME
+innodb_system
test/t3
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
NAME
-innodb_system
-mysql/innodb_index_stats
-mysql/innodb_table_stats
-mysql/transaction_registry
test/t1
test/t2
# t1 yes on expecting NOT FOUND
mysqltest: Result length mismatch
This is a basic race condition.
The test assumes, that all existing tablespaces are immediately visible in INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION, and then only the key version changes when the tablespaces get encrypted; but it is not so. It takes time for tablespaces to appear in the I_S table, the simple crude test below shows it (it's for demonstration purposes only, do not put it in the test suite!):
suite/encryption/t/t1.opt
--innodb-encrypt-tables=ON
--innodb-encrypt-log=ON
--innodb-encryption-rotate-key-age=15
--innodb-encryption-threads=4
--innodb-tablespaces-encryption
--plugin-load-add=file_key_management
--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt
suite/encryption/t/t1.test
-- source include/have_innodb.inc
--sleep 5
If you run it with --repeat=N --force-restart, you get all kinds of results:
NAME
innodb_system
mysql/innodb_index_stats
mysql/innodb_table_stats
NAME
innodb_system
NAME
innodb_system
mysql/innodb_table_stats
etc.
I'll leave it to jplindst to decide whether it's the test that has unreasonable expectations, or something goes wrong with INNODB_TABLESPACES_ENCRYPTION.
Upd:
While it doesn't seem to be happening in buildbot on 10.1, the same race condition technically applies there, so I've added it to Affects/Fix versions.