1call mtr.add_suppression("InnoDB: Table `test`.`t1` has an unreadable root page");
2SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
3CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes;
4insert into t1(b, c) values("mariadb", "mariabackup");
5--source ../innodb/include/wait_all_purged.inc
6
7let $MYSQLD_DATADIR=`select @@datadir`;
8let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd;
9let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
10
11--source include/shutdown_mysqld.inc
12
13--echo # Corrupt the table
14
15perl;
16use strict;
17use warnings;
18use Fcntl qw(:DEFAULT :seek);
19
20my $ibd_file = $ENV{'t1_IBD'};
21
22my $chunk;
23my $page_size = $ENV{'INNODB_PAGE_SIZE'};
24
25sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file";
26sysseek IBD_FILE, 16384 * 3 + 75, SEEK_CUR;
27$chunk = '\xAA\xAA\xAA\xAA';
28syswrite IBD_FILE, $chunk, 4;
29
30close IBD_FILE;
31EOF
32
33--let $restart_parameters= --skip-innodb-buffer-pool-load-at-startup
34--source include/start_mysqld.inc
35
36echo # xtrabackup backup;
37--disable_result_log
38let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
39let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
40--error 1
41exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --core-file > $backuplog;
42--enable_result_log
43
44--let SEARCH_PATTERN=Database page corruption detected.*
45--let SEARCH_FILE=$backuplog
46--source include/search_pattern_in_file.inc
47remove_file $backuplog;
48
49drop table t1;
50rmdir $targetdir;
51