[Dovecot] using dsync to convert mailboxes looses caching options

Timo Sirainen tss at iki.fi
Sat Dec 10 14:13:57 EET 2011


On 10.12.2011, at 13.32, Mark Zealey wrote:

> 10-12-2011 13:07, Timo Sirainen yazmış:
>>> It could well be because of the conversion to sdbox then - the ctime/mtime of the files are not being preserved by dsync (in stock 2.0.16). The date.saved timestamp is only put into the cache on the second dsync run; presumably therefore it picks it up from the filesystem.
>> With sdbox the file's mtime isn't even tried to be preserved. The received-time and saved-time are written to the metadata block inside the file.
> 
> Ah yes; I saw the R metadata but not the C header key.

The C is the file's create time. It's not actually use for anything.

> Looking deeper at this I think I was expecting the date.save time to be about the same as the date.receive; however the ctime for these files is quite recent presumably affected by setting of message flags in a maildir or something (we're using nfs).

Yes, maildir flag changes change the ctime, which also changes the save date if it's not already cached.

> so ctime/sdbox C entry are close enough by my calculations (not sure where the 61 seconds of difference comes from though). It is a bit strange you wouldn't use the source cache's value for date.save if it is available as ctime can be pretty unreliable?


It is using the the cached value.

Anyway, I remembered wrong how sdbox's save date is looked up. It's taken from the sdbox file's ctime. The reason is similar to maildir: The save date is used mainly to figure out when to automatically expunge messages from Trash after it's been there for n days. So if you copy 1 year old message to Trash, you don't want it expunged immediately (based on mtime or some metadata inside the file), you want it expunged n days since the move. And ctime is really the only nice way to do it automatically, because copying a message with sdbox is done with hard linking.

mdbox stores the save date in the index file. sdbox could do it too, but that's just extra work and probably not worth the trouble. And unlink atime/mtime, ctime can't be changed using any syscalls (except to current time).

So, I think everything here works as intended, although not really as expected. :)


More information about the dovecot mailing list