On Thu, 2008-01-31 at 10:01 +0000, Daniel Watts wrote:
> Hi Timo,
> > On Jan 29, 2008, at 6:03 PM, Daniel Watts wrote:
> >
> >> Is there not a more efficient way to do this? If Dovecot knows the 
> >> whole folder is being deleted (ie a Trash purge), could it do 
> >> something clever with the filesystem to just remove the whole folder?
> >
> > If you use IMAP DELETE command, it renames the directory to 
> > ..DOVECOT-TRASH (or something like it) and only after that it starts 
> > unlinking the files. It wouldn't be too difficult to have this return 
> > success immediately and then keep deleting the files on the 
> > background. I'm not sure if this is worth the trouble though. It would 
> > also be possible to do this as a plugin.
> Something like that would be great. Would this actually then avoid the 
> locking problem described below?

Well, kind of, because the entire mailbox is deleted it can't even be
opened by another session :) Although it would be possible to create it
back immediately after deletion, but there's a small window during which
it's possible that the mailbox selection fails.

> IMHO this benefit is worth the effort. =)

There are two separate things here:

1) Making DELETE command work on background. This would require the user
to specifically delete + create back the mailbox and not just expunge
all messages. This wouldn't be too difficult.

2) Optimize expunging all messages by renaming Maildir/cur under
Maildir/tmp/, mkdir Maildir/cur back and then start deleting
Maildir/tmp/cur on background. This has a race condition between
rename() + mkdir(), so I don't want to ever do this by default.

Anyway I'm not going to implement either one anytime soon, but feel free
to write a plugin. :)

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to