Skip to content

Commit 55eb712

Browse files
author
Jan Lindström
committed
MDEV-11218: encryption.innodb_encryption_discard_import failed in buildbot
Try to stabilize test cases. These test behave badly when run in certain order.
1 parent c51c885 commit 55eb712

6 files changed

+82
-128
lines changed

mysql-test/suite/encryption/r/innodb-bad-key-change3.result

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
1+
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
2+
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded.");
3+
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
24
SET GLOBAL innodb_file_format = `Barracuda`;
35
SET GLOBAL innodb_file_per_table = ON;
46
set global innodb_compression_algorithm = 1;
@@ -18,15 +20,12 @@ FLUSH TABLE t1 FOR EXPORT;
1820
t1.cfg
1921
t1.frm
2022
t1.ibd
23+
backup: t1
2124
UNLOCK TABLES;
22-
# Tablespaces should be still encrypted
23-
# t1 yes on expecting NOT FOUND
24-
NOT FOUND /foobar/ in t1.ibd
2525
ALTER TABLE t1 DISCARD TABLESPACE;
26+
restore: t1 .ibd and .cfg files
2627
SET GLOBAL innodb_file_format = `Barracuda`;
2728
SET GLOBAL innodb_file_per_table = ON;
28-
# List after t1 DISCARD
29-
t1.frm
3029
ALTER TABLE t1 IMPORT TABLESPACE;
3130
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
3231
SHOW CREATE TABLE t1;

