[Dovecot] update of current quota usage
Hello,
I use Dovecot 1.1.11 and store the current quota usage in a Database.
As far I can see it, the quota usage is updated each time dovecot
performs an action on a mail.
For example if a new mail is stored in the inbox, the current quota
usage is increased. If a mail is deleted the quota usage is decreased.
If there are still existing E-Mails in the inbox, before quota is
turned on or if I perfom changes on the "mail storage" myself (for
example purging trash or spam, or something) the current quota usage
is NOT updated automatically by dovecot.
For example I copy some mailboxes to my server, then the current quota
for this mailboxes is still zero.
Is it correct that dovecot can't do this for me?
If yes, it seems I have to write my own (simple) update script and run
it sometimes croned (because I don't really trust the actual quota
implementation) and/or I have to update the current quota usage each
time I perform actions myself.
This "workaround" is easy by using a DB storage, but what about other
implementations?
Wouldn't it be nice if dovecot could do this or provide a tool for it?
Thank you! Philipp
On Fri, 2009-03-20 at 11:43 +0100, floss@pBartels.info wrote:
For example I copy some mailboxes to my server, then the current quota
for this mailboxes is still zero.Is it correct that dovecot can't do this for me?
Yes. It's too much work for Dovecot to try to figure out all the different things you might be doing under it. You can anyway easily make Dovecot recalculate the quota: delete the user's quota usage row from the database.
Timo Sirainen tss@iki.fi wrote:
On Fri, 2009-03-20 at 11:43 +0100, floss@pBartels.info wrote:
For example I copy some mailboxes to my server, then the current quota for this mailboxes is still zero.
Is it correct that dovecot can't do this for me?
Yes. It's too much work for Dovecot to try to figure out all the different things you might be doing under it. You can anyway easily make Dovecot recalculate the quota: delete the user's quota usage row from the database.
Well, thats a very simple solution. Also for my example. If I copy
some mailboxes to the server I just remove the quota usage row and
dovecot recalculates it. I can do this too, if I remove some spam
messages or purge the trash...
What did you mean with too much work? (It's able to do it and you said yes it can't but it can as you said later.)
Thank you, Philipp
On Fri, 2009-03-20 at 18:47 +0100, floss@pBartels.info wrote:
Yes. It's too much work for Dovecot to try to figure out all the different things you might be doing under it. You can anyway easily make Dovecot recalculate the quota: delete the user's quota usage row from the database.
Well, thats a very simple solution. Also for my example. If I copy
some mailboxes to the server I just remove the quota usage row and
dovecot recalculates it. I can do this too, if I remove some spam
messages or purge the trash...
If you removed spam messages and purged trash via IMAP you wouldn't have to worry about updating quota.
What did you mean with too much work?
I mean that currently quota is updated only while changes are actually done. To be able to figure out when mailbox changes were done outside Dovecot it would need to keep some kind of state which messages/mailboxes were added to quota and which weren't. Index files help somewhat in implementing that, but it's still a lot of extra code.
Timo Sirainen tss@iki.fi wrote:
On Fri, 2009-03-20 at 18:47 +0100, floss@pBartels.info wrote:
Yes. It's too much work for Dovecot to try to figure out all the different things you might be doing under it. You can anyway easily make Dovecot recalculate the quota: delete the user's quota usage row from the database.
Well, thats a very simple solution. Also for my example. If I copy some mailboxes to the server I just remove the quota usage row and dovecot recalculates it. I can do this too, if I remove some spam messages or purge the trash...
If you removed spam messages and purged trash via IMAP you wouldn't have to worry about updating quota.
I mean if you do this directly on the server using a "croned" script.
What did you mean with too much work?
I mean that currently quota is updated only while changes are actually done. To be able to figure out when mailbox changes were done outside Dovecot it would need to keep some kind of state which messages/mailboxes were added to quota and which weren't. Index files help somewhat in implementing that, but it's still a lot of extra code.
Yes as I see it quota usage is only done if something is done via
IMAP, or perhaps if you fetch mail via POP?! (not tested). And then it
is not recalculated, it's just updated like if you remove a file the
quota is decreased of filesize, etc.
That's ok if you're only using IMAP and if you can trust that all works fine.
But there is also the behavior that dovecot calculates the usage if
its not yet set and that is useful. I think the best solution for me
is just to remove the row after I made some changes in the mailbox and
then dovecot will recalc. the quota usage at the next action, like
reciving a mail...
So you just have to know that you have to remove the quota usage
informations after you did something in the mailbox and then dovecot
recalculates it for you.
(I thought I must write a script that summarizes the usage and update
the database...)
Thank you
On Fri, 2009-03-20 at 19:10 +0100, floss@pBartels.info wrote:
If you removed spam messages and purged trash via IMAP you wouldn't have to worry about updating quota.
I mean if you do this directly on the server using a "croned" script.
Yes, but I meant that you could rewrite your script in a way that it uses IMAP to do the actualy work, instead of modifying the filesystem directly. For example with v1.2 you could do it easily:
printf "1 select Trash 2 search return (save) before 01-jan-2009 3 store $ +flags.silent \deleted 4 expunge 5 logout " | dovecot --exec-mail imap
v1.1 doesn't have the return (save) and $ feature though, so it would need a more interactive script.
What did you mean with too much work?
I mean that currently quota is updated only while changes are actually done. To be able to figure out when mailbox changes were done outside Dovecot it would need to keep some kind of state which messages/mailboxes were added to quota and which weren't. Index files help somewhat in implementing that, but it's still a lot of extra code.
Yes as I see it quota usage is only done if something is done via
IMAP, or perhaps if you fetch mail via POP?! (not tested).
Quota is updated whenever Dovecot is the one doing changes and quota plugin is loaded. So assuming you've added mail_plugins=quota inside pop3 section, Dovecot pop3 updates the quota.
And then it
is not recalculated, it's just updated like if you remove a file the
quota is decreased of filesize, etc.
Yes. Recalculating quota all the time would be way too much unnecessary work.
participants (2)
-
floss@pBartels.info
-
Timo Sirainen