Skip to content

Commit 970ce27

Browse files
committed
Merge 10.1 into 10.2
Disable the test encryption.innodb_encryption-page-compression because the wait_condition would seem to time out deterministically. MDEV-14814 has to be addressed in 10.2 separately. Datafile::validate_first_page(): Do not invoke page_size_t::page_size_t(flags) before validating the tablespace flags. This avoids a crash in MDEV-15333 innodb.restart test case. FIXME: Reduce the number of error messages. The first one is enough.
2 parents 8bf2c08 + 9a46d97 commit 970ce27

File tree

11 files changed

+183
-98
lines changed

11 files changed

+183
-98
lines changed

mysql-test/suite/encryption/disabled.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
innodb_scrub : MDEV-8139 scrubbing does not work reliably
1414
innodb_scrub_background : MDEV-8139 scrubbing does not work reliably
1515
innodb-redo-badkey : MDEV-13893 / MDEV-12699 Improve crash recovery of corrupted data pages
16+
innodb_encryption-page-compression : MDEV-14814 wait condition timeout

mysql-test/suite/encryption/r/innodb_encryption-page-compression.result

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,9 @@ count(*)
137137
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
138138
variable_value > 0
139139
1
140-
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
141-
variable_value >= 0
142-
1
143140
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
144141
variable_value > 0
145142
1
146-
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
147-
variable_value >= 0
148-
1
149143
SET GLOBAL innodb_encryption_threads = 4;
150144
SET GLOBAL innodb_encrypt_tables = off;
151145
update innodb_page_compressed1 set c1 = c1 + 1;
@@ -157,17 +151,17 @@ update innodb_page_compressed6 set c1 = c1 + 1;
157151
update innodb_page_compressed7 set c1 = c1 + 1;
158152
update innodb_page_compressed8 set c1 = c1 + 1;
159153
update innodb_page_compressed9 set c1 = c1 + 1;
160-
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
161-
variable_value >= 0
154+
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
155+
variable_value > 0
162156
1
163157
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
164158
variable_value > 0
165159
1
166160
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
167161
variable_value > 0
168162
1
169-
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
170-
variable_value >= 0
163+
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
164+
variable_value > 0
171165
1
172166
drop procedure innodb_insert_proc;
173167
drop table innodb_normal;

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
call mtr.add_suppression("trying to do an operation on a dropped tablespace .*");
21
SET GLOBAL innodb_encrypt_tables = OFF;
32
SET GLOBAL innodb_encryption_threads = 4;
43
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
@@ -12,24 +11,21 @@ t1 CREATE TABLE `t1` (
1211
CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
1312
CREATE TABLE t3 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO;
1413
CREATE TABLE t4 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
15-
INSERT INTO t2 select * from t1;
16-
INSERT INTO t3 select * from t1;
17-
INSERT INTO t4 select * from t1;
1814
SET GLOBAL innodb_encrypt_tables = on;
1915
# Wait max 10 min for key encryption threads to encrypt required all spaces
2016
# Success!
2117
SELECT COUNT(1) FROM t1;
2218
COUNT(1)
23-
400
19+
10
2420
SELECT COUNT(1) FROM t2;
2521
COUNT(1)
26-
400
22+
10
2723
SELECT COUNT(1) FROM t3;
2824
COUNT(1)
29-
400
25+
10
3026
SELECT COUNT(1) FROM t4;
3127
COUNT(1)
32-
400
28+
10
3329
SET GLOBAL innodb_encrypt_tables = off;
3430
# Wait max 10 min for key encryption threads to decrypt all required spaces
3531
# Success!
@@ -48,18 +44,17 @@ INSERT INTO t5 select * from t1;
4844
# Success!
4945
SELECT COUNT(1) FROM t1;
5046
COUNT(1)
51-
400
47+
10
5248
SELECT COUNT(1) FROM t2;
5349
COUNT(1)
54-
400
50+
10
5551
SELECT COUNT(1) FROM t3;
5652
COUNT(1)
57-
400
53+
10
5854
SELECT COUNT(1) FROM t4;
5955
COUNT(1)
60-
400
56+
10
6157
SELECT COUNT(1) FROM t5;
6258
COUNT(1)
63-
400
59+
10
6460
drop table t1,t2,t3,t4, t5;
65-
set GLOBAL innodb_default_encryption_key_id=1;

mysql-test/suite/encryption/t/innodb_encryption-page-compression.test

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
-- source include/have_innodb.inc
22
-- source include/have_example_key_management_plugin.inc
3-
4-
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
5-
let $innodb_encrypt_tables_orig = `SELECT @@innodb_encrypt_tables`;
6-
let $innodb_encryption_threads_orig = `SELECT @@innodb_encryption_threads`;
3+
-- source include/not_embedded.inc
74

85
SET GLOBAL innodb_encryption_threads = 4;
96
SET GLOBAL innodb_encrypt_tables = on;
@@ -78,11 +75,13 @@ select count(*) from innodb_page_compressed9 where c1 < 500000;
7875

7976
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
8077
--source include/wait_condition.inc
78+
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
79+
--source include/wait_condition.inc
8180

8281
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
83-
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
8482
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
85-
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
83+
84+
--source include/restart_mysqld.inc
8685

8786
SET GLOBAL innodb_encryption_threads = 4;
8887
SET GLOBAL innodb_encrypt_tables = off;
@@ -97,13 +96,15 @@ update innodb_page_compressed7 set c1 = c1 + 1;
9796
update innodb_page_compressed8 set c1 = c1 + 1;
9897
update innodb_page_compressed9 set c1 = c1 + 1;
9998

100-
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_DECRYPTED';
99+
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_ENCRYPTED';
100+
--source include/wait_condition.inc
101+
let $wait_condition= select variable_value > 0 from information_schema.global_status where variable_name = 'INNODB_NUM_PAGES_PAGE_COMPRESSED';
101102
--source include/wait_condition.inc
102103

103-
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
104+
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_encrypted';
104105
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_decrypted';
105106
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_compressed';
106-
SELECT variable_value >= 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
107+
SELECT variable_value > 0 FROM information_schema.global_status WHERE variable_name = 'innodb_num_pages_page_decompressed';
107108

108109
drop procedure innodb_insert_proc;
109110
drop table innodb_normal;
@@ -116,10 +117,3 @@ drop table innodb_page_compressed6;
116117
drop table innodb_page_compressed7;
117118
drop table innodb_page_compressed8;
118119
drop table innodb_page_compressed9;
119-
120-
# reset system
121-
--disable_query_log
122-
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
123-
EVAL SET GLOBAL innodb_encrypt_tables = $innodb_encrypt_tables_orig;
124-
EVAL SET GLOBAL innodb_encryption_threads = $innodb_encryption_threads_orig;
125-
--enable_query_log

mysql-test/suite/encryption/t/innodb_encryption_filekeys.test

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
-- source include/have_innodb.inc
22
-- source include/have_file_key_management_plugin.inc
3-
# embedded does not support restart
4-
-- source include/not_embedded.inc
5-
6-
call mtr.add_suppression("trying to do an operation on a dropped tablespace .*");
73

4+
--disable_query_log
85
let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
96
let $threads = `SELECT @@innodb_encryption_threads`;
7+
let $key_id = `SELECT @@innodb_default_encryption_key_id`;
8+
--enable_query_log
109

1110
SET GLOBAL innodb_encrypt_tables = OFF;
1211
SET GLOBAL innodb_encryption_threads = 4;
@@ -19,21 +18,20 @@ CREATE TABLE t4 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNOD
1918

2019
--disable_warnings
2120
--disable_query_log
22-
set autocommit=0;
23-
let $i = 400;
21+
begin;
22+
let $i = 10;
2423
while ($i)
2524
{
2625
INSERT INTO t1 values(NULL, substring(MD5(RAND()), -128));
2726
dec $i;
2827
}
29-
commit;
30-
set autocommit=1;
31-
--enable_warnings
32-
--enable_query_log
3328

3429
INSERT INTO t2 select * from t1;
3530
INSERT INTO t3 select * from t1;
3631
INSERT INTO t4 select * from t1;
32+
commit;
33+
--enable_warnings
34+
--enable_query_log
3735

3836
SET GLOBAL innodb_encrypt_tables = on;
3937

@@ -54,7 +52,7 @@ while ($cnt)
5452
}
5553
if (!$success)
5654
{
57-
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
55+
SELECT NAME,ENCRYPTION_SHCEME,MIN_KEY_VERSION, ROTATING_OR_FLUSHING FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
5856
SHOW STATUS LIKE 'innodb_encryption%';
5957
-- die Timeout waiting for encryption threads
6058
}
@@ -84,7 +82,7 @@ while ($cnt)
8482
}
8583
if (!$success)
8684
{
87-
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
85+
SELECT NAME,ENCRYPTION_SHCEME,MIN_KEY_VERSION, ROTATING_OR_FLUSHING FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
8886
SHOW STATUS LIKE 'innodb_encryption%';
8987
-- die Timeout waiting for encryption threads
9088
}
@@ -113,7 +111,7 @@ while ($cnt)
113111
}
114112
if (!$success)
115113
{
116-
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
114+
SELECT NAME,ENCRYPTION_SHCEME,MIN_KEY_VERSION, ROTATING_OR_FLUSHING FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
117115
SHOW STATUS LIKE 'innodb_encryption%';
118116
-- die Timeout waiting for encryption threads
119117
}
@@ -125,12 +123,11 @@ SELECT COUNT(1) FROM t3;
125123
SELECT COUNT(1) FROM t4;
126124
SELECT COUNT(1) FROM t5;
127125

