--source include/have_file_key_management.inc --source include/innodb_page_size.inc call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted."); CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes; insert into t1 select repeat('a',100); let MYSQLD_DATADIR=`select @@datadir`; let INNODB_PAGE_SIZE=`select @@innodb_page_size`; --source include/shutdown_mysqld.inc --echo # Corrupt the table perl; use strict; use warnings; use Fcntl qw(:DEFAULT :seek); do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; my $page_size = $ENV{INNODB_PAGE_SIZE}; sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/test/t1.ibd", O_RDWR || die "Cannot open t1.ibd\n"; sysread(IBD_FILE, $_, 38) || die "Cannot read t1.ibd\n"; my $space = unpack("x[34]N", $_); sysseek(IBD_FILE, $page_size * 3, SEEK_SET) || die "Cannot seek t1.ibd\n"; my $head = pack("Nx[18]", 3); # better to have a valid page number my $body = chr(0) x ($page_size - 38 - 8); # Calculate innodb_checksum_algorithm=crc32 for the unencrypted page. # The following bytes are excluded: # bytes 0..3 (the checksum is stored there) # bytes 26..37 (encryption key version, post-encryption checksum, tablespace id) # bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN) my $polynomial = 0x82f63b78; # CRC-32C my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck); die unless syswrite(IBD_FILE, $page, $page_size) == $page_size; close IBD_FILE; EOF --source include/start_mysqld.inc echo # xtrabackup backup; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; --disable_result_log --error 1 exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir > $backuplog; --enable_result_log --let SEARCH_PATTERN=Database page corruption detected.* --let SEARCH_FILE=$backuplog --source include/search_pattern_in_file.inc remove_file $backuplog; rmdir $targetdir; # Due to very constructed nature of the "corruption" (faking checksums), the "corruption" won't be found without --extended-validation --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; --enable_result_log drop table t1; rmdir $targetdir;