Skip to content

Commit 5e70470

Browse files
MDEV-33274 The test encryption.innodb-redo-nokeys often fails
If we fail to open a tablespace while looking for FILE_CHECKPOINT, we set the corruption flag. Specifically, if encryption key is missing, we would not be able to open an encrypted tablespace and the flag could be set. We miss checking for this flag and report "Missing FILE_CHECKPOINT" Address review comment to improve the test. Flush pages before starting no-checkpoint block. It should improve the number of cases where the test is skipped because some intermediate checkpoint is triggered.
1 parent 6e406bb commit 5e70470

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

mysql-test/suite/encryption/r/innodb-redo-nokeys.result

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ insert into t2 select * from t1;
1717
insert into t3 select * from t1;
1818
insert into t4 select * from t1;
1919
commit;
20+
21+
# Flush all dirty pages from buffer pool
22+
SET @no_checkpoint_save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
23+
SET @no_checkpoint_save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm;
24+
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
25+
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
26+
SET GLOBAL innodb_max_dirty_pages_pct= @no_checkpoint_save_pct;
27+
SET GLOBAL innodb_max_dirty_pages_pct_lwm= @no_checkpoint_save_pct_lwm;
28+
2029
CREATE TABLE t5 (a VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES;
2130
SET GLOBAL innodb_flush_log_at_trx_commit=1;
2231
begin;

mysql-test/suite/encryption/t/innodb-redo-nokeys.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ insert into t3 select * from t1;
3838
insert into t4 select * from t1;
3939
commit;
4040

41+
let $no_checkpoint_flush= 1;
4142
--source ../../suite/innodb/include/no_checkpoint_start.inc
43+
4244
#
4345
# We test redo log page read at recv_read_page using
4446
# keys that are not in std_data/keys.txt. If checkpoint
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Preparation for using no_checkpoint_end.inc
22

3+
# no_checkpoint_flush: Set to trigger flushing the dirty pages from buffer pool
4+
# and checkpoint before the "no checkpoint" block.
5+
6+
if ($no_checkpoint_flush) {
7+
--echo
8+
--echo # Flush all dirty pages from buffer pool
9+
SET @no_checkpoint_save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
10+
SET @no_checkpoint_save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm;
11+
12+
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
13+
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
14+
15+
let $wait_condition =
16+
SELECT variable_value = 0
17+
FROM information_schema.global_status
18+
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
19+
--source include/wait_condition.inc
20+
21+
SET GLOBAL innodb_max_dirty_pages_pct= @no_checkpoint_save_pct;
22+
SET GLOBAL innodb_max_dirty_pages_pct_lwm= @no_checkpoint_save_pct_lwm;
23+
--echo
24+
}
25+
326
let MYSQLD_DATADIR= `select @@datadir`;
427
--replace_regex /.*Last checkpoint at[ ]*([0-9]+).*/\1/
528
let CHECKPOINT_LSN=`SHOW ENGINE INNODB STATUS`;

storage/innobase/log/log0recv.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3538,6 +3538,15 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
35383538
return(DB_ERROR);
35393539
}
35403540

3541+
/* If we fail to open a tablespace while looking for FILE_CHECKPOINT, we
3542+
set the corruption flag. Specifically, if encryption key is missing, we
3543+
would not be able to open an encrypted tablespace and the flag could be
3544+
set. */
3545+
if (recv_sys.found_corrupt_fs) {
3546+
mysql_mutex_unlock(&log_sys.mutex);
3547+
return DB_ERROR;
3548+
}
3549+
35413550
if (recv_sys.mlog_checkpoint_lsn == 0) {
35423551
lsn_t scan_lsn = log_sys.log.scanned_lsn;
35433552
if (!srv_read_only_mode && scan_lsn != checkpoint_lsn) {

0 commit comments

Comments
 (0)