RE: [Dovecot] Bug: maidirsize double counting moved messages
On Fri, April 21, 2006 15:01, Bill Boebel <bill@webmail.us> said:
The maildirsize file is double counting messages when moving them from folder to folder when "maildir_copy_with_hardlinks = no":
When I change "maildir_copy_with_hardlinks" to "yes", this problem only occurs when moving in and out of the INBOX, but not when moving from subfolder to subfolder:
Well... I don't think this is the correct fix below, but it did the trick in our environment when maildir_copy_with_hardlinks=yes. I think the real problem is that quota_default_alloc() is getting called twice. Once from somewhere in mail_storage_copy() -> maildir_copy() -> mailbox_save_init(), and a second time somewhere after that.
src/lib-storage/index/maildir/maildir-copy.c @136
< if (mbox->storage->copy_with_hardlinks/* && < mail->box->storage == mbox->ibox.box.storage*/) {
if (mbox->storage->copy_with_hardlinks) {
On Wed, April 26, 2006 10:37, Bill Boebel said:
On Fri, April 21, 2006 15:01, Bill Boebel <bill@webmail.us> said:
The maildirsize file is double counting messages when moving them from folder to folder when "maildir_copy_with_hardlinks = no":
When I change "maildir_copy_with_hardlinks" to "yes", this problem only occurs when moving in and out of the INBOX, but not when moving from subfolder to subfolder:
Well... I don't think this is the correct fix below, but it did the trick in our environment when maildir_copy_with_hardlinks=yes. I think the real problem is that quota_default_alloc() is getting called twice. Once from somewhere in mail_storage_copy() -> maildir_copy() -> mailbox_save_init(), and a second time somewhere after that.
src/lib-storage/index/maildir/maildir-copy.c @136
< if (mbox->storage->copy_with_hardlinks && < mail->box->storage == mbox->ibox.box.storage) {
if (mbox->storage->copy_with_hardlinks) {
This size doubling is happening for any IMAP APPEND operation as well. It has been a pretty annoying bug, because we have to keep manually deleting maildirsize files to fix mailboxes so that they don't bounce mail due to the quota miscalculation. Timo, is this something you could take a look at?
Thanks, Bill
On Thu, May 18, 2006 9:49, Bill Boebel said:
This size doubling is happening for any IMAP APPEND operation as well. It has been a pretty annoying bug, because we have to keep manually deleting maildirsize files to fix mailboxes so that they don't bounce mail due to the quota miscalculation. Timo, is this something you could take a look at?
The problem appears to be that quota_default_try_alloc_bytes() is getting called twice during APPEND. Once from quota_save_init() when it is trying to guess if there is enough room to save the new message, and then again while actually performing the save in quota_save_finish():
quota_save_init() quota_try_alloc_bytes()
quota_save_finish() quota_check() quota_try_alloc() quota_default_try_alloc_bytes()
I added a quick hack to use the existing bool parameter "too_large" as a flag to tell quota_default_try_alloc_bytes() whether or not to allocate bytes or just check if there is room to allocate bytes. I'm sure it is trivial to clean this up and pass this flag as a new parameter, but I didn't want to break any other functions that might be calling this...
src/plugins/quota/quota-storage.c @185 (quota_save_init)
/* BB 05/18/2006 - Hack: set "too_large=TRUE" to tell quota_try_alloc_bytes
to not actuall allocate the bytes yet. That will be done later */
too_large = TRUE;
src/plugins/quota/quota.c @375 (quota_default_try_alloc_bytes)
/* BB 05/18/2006 - Hack: use too_large_r=TRUE as a flag to just check if
we can allocate bytes, but don't actually allocate it yet since this
function is called again later */
bool alloc_bytes;
if (*too_large_r == TRUE)
alloc_bytes = FALSE;
else
alloc_bytes = TRUE;
@400 (quota_default_try_alloc_bytes)
/* BB 05/18/2006 - Hack: skip if we just want to check if we have enough
room */ if (alloc_bytes) { ctx->count_diff++; ctx->bytes_diff += size; }
participants (1)
-
Bill Boebel