126+
drop table t1,t2,t3,t4, t5;
127+
128128
# reset system
129129
--disable_query_log
130130
EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables;
131131
EVAL SET GLOBAL innodb_encryption_threads = $threads;
132+
EVAL set GLOBAL innodb_default_encryption_key_id = $key_id;
132133
--enable_query_log
133-
134-
drop table t1,t2,t3,t4, t5;
135-
136-
set GLOBAL innodb_default_encryption_key_id=1;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#
2+
# MDEV-15333 MariaDB (still) slow start
3+
#
4+
# FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files
5+
# of tables with .isl file or DATA DIRECTORY attribute.
6+
call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in .*td\\.ibd");
7+
# FIXME: This is much more noisy than MariaDB 10.1!
8+
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot read first page in datafile: .*td\\.ibd, Space ID:2048948345, Flags: 2048948345");
9+
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\.");
10+
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\.");
11+
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\.");
12+
call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace for `test`\\.`td` because it could not be opened\\.");
13+
CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
14+
CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT
15+
PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
16+
CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
17+
STATS_PERSISTENT=0 DATA DIRECTORY='MYSQL_TMP_DIR';
18+
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
19+
WHERE engine = 'innodb'
20+
AND support IN ('YES', 'DEFAULT', 'ENABLED');
21+
COUNT(*)
22+
1
23+
SELECT * FROM tr;
24+
a
25+
SELECT * FROM tc;
26+
a
27+
SELECT * FROM td;
28+
a
29+
DROP TABLE tr,tc,td;
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
--source include/innodb_page_size.inc
2+
--source include/not_embedded.inc
3+
4+
let datadir= `select @@datadir`;
5+
let page_size= `select @@innodb_page_size`;
6+
7+
--echo #
8+
--echo # MDEV-15333 MariaDB (still) slow start
9+
--echo #
10+
11+
# Ensure that on normal startup, no data files are read.
12+
# Note: just like in MySQL, all .ibd files will still be
13+
# opened at least once.
14+
15+
--echo # FIXME: Unlike MySQL, maybe MariaDB should not read the .ibd files
16+
--echo # of tables with .isl file or DATA DIRECTORY attribute.
17+
call mtr.add_suppression("\\[ERROR\\] InnoDB: Invalid flags 0x7a207879 in .*td\\.ibd");
18+
--echo # FIXME: This is much more noisy than MariaDB 10.1!
19+
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot read first page in datafile: .*td\\.ibd, Space ID:2048948345, Flags: 2048948345");
20+
call mtr.add_suppression("\\[ERROR\\] InnoDB: Operating system error number .* in a file operation\\.");
21+
call mtr.add_suppression("\\[ERROR\\] InnoDB: The error means the system cannot find the path specified\\.");
22+
call mtr.add_suppression("\\[ERROR\\] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them\\.");
23+
call mtr.add_suppression("\\[Warning\\] InnoDB: Ignoring tablespace for `test`\\.`td` because it could not be opened\\.");
24+
25+
CREATE TABLE tr(a INT)ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
26+
CREATE TABLE tc(a INT)ENGINE=InnoDB ROW_FORMAT=COMPACT
27+
PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
28+
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
29+
eval CREATE TABLE td(a INT)ENGINE=InnoDB ROW_FORMAT=DYNAMIC
30+
STATS_PERSISTENT=0 DATA DIRECTORY='$MYSQL_TMP_DIR';
31+
32+
--source include/shutdown_mysqld.inc
33+
34+
--move_file $datadir/test/tr.ibd $datadir/test/tr0.ibd
35+
--move_file $datadir/test/tc.ibd $datadir/test/tc0.ibd
36+
--move_file $MYSQL_TMP_DIR/test/td.ibd $datadir/test/td0.ibd
37+
# TODO: test that MariaDB does not even attempt to open the files
38+
#--mkdir $datadir/test/tr.ibd
39+
#--mkdir $datadir/test/tc.ibd
40+
#--mkdir $MYSQL_TMP_DIR/test/td.ibd
41+
42+
perl;
43+
die unless open OUT, ">", "$ENV{datadir}/test/tr.ibd";
44+
print OUT "foo " x $ENV{page_size};
45+
close OUT or die;
46+
die unless open OUT, ">", "$ENV{datadir}/test/tc.ibd";
47+
print OUT "bar " x $ENV{page_size};
48+
close OUT or die;
49+
die unless open OUT, ">", "$ENV{MYSQL_TMP_DIR}/test/td.ibd";
50+
print OUT "xyz " x $ENV{page_size};
51+
close OUT or die;
52+
EOF
53+
54+
--let $restart_parameters= --skip-innodb-buffer-pool-load-at-startup
55+
--source include/start_mysqld.inc
56+
--let $restart_parameters=
57+
58+
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
59+
WHERE engine = 'innodb'
60+
AND support IN ('YES', 'DEFAULT', 'ENABLED');
61+
62+
--source include/shutdown_mysqld.inc
63+
64+
# TODO: test that MariaDB does not even attempt to open the files
65+
#--rmdir $datadir/test/tr.ibd
66+
#--rmdir $datadir/test/tc.ibd
67+
#--rmdir $MYSQL_TMP_DIR/test/td.ibd
68+
--remove_file $datadir/test/tr.ibd
69+
--remove_file $datadir/test/tc.ibd
70+
--remove_file $MYSQL_TMP_DIR/test/td.ibd
71+
72+
--move_file $datadir/test/tr0.ibd $datadir/test/tr.ibd
73+
--move_file $datadir/test/tc0.ibd $datadir/test/tc.ibd
74+
--move_file $datadir/test/td0.ibd $MYSQL_TMP_DIR/test/td.ibd
75+
76+
--source include/start_mysqld.inc
77+
SELECT * FROM tr;
78+
SELECT * FROM tc;
79+
SELECT * FROM td;
80+
DROP TABLE tr,tc,td;

storage/innobase/fil/fil0fil.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4215,7 +4215,8 @@ fil_ibd_open(
42154215
err = DB_ERROR;
42164216
}
42174217

4218-
if (purpose != FIL_TYPE_IMPORT && !srv_read_only_mode) {
4218+
if (err == DB_SUCCESS && validate
4219+
&& purpose != FIL_TYPE_IMPORT && !srv_read_only_mode) {
42194220
df_remote.close();
42204221
df_dict.close();
42214222
df_default.close();

0 commit comments

Comments
 (0)