[Dovecot] Fixing bad maildir message sizes
Hello.
As stated in my previous message, we have some old compressed maildir messages with incorrect sizes in the filename. These messages cause dovecot 2.x problems.
I'm trying to write a script to crawl all our messages, check the actual message size and if necessary, fix the filename. However, when I do this, dovecot gives the message a new UID on next login. If I change the filename in dovecot-uidlist, dovecot still gives a new UID on next login. If I change dovecot-uidlist and delete the index, then the UID is preserved.
Re-indexing our millions of mailboxes is not a great solution for us. Is there a good way to fix this?
On 21.1.2013, at 21.54, Richard Platel rplatel@tucows.com wrote:
As stated in my previous message, we have some old compressed maildir messages with incorrect sizes in the filename. These messages cause dovecot 2.x problems.
I'm trying to write a script to crawl all our messages, check the actual message size and if necessary, fix the filename. However, when I do this, dovecot gives the message a new UID on next login. If I change the filename in dovecot-uidlist, dovecot still gives a new UID on next login. If I change dovecot-uidlist and delete the index, then the UID is preserved.
I don't really understand why deleting dovecot.index* would make a difference here, except maybe as a workaround in case the user has that mailbox selected, because the filenames could be cached in memory.
http://dovecot.org/tools/maildir-size-fix.pl http://dovecot.org/tools/maildir-size-check.sh
Those scripts kind of do what you want, except not fully, so it would be nice to get one fully finished one :) The best way for the script to would would be to:
- scan through a maildir, figure out what needs to be renamed to what, but don't actually do it
- lock the maildir with dovecot-uidlist.lock (src/util/maildirlock comes with dovecot)
- doveadm kick user's imap/pop3 sessions, and even better if it was possible to kill -9 any pending processes
- rename the files and update dovecot-uidlist
- delete dovecot-uidlist.lock
This separately for each folder.
Thanks Timo.
I was writing out corrupted dovecot-uidlist files, fixing that solved the issue.
Attached is a script that fixes message names. It's not fully QA'ed yet, and uses some of our site-specific stuff to figure out who owns the maildir and to boot the user while making changes, but might be useful as a starting point. Note that it handles compressed and uncompressed messages.
On 2013-01-22, at 7:01 AM, Timo Sirainen tss@iki.fi wrote:
On 21.1.2013, at 21.54, Richard Platel rplatel@tucows.com wrote:
As stated in my previous message, we have some old compressed maildir messages with incorrect sizes in the filename. These messages cause dovecot 2.x problems.
I'm trying to write a script to crawl all our messages, check the actual message size and if necessary, fix the filename. However, when I do this, dovecot gives the message a new UID on next login. If I change the filename in dovecot-uidlist, dovecot still gives a new UID on next login. If I change dovecot-uidlist and delete the index, then the UID is preserved.
I don't really understand why deleting dovecot.index* would make a difference here, except maybe as a workaround in case the user has that mailbox selected, because the filenames could be cached in memory.
http://dovecot.org/tools/maildir-size-fix.pl http://dovecot.org/tools/maildir-size-check.sh
Those scripts kind of do what you want, except not fully, so it would be nice to get one fully finished one :) The best way for the script to would would be to:
- scan through a maildir, figure out what needs to be renamed to what, but don't actually do it
- lock the maildir with dovecot-uidlist.lock (src/util/maildirlock comes with dovecot)
- doveadm kick user's imap/pop3 sessions, and even better if it was possible to kill -9 any pending processes
- rename the files and update dovecot-uidlist
- delete dovecot-uidlist.lock
This separately for each folder.
participants (2)
-
Richard Platel
-
Timo Sirainen