Replies: 5 comments
-
|
Hi @D-i-t-gh. Mailpit shows info-level messages by default, which displays errors, warnings, and info messages while hiding debug messages. Currently, only startup messages are classified as "info," while VACUUM actions are logged at debug level - since most users don't need visibility into this operation. To track when Mailpit runs a VACUUM, you'd need to enable debug logging and search for "vacuum completed in." There's no other way unless I change the logging level for that scheduled task. However, doing so would raise the question of why I shouldn't also promote auto-delete logs to info level, which will then become quite verbose on busy servers as deletions happen far more often. Here's how VACUUM works: When messages are deleted, their "deleted size" is recorded in the database. Once the total deleted size reaches ≥ 1% of the database size and the database has been inactive for 5 minutes (no messages received, deleted, API access etc), a VACUUM is triggered. Since VACUUM is CPU and disk-intensive, it's designed to run infrequently and during low-activity periods. Just to be clear, I'm not opposed to changing the VACUUM logging to info, I'm just not sure whether it would be of any use to you given that you actually have no control over it. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for your answer. A VACUUM is a much heavier operation than deleting. Suppose someone does frequent online backups - it will fail when a VACUUM is running. Also as much as twice the size of the original database file is required in free disk space. This is not the case if Mailpit runs the auto-deletes. I agree it would be nice to also have control over the time when VACUUM is executed. Maybe an option "run VACUUM at startup" could be implemented without major code changes? This way, I could just schedule a restart to run the VACUUM at a time window when nobody uses the service and no backup is running. |
Beta Was this translation helpful? Give feedback.
-
|
Yes, a VACUUM is much heavier than a deletion because a deletion leaves empty space in the database file, whereas a VACUUM completely rebuilds the database.
I think that the first thing you should consider trying is manually running a VACUUM (as I'll explain below) at a scheduled time. Note that this would involve Mailpit downtime, although that's technically also the case when it runs automatically too (Mailpit will not respond until the VACUUM is complete):
If this solution works for you, then I will also consider adding a startup option to disable auto-vacuum. I don't think it will be necessary because deleting more than 1% of a very large database is actually a LOT of deleted emails, and if you're running the process above you're actually "resetting" the delete count every day anyway. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks, your solution works well, so having an option to disable auto-vacuum would be very nice!
I have made some tests with running |
Beta Was this translation helpful? Give feedback.
-
|
I've added this feature to v1.29.5 - |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, AFAIK there is an option to turn verbose logging on or off (
MP_VERBOSE). If turned on, every single incoming mail will generate multiple lines of output, also each Web UI refresh/click will be logged. If turned off, almost nothing will be logged as long as everything is functioning.Now, my goal is to see additionally all database VACUUM operations in the logs for my production systems, where verbose logging is turned off. As an admin I'd like to know exactly when the automatic VACUUM happened, as this is a critical operation. It seems this info is not persisted in the SQLite database itself, so I think there is no other way to get this info. Or maybe there is a way and I don't know it?
Beta Was this translation helpful? Give feedback.
All reactions