[MDEV-13447] binary log rotation not honouring expire_log_days Created: 2017-08-04  Updated: 2017-08-10  Resolved: 2017-08-10

Status: Closed
Project: MariaDB Server
Component/s: Documentation, Server
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Andrew Ramsay Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: log, logrotate
Environment:

win7x64 32GB RAM 1TB SSD


Attachments: File dir.list     Text File my.ini    

 Description   

Binary logs are not being deleted by mariadb server in line with the expire_log_days variable. I have been watching this for a while on 10.2.7 and it seems random when deletion actually takes place (might it possibly be being triggered by some specific action occurring, other than time passing?).
Currently I have expire_log_days = 2
as can be seen from the directory listing attached, the logs go back to 16:11 on 31-Jul so however it is initiated (e.g. (1)run once at midnight, (2) check every minute or hour), the logs from 31-Jul and 01-Aug should have been removed.
This has a potential impact regarding available space,and whilst it shouldn't rely on narrow margins, it should be able to be accounted for (assuming consistent usage!)



 Comments   
Comment by Elena Stepanova [ 2017-08-04 ]

It is the problem of insufficient documentation. Expired logs aren't deleted upon any particular time checkpoint, they are deleted either when the binary logs are rotated – upon FLUSH LOGS, or upon automatic creation of the next binary log when the previous one reached the maximum size, or upon server restart. Does it correlate with what you have observed?

In your dir.list the last log rotation happened on 2017-08-02 16:08, while the first undeleted log is dated 2017-07-31 16:11, so it still fits into 2 days timeout, however barely.

Comment by Andrew Ramsay [ 2017-08-04 ]

Ah, that probably does explain what I've seen, thank you.
Now I understand it (if the sentence below is accurate?), it makes perfect sense, and seems entirely reasonable.

So, the documentation means to say: "expire_log_days is the maximum period, in days, between the creation of the most recent log and the last time the earliest log was written to"?

Comment by Elena Stepanova [ 2017-08-04 ]

I'll leave it to greenman to phrase it in a right way, he'll do it much better than I.

Comment by Ian Gilfillan [ 2017-08-10 ]

Clarified on https://mariadb.com/kb/en/mariadb/replication-and-binary-log-server-system-variables/#expire_logs_days

Generated at Thu Feb 08 08:05:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.