I have a little problem and I need your help please. Here is the story : I have Percona Server in version 8.0.13 with one slave and the old binlogs on master are not deleted automatically when flush-logs appending.
Variables are set as :
# mysql -e"select @@expire_logs_days, @@binlog_expire_logs_seconds"
+--------------------+------------------------------+
| @@expire_logs_days | @@binlog_expire_logs_seconds |
+--------------------+------------------------------+
| 0 | 86400 |
+--------------------+------------------------------+
I have logrotate which execute mysqladmin flush-logs
every night and binlogs are correctly rotated but old ones are not removed. When I execute this command manually the behaviour is the same.
In MySQL CLI the command PURGE BINARY LOGS BEFORE datetime
works fine.
The slave replication is up to date or a little bit late but not more than a couple hour. So it can't be explain why old binlogs are still present on disks (some are 7 days old by example)
I also execute lsof
to check if MySQL retain descriptor on old binlogs but no. I have no more idea to explain the problem.
Do you have any ideas to explain and fix this please ?
Thanks,
Best Answer
Please note Paragraphs 2,3 in the MySQL Documentation for binlog_expire_logs_seconds:
Please review your my.cnf
If you have this line in the
my.cnf
change it to
Then go execute
This will cause a new thread to be opened with the new setting.
It's OK to have
because the documentation says when both are set, binlog_expire_logs_seconds will take precedence and a simple warning is posted for expire_logs_days.
As a last resort, please restart mysql
If you still have a problem after doing this, then I would suspect a bug.