summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/mariabackup/defer_space.test
blob: 397a1ff5dc23cee155f78e9e4bbe1ee1e427d369 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/not_embedded.inc
--source include/no_valgrind_without_big.inc

call mtr.add_suppression("InnoDB: Expected tablespace id .*");
--echo # Mariabackup --backup with page0 INIT_PAGE redo record
--echo # and there is no FILE_CREATE for the tablespace t1
SET @save_dbug = @@SESSION.debug_dbug;
SET DEBUG_DBUG="+d,checkpoint_after_file_create";
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);

echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;

--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
--enable_result_log

echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP  --prepare --target-dir=$targetdir;
-- source include/restart_and_restore.inc
--enable_result_log

SELECT * FROM t1;
DROP TABLE t1;
rmdir $targetdir;
SET @@SESSION.DEBUG_DBUG= @save_debug;

--echo # Mariabackup fails after corrupting the page0 in disk
--echo # and there is no INIT_PAGE for page0

CREATE TABLE t1(c INT) ENGINE=INNODB;
let MYSQLD_DATADIR=`select @@datadir`;
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
--source include/shutdown_mysqld.inc

--echo # Corrupt the table

perl;
my $ps = $ENV{INNODB_PAGE_SIZE};

my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
seek (FILE, 0, SEEK_SET) or die "seek";
print FILE chr(0x00) x $ps;
close FILE or die "close";
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 --target-dir=$targetdir --core-file > $backuplog;
--enable_result_log

--let SEARCH_PATTERN=Header page consists of zero bytes*
--let SEARCH_FILE=$backuplog
--source include/search_pattern_in_file.inc
UNLOCK TABLES;
DROP TABLE t1;
rmdir $targetdir;
remove_file $backuplog;