mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
8c71c6aa8b
InnoDB I/O and buffer pool interfaces and the redo log format have been changed between MariaDB 10.1 and 10.2, and the backup code has to be adjusted accordingly. The code has been simplified, and many memory leaks have been fixed. Instead of the file name xtrabackup_logfile, the file name ib_logfile0 is being used for the copy of the redo log. Unnecessary InnoDB startup and shutdown and some unnecessary threads have been removed. Some help was provided by Vladislav Vaintroub. Parameters have been cleaned up and aligned with those of MariaDB 10.2. The --dbug option has been added, so that in debug builds, --dbug=d,ib_log can be specified to enable diagnostic messages for processing redo log entries. By default, innodb_doublewrite=OFF, so that --prepare works faster. If more crash-safety for --prepare is needed, double buffering can be enabled. The parameter innodb_log_checksums=OFF can be used to ignore redo log checksums in --backup. Some messages have been cleaned up. Unless --export is specified, Mariabackup will not deal with undo log. The InnoDB mini-transaction redo log is not only about user-level transactions; it is actually about mini-transactions. To avoid confusion, call it the redo log, not transaction log. We disable any undo log processing in --prepare. Because MariaDB 10.2 supports indexed virtual columns, the undo log processing would need to be able to evaluate virtual column expressions. To reduce the amount of code dependencies, we will not process any undo log in prepare. This means that the --export option must be disabled for now. This also means that the following options are redundant and have been removed: xtrabackup --apply-log-only innobackupex --redo-only In addition to disabling any undo log processing, we will disable any further changes to data pages during --prepare, including the change buffer merge. This means that restoring incremental backups should reliably work even when change buffering is being used on the server. Because of this, preparing a backup will not generate any further redo log, and the redo log file can be safely deleted. (If the --export option is enabled in the future, it must generate redo log when processing undo logs and buffered changes.) In --prepare, we cannot easily know if a partial backup was used, especially when restoring a series of incremental backups. So, we simply warn about any missing files, and ignore the redo log for them. FIXME: Enable the --export option. FIXME: Improve the handling of the MLOG_INDEX_LOAD record, and write a test that initiates a backup while an ALGORITHM=INPLACE operation is creating indexes or rebuilding a table. An error should be detected when preparing the backup. FIXME: In --incremental --prepare, xtrabackup_apply_delta() should ensure that if FSP_SIZE is modified, the file size will be adjusted accordingly.
87 lines
2.5 KiB
Text
87 lines
2.5 KiB
Text
#--source include/innodb_page_size.inc
|
|
--source include/have_partition.inc
|
|
|
|
CREATE TABLE t1(a INT) ENGINE=InnoDB;
|
|
INSERT INTO t1 VALUES (1), (2), (3);
|
|
|
|
CREATE TABLE t2(a INT) ENGINE=InnoDB;
|
|
INSERT INTO t2 VALUES (4), (5), (6);
|
|
|
|
CREATE TABLE p (
|
|
a int
|
|
) ENGINE=InnoDB
|
|
PARTITION BY RANGE (a)
|
|
(PARTITION p0 VALUES LESS THAN (100),
|
|
PARTITION p1 VALUES LESS THAN (200),
|
|
PARTITION p2 VALUES LESS THAN (300),
|
|
PARTITION p3 VALUES LESS THAN (400));
|
|
|
|
INSERT INTO p VALUES (1), (101), (201), (301);
|
|
|
|
CREATE TABLE isam_t1(a INT) ENGINE=MyISAM;
|
|
INSERT INTO isam_t1 VALUES (1), (2), (3);
|
|
|
|
CREATE TABLE isam_t2(a INT) ENGINE=MyISAM;
|
|
INSERT INTO isam_t2 VALUES (4), (5), (6);
|
|
|
|
CREATE TABLE isam_p (
|
|
a int
|
|
) ENGINE=MyISAM
|
|
PARTITION BY RANGE (a)
|
|
(PARTITION p0 VALUES LESS THAN (100),
|
|
PARTITION p1 VALUES LESS THAN (200),
|
|
PARTITION p2 VALUES LESS THAN (300),
|
|
PARTITION p3 VALUES LESS THAN (400));
|
|
|
|
INSERT INTO isam_p VALUES (1), (101), (201), (301);
|
|
|
|
let $targetdir=$MYSQLTEST_VARDIR/tmp;
|
|
|
|
--disable_result_log
|
|
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --no-timestamp --backup --target-dir=$targetdir/full;
|
|
--enable_result_log
|
|
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
CREATE TABLE t2(a INT) ENGINE=InnoDB;
|
|
INSERT INTO t2 VALUES (40), (50), (60);
|
|
|
|
ALTER TABLE p DROP PARTITION p0;
|
|
ALTER TABLE p DROP PARTITION p1;
|
|
ALTER TABLE p ADD PARTITION (PARTITION p4 VALUES LESS THAN (500));
|
|
ALTER TABLE p ADD PARTITION (PARTITION p5 VALUES LESS THAN (600));
|
|
|
|
INSERT INTO p VALUES (401), (501);
|
|
|
|
|
|
DROP TABLE isam_t1;
|
|
DROP TABLE isam_t2;
|
|
CREATE TABLE isam_t2(a INT) ENGINE=MyISAM;
|
|
|
|
INSERT INTO isam_t2 VALUES (40), (50), (60);
|
|
|
|
ALTER TABLE isam_p DROP PARTITION p0;
|
|
ALTER TABLE isam_p DROP PARTITION p1;
|
|
ALTER TABLE isam_p ADD PARTITION (PARTITION p4 VALUES LESS THAN (500));
|
|
ALTER TABLE isam_p ADD PARTITION (PARTITION p5 VALUES LESS THAN (600));
|
|
|
|
INSERT INTO isam_p VALUES (401), (501);
|
|
|
|
--disable_result_log
|
|
exec $INNOBACKUPEX --defaults-file=$MYSQLTEST_VARDIR/my.cnf --incremental --no-timestamp --incremental-basedir=$targetdir/full $targetdir/inc;
|
|
exec $INNOBACKUPEX --defaults-file=$MYSQLTEST_VARDIR/my.cnf --apply-log $targetdir/full;
|
|
exec $INNOBACKUPEX --defaults-file=$MYSQLTEST_VARDIR/my.cnf --apply-log --incremental-dir=$targetdir/inc $targetdir/full;
|
|
|
|
let $targetdir=$targetdir/full;
|
|
-- source include/restart_and_restore.inc
|
|
--enable_result_log
|
|
|
|
SELECT * from p;
|
|
SELECT * from isam_p;
|
|
|
|
DROP TABLE isam_p;
|
|
DROP TABLE isam_t2;
|
|
DROP TABLE p;
|
|
DROP TABLE t2;
|
|
rmdir $MYSQLTEST_VARDIR/tmp/full;
|
|
rmdir $MYSQLTEST_VARDIR/tmp/inc;
|