[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: CONDSTORE plus UID EXPUNGE undefined? Robert Mueller Wed Mar 28 14:02:04 2012

> >With MOVE, you need to hold the lock on the first mailbox until
> >after the APPEND has succeeded, then come back and EXPUNGE them.
> it can be optimised for MOVE.  Since you don't need to do a deep file 
> copy, but a file system move, as long as the dest folder is in the same 
> volume as the source, it's usually a very quick operation - much 
> quicker than copy.  Worst case it takes the same time if different 
> volumes.

Assuming you're using a "1 file = 1 email" model, then most filesystems
that support move, also support hardlinks, so a copy is actually
*cheaper* than a move, because you're just adding an extra link, and
adding links is usually a lot cheaper than unlinking.

In fact unlinks are usually sufficiently poorly optimised in
filesystems, that we explicitly added a "delayed expunge" mode to cyrus,
that allows us to push the unlink actions off into the future (eg
weekends) because they completely dominate the time on large expunges

> So the 2 locks are held a short time only.

It's not that they're short time only, it's that it can cause deadlocks
because for a move to be atomic, you have to have both locks at the same
time, while with copy you can get/drop them sequentially.