1589
MariaDBWARNINGNotableBinary LogHIGH confidence
Too many open files during binary log purge
Production Risk
Medium — binary log purge may be incomplete, leading to disk space not being reclaimed.
What this means
The operating system reported too many open files while MySQL was trying to purge binary log files.
Why it happens
- 1The system open file limit (ulimit -n) is too low for the number of binary log files being purged.
- 2Many concurrent connections combined with binary log purge operations exhausted file descriptors.
How to reproduce
trigger — this will error
trigger — this will error
PURGE BINARY LOGS BEFORE DATE_SUB(NOW(), INTERVAL 1 DAY);
expected output
Warning 1589: file purge encountered an error
Fix 1
Increase the open files limit
Increase the open files limit
-- In /etc/security/limits.conf: mysql soft nofile 65536 mysql hard nofile 65536
Why this works
Increasing the OS-level file descriptor limit prevents exhaustion during binary log operations.
Fix 2
Purge logs in smaller batches
Purge logs in smaller batches
PURGE BINARY LOGS BEFORE DATE_SUB(NOW(), INTERVAL 30 DAY); -- Then gradually reduce the interval
Why this works
Purging fewer logs at once reduces the peak number of simultaneously open file handles.
Sources
Official documentation ↗
MySQL 8.0 — 1589 ER_BINLOG_PURGE_EMFILE
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev