michael at lattari.pl
2009-Jan-24 12:00 UTC
[Dovecot] Dict quota negative values in MySql table?
Hi!
I have a question about the dictionary quota :storage and :messages
values in MySql quota table.
How to interpret the following values? Why some values are negative? Are
the values relative to something?
I would like to write a simple php application to check the user quota
but I don't know how to interpret this:
mysql> select * from quota;
+------------------------+----------------+-------------+
| username | path | current |
+------------------------+----------------+-------------+
| mlattari | quota/storage | -6976 |
| mlattari | quota/messages | -3 |
| llattari | quota/storage | -2147483648 |
| llattari | quota/messages | -874 |
| mlattari_archivum_imap | quota/storage | 282475 |
| mlattari_archivum_imap | quota/messages | 5 |
+------------------------+----------------+-------------+
6 rows in set (0.00 sec)
pls help :-)
dovecot -n
# 1.1.8: /etc/dovecot/etc/dovecot.conf
# OS: Linux 2.6.22.14-72.fc6 x86_64 Fedora Core release 6 (Zod) ext3
base_dir: /etc/dovecot/var/run/dovecot/
log_path: /etc/dovecot/var/log/dovecot_log
info_log_path: /etc/dovecot/var/log/dovecot_log
protocols: imaps
ssl_cert_file: /etc/pki/dovecot/server.crt
ssl_key_file: /etc/pki/dovecot/server.key
ssl_cipher_list: ALL:!ADH!LOW:!SSLv2:!EXP:+HIGH:+MEDIUM
verbose_ssl: yes
login_dir: /etc/dovecot/var/run/dovecot/login
login_executable: /etc/dovecot/libexec/dovecot/imap-login
login_user: dovecot_login
mail_privileged_group: mail
mail_uid: 507
mail_gid: 507
mail_location: mbox:/home/%u/mail:INBOX=/home/spool/mail/%u
mail_plugins: expire quota imap_quota trash
auth default:
mechanisms: plain login
debug: yes
passdb:
driver: passwd-file
args: /etc/dovecot/etc/passwd.dovecot
socket:
type: listen
master:
path: /etc/dovecot/var/run/dovecot/auth-master
mode: 384
user: mail
plugin:
quota: dict:user::proxy::quotadict
quota_rule: *:storage=5G:messages=2000
quota_rule2: Trash:storage=1G:messages=1000
trash: /etc/dovecot/etc/dovecot-trash.conf
expire: Trash 7 Spam 7 INBOX 180 Sent 180
auth_socket_path: /etc/dovecot/var/run/dovecot/auth-master
expire_dict: proxy::expire
dict:
quotadict: mysql:/etc/dovecot/etc/dovecot-dict-quota.conf
expire: mysql:/etc/dovecot/etc/dovecot-dict-expire.conf
Best regards
michael
michael at lattari.pl
2009-Jan-26 01:30 UTC
[Dovecot] Dict quota negative values in MySql table?
I have it :-) The values are negative because they are relative to the messages count and the used storage at the timepoint of Quota Plugin initialization. If I would have had x messages in my INBOX before quota initialization, then I would have started the Quota Plugin and I would have deleted y messages, then I would have had a (x-y) messages count in the MySql quota table... and the same is valid for storage :-) Best regards
On Sat, 2009-01-24 at 13:00 +0100, michael at lattari.pl wrote:> Hi! > > I have a question about the dictionary quota :storage and :messages > values in MySql quota table. > How to interpret the following values? Why some values are negative? Are > the values relative to something?You should treat negative values the same way as if the quota wasn't known yet. The only time they should happen is when user hasn't yet a) asked the current quota, b) saved any new messages, but has expunged messages. So for example since you enabled quota:> | mlattari | quota/storage | -6976 | > | mlattari | quota/messages | -3 |mlattari has expunged 3 messages, but hasn't saved any messages.> | llattari | quota/storage | -2147483648 | > | llattari | quota/messages | -874 |The byte count is pretty weird here. Did llattari really expunge exactly 2 GB of mails?..> | mlattari_archivum_imap | quota/storage | 282475 | > | mlattari_archivum_imap | quota/messages | 5 |This is how it should look like normally. All the negative entries anyway are eventually recalculated by Dovecot. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20090125/ff57b70d/attachment-0002.bin>
michael at lattari.pl
2009-Jan-26 01:58 UTC
[Dovecot] Dict quota negative values in MySql table?
Thank you for the exhaustive explanation! Now I understand it and the quota is EXACT when I verify it running USER=wanted_user dovecot --exec-mail imap 1 GETQUOTAROOT INBOX as you suggested somewhere else in the mailing list Best regards michael lattari