Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_pat…
…h is used - `mariadb-backup --backup` was fixed to fetch the value of the @@aria_log_dir_path server variable and copy aria_log* files from @@aria_log_dir_path directory to the backup directory. Absolute and relative (to --datadir) paths are supported. Before this change aria_log* files were copied to the backup only if they were in the default location in @@datadir. - `mariadb-backup --copy-back` now understands a new my.cnf and command line parameter --aria-log-dir-path. `mariadb-backup --copy-back` in the main loop in copy_back() (when copying back from the backup directory to --datadir) was fixed to ignore all aria_log* files. A new function copy_back_aria_logs() was added. It consists of a separate loop copying back aria_log* files from the backup directory to the directory specified in --aria-log-dir-path. Absolute and relative (to --datadir) paths are supported. If --aria-log-dir-path is not specified, aria_log* files are copied to --datadir by default. - The function is_absolute_path() was fixed to understand MTR style paths on Windows with forward slashes, e.g. --aria-log-dir-path=D:/Buildbot/amd64-windows/build/mysql-test/var/...
- Loading branch information
Showing
9 changed files
with
281 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used | ||
# | ||
# Restart mariadbd with the test specific parameters | ||
# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path | ||
# Create and populate an Aria table (and Aria logs) | ||
CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria; | ||
BEGIN NOT ATOMIC | ||
FOR id IN 0..9 DO | ||
INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024)); | ||
END FOR; | ||
END; | ||
$$ | ||
# Testing aria log files before --backup | ||
SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; | ||
SHOW ENGINE aria logs; | ||
Type Name Status | ||
Aria aria_log.00000001 free | ||
Aria aria_log.00000002 in use | ||
# mariadb-backup --backup | ||
# mariadb-backup --prepare | ||
# shutdown server | ||
# remove datadir | ||
# remove aria-log-dir-path | ||
# mariadb-backup --copy-back | ||
# with parameters: --defaults-file=MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=MYSQLTEST_VARDIR/mysqld.1/data/ --target-dir=MYSQLTEST_VARDIR/tmp/backup --parallel=2 --throttle=1 --aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path | ||
# starting server | ||
# restart: --aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path | ||
# Check that the table is there after --copy-back | ||
SELECT COUNT(*) from t1; | ||
COUNT(*) | ||
10 | ||
DROP TABLE t1; | ||
# Testing aria log files after --copy-back | ||
SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; | ||
SHOW ENGINE aria logs; | ||
Type Name Status | ||
Aria aria_log.00000001 free | ||
Aria aria_log.00000002 in use | ||
# Restarting mariadbd with default parameters | ||
# restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
--source include/have_maria.inc | ||
|
||
--echo # | ||
--echo # MDEV-30968 mariadb-backup does not copy Aria logs if aria_log_dir_path is used | ||
--echo # | ||
|
||
--let $datadir=`SELECT @@datadir` | ||
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup | ||
|
||
if ($ARIA_LOGDIR_MARIADB == '') | ||
{ | ||
--let $ARIA_LOGDIR_MARIADB=$MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path | ||
} | ||
|
||
if ($ARIA_LOGDIR_FS == '') | ||
{ | ||
--let $ARIA_LOGDIR_FS=$MYSQLTEST_VARDIR/tmp/backup_aria_log_dir_path | ||
} | ||
|
||
--let $server_parameters=--aria-log-file-size=8388608 --aria-log-purge-type=external --loose-aria-log-dir-path=$ARIA_LOGDIR_MARIADB | ||
|
||
|
||
--echo # Restart mariadbd with the test specific parameters | ||
--mkdir $ARIA_LOGDIR_FS | ||
--let $restart_parameters=$server_parameters | ||
--source include/restart_mysqld.inc | ||
|
||
|
||
--echo # Create and populate an Aria table (and Aria logs) | ||
CREATE TABLE t1 (id INT, txt LONGTEXT) ENGINE=Aria; | ||
DELIMITER $$; | ||
BEGIN NOT ATOMIC | ||
FOR id IN 0..9 DO | ||
INSERT INTO test.t1 (id, txt) VALUES (id, REPEAT(id,1024*1024)); | ||
END FOR; | ||
END; | ||
$$ | ||
DELIMITER ;$$ | ||
|
||
|
||
--echo # Testing aria log files before --backup | ||
SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; | ||
--file_exists $ARIA_LOGDIR_FS/aria_log_control | ||
--file_exists $ARIA_LOGDIR_FS/aria_log.00000001 | ||
--file_exists $ARIA_LOGDIR_FS/aria_log.00000002 | ||
--error 1 | ||
--file_exists $ARIA_LOGDIR_FS/aria_log.00000003 | ||
--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/ | ||
SHOW ENGINE aria logs; | ||
|
||
|
||
--echo # mariadb-backup --backup | ||
--disable_result_log | ||
--mkdir $targetdir | ||
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir | ||
--enable_result_log | ||
|
||
|
||
--echo # mariadb-backup --prepare | ||
--disable_result_log | ||
--exec $XTRABACKUP --prepare --target-dir=$targetdir | ||
--enable_result_log | ||
|
||
|
||
--echo # shutdown server | ||
--disable_result_log | ||
--source include/shutdown_mysqld.inc | ||
--echo # remove datadir | ||
--rmdir $datadir | ||
--echo # remove aria-log-dir-path | ||
--rmdir $ARIA_LOGDIR_FS | ||
|
||
--echo # mariadb-backup --copy-back | ||
--let $mariadb_backup_parameters=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$datadir --target-dir=$targetdir --parallel=2 --throttle=1 --aria-log-dir-path=$ARIA_LOGDIR_MARIADB | ||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
--exec echo "# with parameters: $mariadb_backup_parameters" | ||
--exec $XTRABACKUP $mariadb_backup_parameters | ||
|
||
--echo # starting server | ||
--let $restart_parameters=$server_parameters | ||
--source include/start_mysqld.inc | ||
--enable_result_log | ||
--rmdir $targetdir | ||
|
||
|
||
--echo # Check that the table is there after --copy-back | ||
SELECT COUNT(*) from t1; | ||
DROP TABLE t1; | ||
|
||
|
||
--echo # Testing aria log files after --copy-back | ||
SET @@global.aria_checkpoint_interval=DEFAULT /*Force checkpoint*/; | ||
--file_exists $ARIA_LOGDIR_FS/aria_log_control | ||
--file_exists $ARIA_LOGDIR_FS/aria_log.00000001 | ||
--file_exists $ARIA_LOGDIR_FS/aria_log.00000002 | ||
--error 1 | ||
--file_exists $ARIA_LOGDIR_FS/aria_log.00000003 | ||
--replace_regex /Size +[0-9]+ ; .+aria_log/aria_log/ | ||
SHOW ENGINE aria logs; | ||
|
||
|
||
--echo # Restarting mariadbd with default parameters | ||
--let $restart_parameters= | ||
--source include/restart_mysqld.inc | ||
--rmdir $ARIA_LOGDIR_FS |
Oops, something went wrong.