summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/mariabackup/defer_space.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/mariabackup/defer_space.test')
-rw-r--r--mysql-test/suite/mariabackup/defer_space.test68
1 files changed, 68 insertions, 0 deletions
diff --git a/mysql-test/suite/mariabackup/defer_space.test b/mysql-test/suite/mariabackup/defer_space.test
new file mode 100644
index 00000000..397a1ff5
--- /dev/null
+++ b/mysql-test/suite/mariabackup/defer_space.test
@@ -0,0 +1,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;