[MDEV-28758] Mariabackup copies binary logs to backup directory Created: 2022-06-07  Updated: 2023-11-22  Resolved: 2022-08-01

Status: Closed
Project: MariaDB Server
Component/s: Galera SST, mariabackup
Affects Version/s: 10.3.35, 10.4.25, 10.5.16, 10.6.8
Fix Version/s: 10.3.36, 10.4.26, 10.5.17, 10.6.9, 10.7.5, 10.8.4, 10.9.2, 10.10.0

Type: Bug Priority: Blocker
Reporter: Michaël de groot Assignee: Julius Goryavsky
Resolution: Fixed Votes: 13
Labels: None
Environment:

RHEL


Issue Links:
Issue split
split to MDEV-28968 mariabackup SST doesn't properly hand... Closed
Problem/Incident
is caused by MDEV-27524 Incorrect binlogs after Galera SST us... Closed
Relates
relates to MDEV-28772 Mariabackup locks database for minute... Closed
relates to MDEV-29109 mariabackup --rsync option broken sin... Closed
relates to MDEV-28015 Mariabackup | GTID value is missing, ... Closed
relates to MDEV-28781 mariabackup rsync fails to copy /var/... Closed

 Description   

Hi,

I have log_bin specified to the data directory:
/etc/my.cnf.d/common.cnf:12:log_bin="/var/lib/mysql/mariadb"

In the mariabackup output, I see that mariabackup copies the binary logs to the backup directory:
[00] 2022-06-06 19:22:58 Compressing /var/lib/mysql/mariadb.000270 to /backupdisk/diff-2022-06-06_19-07-01/mariadb.000270.qp

This is needless consumption of space on the backup disk.

I did not find a command-line switch to disable copying the binary logs, I think this is a bug in mariabackup to just copy all the files that are in the data directory.

Specifying a custom binlog directory is NOT a work-around for this issue. It does not seam that the general log is stored with the backup, so why can the binary logs not be excepted?

Earlier bakup runs (with a different mariabackup version) did not show this issue, it seams some thing changed in mariabackup.

My current version:
mariabackup based on MariaDB server 10.3.35-MariaDB Linux (x86_64)
[00] 2022-06-06 10:26:07 Using server version 10.3.31-MariaDB-log
/usr/bin/mariabackup based on MariaDB server 10.3.35-MariaDB Linux (x86_64)

The older runs were slightly different versions:
[00] 2022-03-23 00:07:01 Using server version 10.3.31-MariaDB-log
/usr/bin/mariabackup based on MariaDB server 10.3.34-MariaDB Linux (x86_64)

Thank you,
Michaël



 Comments   
Comment by Daniel Black [ 2022-06-07 ]

Is this not covered with --binlog-info=off?

Comment by Michaël de groot [ 2022-06-07 ]

According to the documentation, this is to retrieve the binary log file and position. Not the binary logs itself.

Comment by Michaël de groot [ 2022-06-07 ]

The same thing happens from the mariabackup SST script. I have therefore increased the priority.

Comment by Ere Maijala [ 2022-06-15 ]

I believe this is the reason we are now experiencing downtime due to the read lock being held while the large binary logs are being copied. With previous mariabackup versions the read lock was held for a few seconds, but now it's 44 minutes.

Comment by Martin Reinhardt [ 2022-06-15 ]

We found a working workaround for a customer with the same issue. We replaced the mariabackup binary containing the bug (version 10.3.35), with the last previously working binary (version 10.3.34).

1) backup the old binary: sudo cp /usr/bin/mariabackup /usr/bin/mariabackup_35
2) copy or install mariabackup version 10.3.34 to: /usr/bin/mariabackup

Comment by Phil Sumner [ 2022-06-16 ]

I'm experiencing what I suspect is the same issue in 10.6.8

I recently upgraded a replica used exclusively for taking backups from 10.1.48 -> 10.6.8, and using mostly the same command line for mariabackup instead of innobackupex - backup times have at least doubled and backup sizes have gone from 25-30GB to 120GB, and replication comes to a grinding halt while the BACKUP LOCK is taken and held while 2 days of binary logs are also backed up.

Old:
innobackupex --parallel=4 --compress --stream=xbstream ./ 2> /var/log/backup.log | ssh admin@host"cat > *path*/$(date +'%Y%m%d').xbstream

New:
mariabackup --backup --parallel=4 --stream=xbstream | pigz -p4 -c | ssh admin@host "cat > *path*/$(date +'%Y%m%d').xbstream.gz

I reverted Maria Backup to 10.6.7 and the behaviour is now as expected - i.e. binlogs are NOT copied. Backup is still slower and larger than in 10.1 with Xtrabackup but it's better than it was.

Comment by Anton Petin [ 2022-06-16 ]

Same bug in mariabackup 10.5.16, there is no such problem in 10.5.15 with same cmd

mariabackup --user=root --password=xxx  --target-dir /home/db/b/tmp/$date --backup  --slave-info --safe-slave-backup --parallel=10

Comment by Stefan May [ 2022-06-17 ]

I'm also seeing the issue in version 10.5.16 on openSuse Leap 15.3 x86_64

Im my configuration, all binlog files are stored in the main database directory /var/lib/mysql/
Version 10.5.16 copies all binlog files into the backup directory, significantly increasing lock duration and backup size.
The previous version 10.5.15 did not include binlog files into the backup directory.

In my particular server configuration with automated backups stored on a remote host, these bloated backups impact server performance and waste resources (network traffic and backup space).
As a temporary worakround, I now use a low value for server variable "expire_logs_days" (alternatively "binlog_expire_logs_seconds") to purge binary logs faster than previously configured.

Comment by Michaël de groot [ 2022-06-20 ]

I have tried to implement the work-around of binary logs in a separate directory. This unfortunately did not make a difference. The binary logs are still copied from the custom binlog directory in the backup location.

Comment by Anton Petin [ 2022-06-20 ]

This is a very serious bug, cause we store bin logs and snapshots of data for a long time. Each snapshot is around 1Tb and binlogs for 1Tb at all, so when we take an snapshot with new version of mariabackup - full backup is around 2Tb and long lock time while backuping.

Now we are using mariabackup 10.5.15 on 10.5.16 server, but i think it's not normal for such company like MariaDB not to solve it.

Comment by Andreas Hering [ 2022-07-27 ]

After an Update we also ran into this Bug. Please fix this or give us a hint how to prevent the creation of binlog archives in backup dir.

mariadb-backup --backup --host=localhost --user=root --password=xxx--target-dir /export/mariadbbackup/$(hostname)/$date --parallel=8 --compress --compress-threads=4

Comment by Sergei Golubchik [ 2022-07-31 ]

be286c57a looks ok to me

Comment by Jan Lindström (Inactive) [ 2022-08-01 ]

ok to push

Comment by Julius Goryavsky [ 2022-08-01 ]

https://github.com/MariaDB/server/commit/7fb1f919d0629d0c2bc68c616de557b658068fa0
https://github.com/MariaDB/server/commit/5b4154373a93b323c3502692c46dcc51b1731785
https://github.com/MariaDB/server/commit/5197519f4f7b31c61e3abccf75650e5356aecd4c

Generated at Thu Feb 08 10:03:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.