MDEV-20703: mariabackup creates binlog files in server binlog directory on --prepare --export step
When "--export" mariabackup option is used, mariabackup starts the server in bootstrap mode to generate *.cfg files for the certain innodb tables. The started instance of the server reads options from the file, pointed out in "--defaults-file" mariabackup option. If the server uses the same config file as mariabackup, and binlog is switched on in that config file, then "mariabackup --prepare --export" will create binary log files in the server's binary log directory, what can cause issues. The fix is to add "--skip-log-bin" in mysld options when the server is started to generate *.cfg files.
This commit is contained in:
parent
f203245e9e
commit
edda2fd149
@ -1535,7 +1535,8 @@ static int prepare_export()
|
|||||||
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
|
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
|
||||||
" --innodb --innodb-fast-shutdown=0 --loose-partition"
|
" --innodb --innodb-fast-shutdown=0 --loose-partition"
|
||||||
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
|
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
|
||||||
" --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
|
" --console --skip-log-error --skip-log-bin --bootstrap < "
|
||||||
|
BOOTSTRAP_FILENAME IF_WIN("\"",""),
|
||||||
mariabackup_exe,
|
mariabackup_exe,
|
||||||
orig_argv1, (my_defaults_group_suffix?my_defaults_group_suffix:""),
|
orig_argv1, (my_defaults_group_suffix?my_defaults_group_suffix:""),
|
||||||
xtrabackup_use_memory);
|
xtrabackup_use_memory);
|
||||||
@ -1547,7 +1548,8 @@ static int prepare_export()
|
|||||||
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
|
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
|
||||||
" --innodb --innodb-fast-shutdown=0 --loose-partition"
|
" --innodb --innodb-fast-shutdown=0 --loose-partition"
|
||||||
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
|
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
|
||||||
" --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""),
|
" --console --log-error= --skip-log-bin --bootstrap < "
|
||||||
|
BOOTSTRAP_FILENAME IF_WIN("\"",""),
|
||||||
mariabackup_exe,
|
mariabackup_exe,
|
||||||
(my_defaults_group_suffix?my_defaults_group_suffix:""),
|
(my_defaults_group_suffix?my_defaults_group_suffix:""),
|
||||||
xtrabackup_use_memory);
|
xtrabackup_use_memory);
|
||||||
|
@ -12,7 +12,7 @@ CREATE TABLE t2(i int) ENGINE INNODB;
|
|||||||
|
|
||||||
echo # xtrabackup backup;
|
echo # xtrabackup backup;
|
||||||
|
|
||||||
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
|
let targetdir=$MYSQLTEST_VARDIR/tmp/backup;
|
||||||
--disable_result_log
|
--disable_result_log
|
||||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.*1" --target-dir=$targetdir;
|
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.*1" --target-dir=$targetdir;
|
||||||
--enable_result_log
|
--enable_result_log
|
||||||
@ -25,13 +25,27 @@ EOF
|
|||||||
write_file $targetdir/test/junk.frm;
|
write_file $targetdir/test/junk.frm;
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
let server_cnf=$targetdir/server.cnf;
|
||||||
|
copy_file $MYSQLTEST_VARDIR/my.cnf $server_cnf;
|
||||||
|
|
||||||
|
# Emulate server config file turnes on binary logs
|
||||||
|
perl;
|
||||||
|
my $binlog_path="$ENV{'targetdir'}/mysqld-bin";
|
||||||
|
my $config_path=$ENV{'server_cnf'};
|
||||||
|
open(my $fd, '>>', "$config_path");
|
||||||
|
print $fd "\n[mysqld]\n";
|
||||||
|
print $fd "log-bin=$binlog_path\n";
|
||||||
|
close $fd;
|
||||||
|
EOF
|
||||||
|
|
||||||
echo # xtrabackup prepare;
|
echo # xtrabackup prepare;
|
||||||
--disable_result_log
|
--disable_result_log
|
||||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir;
|
exec $XTRABACKUP --defaults-file=$server_cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir;
|
||||||
--enable_result_log
|
--enable_result_log
|
||||||
|
|
||||||
list_files $targetdir/test *.cfg;
|
list_files $targetdir/test *.cfg;
|
||||||
|
# There must not be binary logs created on --prepare step
|
||||||
|
list_files $targetdir/ mysqld-bin.*;
|
||||||
|
|
||||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||||
ALTER TABLE t1 DISCARD TABLESPACE;
|
ALTER TABLE t1 DISCARD TABLESPACE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user