I’m just trying to ascertain if I have a Bug or not with xtrabackup, or if it is intended to work this way.
I am using:
MySQL (Oracle): 8.0.39
xtrabackup version: 8.0.35-31
When xtrabackup runs it runs using the --lock-ddl
option which runs lock instance for backup
.
At the end of the process it runs FLUSH NO_WRITE_TO_BINLOG BINARY LOGS
Then afterwards it runs UNLOCK INSTANCE
From the logs:
2025-04-04T05:00:01.560946+01:00 0 [Note] [MY-011825] [Xtrabackup] Executing LOCK INSTANCE FOR BACKUP ... 2025-04-04T05:21:10.247239+01:00 0 [Note] [MY-011825] [Xtrabackup] Executing FLUSH NO_WRITE_TO_BINLOG BINARY LOGS 2025-04-04T05:21:10.911779+01:00 0 [Note] [MY-011825] [Xtrabackup] Executing UNLOCK INSTANCE 2025-04-04T05:21:10.912107+01:00 0 [Note] [MY-011825] [Xtrabackup] Executing UNLOCK TABLES 2025-04-04T05:21:10.912295+01:00 0 [Note] [MY-011825] [Xtrabackup] All tables unlocked
The problem is that this generates an error:
2025-04-04T05:21:10.459945+01:00 testdb1 mysqld[708]: 2025-04-04T04:21:10.458949Z 185315 [Warning] [MY-014054] [Server] Could not purge binary logs since another session is executing LOCK INSTANCE FOR BACKUP. Wait for that session to release the lock.
On some of my smaller databases I have found that this causes a problem as the binary logs never become large enough to be rotated (and purged) due to size, so each day we get a new binary log created, but the old ones don’t get removed, until eventually we will run out of space.
Obviously I can fix this by reducing the max size of the binary logs or simply calling the flush command manually after xtrabackup has run. But it seems a bit strange, and was wondering if this was intended to happen or not?