Harm van Tilborg
2010-Dec-10 15:29 UTC
[Dovecot] Quota warning generated when crossing on both sides
Hello everyone, I'm experimenting with the quota warning plugin. I have the following setting in Dovecot's general config: plugin { quota_warning = storage=75%% /var/www/contrib/doquotawarning.py 75 quota_warning2 = storage=90%% /var/www/contrib/doquotawarning.py 90 } The doquotawarning.py script is working okay -- meaning that the user gets a warning. My SQL backend uses the following query: user_query = \ SELECT m.maildir AS home, 1001 AS uid, 1001 AS gid, \ CONCAT('*:bytes=', m.quota, 'M') AS quota_rule, \ 'Trash:ignore' AS quota_rule2 \ FROM mailbox m \ INNER JOIN domain d \ ON d.id = m.domainid \ WHERE d.domain = '%d' \ AND m.user = '%n' Where m.quota is the user's personal quota (in MB). As you can see, we ignore the 'Trash' box, when considering the usage data. We are using the dict quota backend. Now this is what happens. Assume we have 'user at example.org', that has a quota of 10MB and he currently has 5MB in use. Now someone sends a 3MB email towards 'user at example.org'. Dovecot does indeed generate the warning message (75%), that arrives correctly 'together' with the 3MB email. Now the user moves the 3MB email to trash. This goes well, however: Dovecot generates the 75% warning message again. Which is not necessary: the user was cleaning his mailbox, i.e. usage is 5MB again. I have the feeling Dovecot is generating the warning event twice. When getting from e.g. 50% to 79% and when the usage is lowered from 87% to 70%. I have the feeling this is either not the correct behavior, or I'm misinformed. When looking at the source, this shouldn't be happening: if ((bytes_before < (uint64_t)warnings[i].rule.bytes_limit && bytes_current >= (uint64_t)warnings[i].rule.bytes_limit) || (count_before < (uint64_t)warnings[i].rule.count_limit && count_current >= (uint64_t)warnings[i].rule.count_limit)) { quota_warning_execute(root, warnings[i].command); break; } We're using Dovecot 1.2.9 (Ubuntu's 10.04 LTS version). -- Kind regards, Harm van Tilborg
Timo Sirainen
2010-Dec-13 13:32 UTC
[Dovecot] Quota warning generated when crossing on both sides
On Fri, 2010-12-10 at 16:29 +0100, Harm van Tilborg wrote:> user_query = \ > SELECT m.maildir AS home, 1001 AS uid, 1001 AS gid, \ > CONCAT('*:bytes=', m.quota, 'M') AS quota_rule, \ > 'Trash:ignore' AS quota_rule2 \There's no need for the quota_rule2 to be here since it's always static anyway. It could be in dovecot.conf: plugin { quota_rule2 = Trash:ignore }> Now this is what happens. Assume we have 'user at example.org', that has a > quota of 10MB and he currently has 5MB in use. Now someone sends a 3MB > email towards 'user at example.org'. Dovecot does indeed generate the warning > message (75%), that arrives correctly 'together' with the 3MB email. > > Now the user moves the 3MB email to trash. This goes well, however: > Dovecot generates the 75% warning message again. Which is not necessary: > the user was cleaning his mailbox, i.e. usage is 5MB again.This happens because of the Trash:ignore. It was a bug, fixed: http://hg.dovecot.org/dovecot-1.2/rev/fa6772b19795
Possibly Parallel Threads
- Question regarding reverse quota_warning
- [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
- [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
- [PATCH] [dovecot 2.2.9] Quota warnings ignored with FS quotas
- quota_wrning not working for me (quota_rewrite patch for dovecot 1.0.8)