mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
00f0c039d2
When Mariabackup gets a bad read of the first page of the system tablespace file, it would inappropriately try to apply the doublewrite buffer and write changes back to the data file (to the source file)! This is very wrong and must be prevented. The correct action would be to retry reading the system tablespace as well as any other files whose first page was read incorrectly. Fixing this was not attempted. xb_load_tablespaces(): Shorten a bogus message to be more relevant. The message can be displayed by --backup or --prepare. xtrabackup_backup_func(), os_file_write_func(): Add a missing space to a message. Datafile::restore_from_doublewrite(): Do not even attempt the operation in Mariabackup. recv_init_crash_recovery_spaces(): Do not attempt to restore the doublewrite buffer in Mariabackup (--prepare or --export), because all pages should have been copied correctly in --backup already, and because --backup should ignore the doublewrite buffer. SysTablespace::read_lsn_and_check_flags(): Do not attempt to initialize the doublewrite buffer in Mariabackup. innodb_make_page_dirty(): Correct the bounds check. Datafile::read_first_page(): Correct the name of the parameter.
52 lines
1.6 KiB
Text
52 lines
1.6 KiB
Text
--source include/not_embedded.inc
|
|
--source include/have_file_key_management.inc
|
|
|
|
--echo #
|
|
--echo # MDEV-13416 mariabackup fails with EFAULT "Bad Address"
|
|
--echo #
|
|
|
|
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
|
|
let MYSQLD_DATADIR=`select @@datadir`;
|
|
|
|
--source include/shutdown_mysqld.inc
|
|
|
|
perl;
|
|
my $file= "$ENV{MYSQLD_DATADIR}/ibdata1";
|
|
open(FILE, "+<", $file) or die "Unable to open $file\n";
|
|
binmode FILE;
|
|
my $ps= $ENV{INNODB_PAGE_SIZE};
|
|
my $page;
|
|
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
|
|
substr($page,26,8) = pack("NN", 4096, ~1024);
|
|
substr($page,0,4)=pack("N",0xdeadbeef);
|
|
substr($page,$ps-8,4)=pack("N",0xdeadbeef);
|
|
sysseek(FILE, 0, 0) || die "Unable to rewind $file\n";
|
|
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
|
|
close(FILE) || die "Unable to close $file\n";
|
|
EOF
|
|
|
|
--remove_files_wildcard $MYSQLD_DATADIR ib_logfile*
|
|
|
|
--source include/start_mysqld.inc
|
|
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
|
--let SEARCH_PATTERN= InnoDB: New log files created, LSN=175964\d{8}
|
|
--source include/search_pattern_in_file.inc
|
|
|
|
CREATE TABLE t(i INT) ENGINE INNODB;
|
|
INSERT INTO t 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
|
|
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
|
INSERT INTO t VALUES(2);
|
|
echo # xtrabackup prepare;
|
|
--disable_result_log
|
|
exec $XTRABACKUP --prepare --target-dir=$targetdir;
|
|
--source include/restart_and_restore.inc
|
|
--enable_result_log
|
|
SELECT * FROM t;
|
|
DROP TABLE t;
|
|
rmdir $targetdir;
|