mysql-test/suite/encryption/r/innodb-discard-import.result

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
1+
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
2+
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
23
SET GLOBAL innodb_file_format = `Barracuda`;
34
SET GLOBAL innodb_file_per_table = ON;
45
SET GLOBAL innodb_compression_algorithm = 1;
@@ -57,31 +58,32 @@ t3.ibd
5758
t4.cfg
5859
t4.frm
5960
t4.ibd
61+
backup: t1
62+
backup: t2
63+
backup: t3
64+
backup: t4
65+
t1.cfg
66+
t1.frm
67+
t1.ibd
68+
t2.cfg
69+
t2.frm
70+
t2.ibd
71+
t3.cfg
72+
t3.frm
73+
t3.ibd
74+
t4.cfg
75+
t4.frm
76+
t4.ibd
6077
UNLOCK TABLES;
61-
# tables should be either encrypted and/or compressed
62-
# t1 yes on expecting NOT FOUND
63-
NOT FOUND /foobar/ in t1.ibd
64-
# t2 yes on expecting NOT FOUND
65-
NOT FOUND /barfoo/ in t2.ibd
66-
# t3 yes on expecting NOT FOUND
67-
NOT FOUND /tmpres/ in t3.ibd
68-
# t4 yes on expecting NOT FOUND
69-
NOT FOUND /mysql/ in t4.ibd
7078
ALTER TABLE t1 DISCARD TABLESPACE;
7179
ALTER TABLE t2 DISCARD TABLESPACE;
7280
ALTER TABLE t3 DISCARD TABLESPACE;
7381
ALTER TABLE t4 DISCARD TABLESPACE;
74-
SET GLOBAL innodb_file_format = `Barracuda`;
75-
SET GLOBAL innodb_file_per_table = ON;
76-
SET GLOBAL innodb_compression_algorithm = 1;
77-
# List after t1 DISCARD
78-
t1.frm
79-
t2.frm
80-
t3.frm
81-
t4.frm
82+
restore: t1 .ibd and .cfg files
83+
restore: t2 .ibd and .cfg files
84+
restore: t3 .ibd and .cfg files
85+
restore: t4 .ibd and .cfg files
8286
ALTER TABLE t1 IMPORT TABLESPACE;
83-
Warnings:
84-
Warning 1814 Tablespace has been discarded for table 't1'
8587
SHOW CREATE TABLE t1;
8688
Table Create Table
8789
t1 CREATE TABLE `t1` (
@@ -92,8 +94,6 @@ SELECT COUNT(*) FROM t1;
9294
COUNT(*)
9395
2000
9496
ALTER TABLE t2 IMPORT TABLESPACE;
95-
Warnings:
96-
Warning 1814 Tablespace has been discarded for table 't2'
9797
SHOW CREATE TABLE t2;
9898
Table Create Table
9999
t2 CREATE TABLE `t2` (
@@ -104,8 +104,6 @@ SELECT COUNT(*) FROM t2;
104104
COUNT(*)
105105
2000
106106
ALTER TABLE t3 IMPORT TABLESPACE;
107-
Warnings:
108-
Warning 1814 Tablespace has been discarded for table 't3'
109107
SHOW CREATE TABLE t3;
110108
Table Create Table
111109
t3 CREATE TABLE `t3` (
@@ -116,8 +114,6 @@ SELECT COUNT(*) FROM t3;
116114
COUNT(*)
117115
2000
118116
ALTER TABLE t4 IMPORT TABLESPACE;
119-
Warnings:
120-
Warning 1814 Tablespace has been discarded for table 't4'
121117
SHOW CREATE TABLE t4;
122118
Table Create Table
123119
t4 CREATE TABLE `t4` (
@@ -127,10 +123,6 @@ t4 CREATE TABLE `t4` (
127123
SELECT COUNT(*) FROM t4;
128124
COUNT(*)
129125
2000
130-
flush data to disk
131-
SET GLOBAL innodb_file_format = `Barracuda`;
132-
SET GLOBAL innodb_file_per_table = ON;
133-
SET GLOBAL innodb_compression_algorithm = 1;
134126
# tables should be still either encrypted and/or compressed
135127
# t1 yes on expecting NOT FOUND
136128
NOT FOUND /foobar/ in t1.ibd

mysql-test/suite/encryption/r/innodb_encryption_discard_import.result

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,6 @@ t3 CREATE TABLE `t3` (
9797
`a` varchar(255) DEFAULT NULL,
9898
PRIMARY KEY (`id`)
9999
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED `encrypted`=yes
100-
# Wait max 10 min for key encryption threads to encrypt all spaces
101-
# Tablespaces should be encrypted after alter table
102-
# t1 yes on expecting NOT FOUND
103-
NOT FOUND /foobar/ in t1.ibd
104-
# t2 ... on expecting NOT FOUND
105-
NOT FOUND /temp/ in t2.ibd
106-
# t3 ... on expecting NOT FOUND
107-
NOT FOUND /barfoo/ in t3.ibd
108100
# Restarting server
109101
# Done restarting server
110102
# Verify that tables are still usable
@@ -124,5 +116,8 @@ NOT FOUND /foobar/ in t1.ibd
124116
NOT FOUND /temp/ in t2.ibd
125117
# t3 ... on expecting NOT FOUND
126118
NOT FOUND /barfoo/ in t3.ibd
119+
# Wait max 10 min for key encryption threads to encrypt all spaces
120+
# Success!
121+
# Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
127122
DROP PROCEDURE innodb_insert_proc;
128123
DROP TABLE t1, t2, t3;

mysql-test/suite/encryption/t/innodb-bad-key-change3.test

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
#
99
# MDEV-8772: Assertion failure in file ha_innodb.cc line 20027 when importing page compressed and encrypted tablespace using incorrect keys
1010
#
11-
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
11+
12+
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
13+
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded.");
14+
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
1215

1316
--disable_query_log
1417
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
@@ -32,28 +35,26 @@ EOF
3235
--enable_reconnect
3336
--source include/wait_until_connected_again.inc
3437

38+
--disable_warnings
3539
SET GLOBAL innodb_file_format = `Barracuda`;
3640
SET GLOBAL innodb_file_per_table = ON;
3741
set global innodb_compression_algorithm = 1;
42+
--enable_warnings
3843

3944
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(255)) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
4045
SHOW WARNINGS;
4146
SHOW CREATE TABLE t1;
4247
INSERT INTO t1 VALUES (1,'foobar'),(2,'barfoo');
48+
let MYSQLD_DATADIR =`SELECT @@datadir`;
4349
FLUSH TABLE t1 FOR EXPORT;
4450
--echo # List before copying files
4551
--list_files $MYSQLD_DATADIR/test
46-
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
47-
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd
52+
perl;
53+
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
54+
ib_backup_tablespaces("test", "t1");
55+
EOF
4856
UNLOCK TABLES;
4957

50-
--sleep 5
51-
--echo # Tablespaces should be still encrypted
52-
--let SEARCH_PATTERN=foobar
53-
--echo # t1 yes on expecting NOT FOUND
54-
-- let SEARCH_FILE=$t1_IBD
55-
-- source include/search_pattern_in_file.inc
56-
5758
ALTER TABLE t1 DISCARD TABLESPACE;
5859

5960
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@@ -65,17 +66,21 @@ ALTER TABLE t1 DISCARD TABLESPACE;
6566
4;770A8A65DA156D24EE2A093277530144
6667
EOF
6768

69+
perl;
70+
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
71+
ib_discard_tablespaces("test", "t1");
72+
ib_restore_tablespaces("test", "t1");
73+
EOF
74+
6875
--exec echo "restart:--innodb-encrypt-tables --innodb-stats-persistent --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQLTEST_VARDIR/keys2.txt" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
6976
--enable_reconnect
7077
--source include/wait_until_connected_again.inc
7178
--source include/restart_mysqld.inc
7279

80+
--disable_warnings
7381
SET GLOBAL innodb_file_format = `Barracuda`;
7482
SET GLOBAL innodb_file_per_table = ON;
75-
--echo # List after t1 DISCARD
76-
--list_files $MYSQLD_DATADIR/test
77-
--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
78-
--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
83+
--enable_warnings
7984

8085
--error ER_GET_ERRMSG
8186
ALTER TABLE t1 IMPORT TABLESPACE;
@@ -105,10 +110,12 @@ EOF
105110
DROP TABLE t1;
106111

107112
# reset system
113+
--disable_warnings
108114
--disable_query_log
109115
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
110116
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
111117
--enable_query_log
118+
--enable_warnings
112119

113120
--remove_file $MYSQLTEST_VARDIR/keys1.txt
114121
--remove_file $MYSQLTEST_VARDIR/keys2.txt

mysql-test/suite/encryption/t/innodb-discard-import.test

Lines changed: 18 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@
1010
# MDEV-8770: Incorrect error message when importing page compressed tablespace
1111
#
1212

13-
call mtr.add_suppression("InnoDB: Table .* tablespace is set as discarded");
13+
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
14+
call mtr.add_suppression("InnoDB: Cannot calculate statistics for table .* because the .ibd file is missing. Please refer to .* for how to resolve the issue.");
1415

1516
--disable_query_log
1617
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
1718
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
1819
let $innodb_compression_algo = `SELECT @@innodb_compression_algorithm`;
1920
--enable_query_log
2021

22+
--disable_warnings
2123
SET GLOBAL innodb_file_format = `Barracuda`;
2224
SET GLOBAL innodb_file_per_table = ON;
2325
SET GLOBAL innodb_compression_algorithm = 1;
26+
--enable_warnings
2427

2528
--let $MYSQLD_TMPDIR = `SELECT @@tmpdir`
2629
--let $MYSQLD_DATADIR = `SELECT @@datadir`
@@ -65,58 +68,28 @@ select count(*) from t2;
6568
select count(*) from t3;
6669
select count(*) from t4;
6770

71+
let MYSQLD_DATADIR =`SELECT @@datadir`;
6872
FLUSH TABLE t1,t2,t3,t4 FOR EXPORT;
6973
--echo # List before copying files
7074
--list_files $MYSQLD_DATADIR/test
71-
--copy_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_TMPDIR/t1.cfg
72-
--copy_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_TMPDIR/t1.ibd
73-
--copy_file $MYSQLD_DATADIR/test/t2.cfg $MYSQLD_TMPDIR/t2.cfg
74-
--copy_file $MYSQLD_DATADIR/test/t2.ibd $MYSQLD_TMPDIR/t2.ibd
75-
--copy_file $MYSQLD_DATADIR/test/t3.cfg $MYSQLD_TMPDIR/t3.cfg
76-
--copy_file $MYSQLD_DATADIR/test/t3.ibd $MYSQLD_TMPDIR/t3.ibd
77-
--copy_file $MYSQLD_DATADIR/test/t4.cfg $MYSQLD_TMPDIR/t4.cfg
78-
--copy_file $MYSQLD_DATADIR/test/t4.ibd $MYSQLD_TMPDIR/t4.ibd
79-
UNLOCK TABLES;
75+
perl;
76+
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
77+
ib_backup_tablespaces("test", "t1","t2","t3","t4");
78+
EOF
79+
--list_files $MYSQLD_DATADIR/test
8080

81-
--echo # tables should be either encrypted and/or compressed
82-
--let SEARCH_PATTERN=foobar
83-
--echo # t1 yes on expecting NOT FOUND
84-
-- let SEARCH_FILE=$t1_IBD
85-
-- source include/search_pattern_in_file.inc
86-
--let SEARCH_PATTERN=barfoo
87-
--echo # t2 yes on expecting NOT FOUND
88-
-- let SEARCH_FILE=$t2_IBD
89-
-- source include/search_pattern_in_file.inc
90-
--let SEARCH_PATTERN=tmpres
91-
--echo # t3 yes on expecting NOT FOUND
92-
-- let SEARCH_FILE=$t3_IBD
93-
-- source include/search_pattern_in_file.inc
94-
--let SEARCH_PATTERN=mysql
95-
--echo # t4 yes on expecting NOT FOUND
96-
-- let SEARCH_FILE=$t4_IBD
97-
-- source include/search_pattern_in_file.inc
81+
UNLOCK TABLES;
9882

9983
ALTER TABLE t1 DISCARD TABLESPACE;
10084
ALTER TABLE t2 DISCARD TABLESPACE;
10185
ALTER TABLE t3 DISCARD TABLESPACE;
10286
ALTER TABLE t4 DISCARD TABLESPACE;
10387

104-
--source include/restart_mysqld.inc
105-
106-
SET GLOBAL innodb_file_format = `Barracuda`;
107-
SET GLOBAL innodb_file_per_table = ON;
108-
SET GLOBAL innodb_compression_algorithm = 1;
109-
110-
--echo # List after t1 DISCARD
111-
--list_files $MYSQLD_DATADIR/test
112-
--copy_file $MYSQLD_TMPDIR/t1.cfg $MYSQLD_DATADIR/test/t1.cfg
113-
--copy_file $MYSQLD_TMPDIR/t1.ibd $MYSQLD_DATADIR/test/t1.ibd
114-
--copy_file $MYSQLD_TMPDIR/t2.cfg $MYSQLD_DATADIR/test/t2.cfg
115-
--copy_file $MYSQLD_TMPDIR/t2.ibd $MYSQLD_DATADIR/test/t2.ibd
116-
--copy_file $MYSQLD_TMPDIR/t3.cfg $MYSQLD_DATADIR/test/t3.cfg
117-
--copy_file $MYSQLD_TMPDIR/t3.ibd $MYSQLD_DATADIR/test/t3.ibd
118-
--copy_file $MYSQLD_TMPDIR/t4.cfg $MYSQLD_DATADIR/test/t4.cfg
119-
--copy_file $MYSQLD_TMPDIR/t4.ibd $MYSQLD_DATADIR/test/t4.ibd
88+
perl;
89+
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
90+
ib_discard_tablespaces("test", "t1","t2","t3","t4");
91+
ib_restore_tablespaces("test", "t1","t2","t3","t4");
92+
EOF
12093

12194
ALTER TABLE t1 IMPORT TABLESPACE;
12295
SHOW CREATE TABLE t1;
@@ -131,13 +104,6 @@ ALTER TABLE t4 IMPORT TABLESPACE;
131104
SHOW CREATE TABLE t4;
132105
SELECT COUNT(*) FROM t4;
133106

134-
--echo flush data to disk
135-
--source include/restart_mysqld.inc
136-
137-
SET GLOBAL innodb_file_format = `Barracuda`;
138-
SET GLOBAL innodb_file_per_table = ON;
139-
SET GLOBAL innodb_compression_algorithm = 1;
140-
141107
--echo # tables should be still either encrypted and/or compressed
142108
--let SEARCH_PATTERN=foobar
143109
--echo # t1 yes on expecting NOT FOUND
@@ -160,8 +126,10 @@ DROP PROCEDURE innodb_insert_proc;
160126
DROP TABLE t1,t2,t3,t4;
161127

162128
# reset system
129+
--disable_warnings
163130
--disable_query_log
164131
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
165132
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
166133
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algo;
167134
--enable_query_log
135+
--enable_warnings

0 commit comments

Comments
 (0)