On Wed, 2009-09-09 at 16:07 +0800, Tim Chen wrote:
After installing a new server with dovecot 1.2.4, I found there is some new dovecot-uidvalidity* files in user's Maildir directory. However, I did not see such files in other servers with dovecot 1.1.2 (around 2008/07).
What is function of those files?
To assign a unique UIDVALIDITY to created mailboxes.
What will happen if I delete that files?
They get recreated when you create a new mailbox.
I am curious why need to keep 2 files: dovecot-uidvalidity dovecot-uidvalidity.4aa4fa4c since the content of dovecot-uidvalidity is '4aa4fa4c' why do we need extra files?
It's a trick to be able to assign the UIDVALIDITY really fast and without locking. dovecot-uidvalidity.<UIDV> is the authoritative file and <UIDV> value is cached in dovecot-uidvalidity. So assigning a new UIDVALIDITY goes like:
- Read <UIDV> from dovecot-uidvalidity
- rename dovecot-uidvalidity.<UIDV> to dovecot-uidvalidity.
- Write dovecot-uidvalidity.
to dovecot-uidvalidity
If step 1 or step 2 fails (rare), it fallbacks to slower behavior where it finds readdir()s through the directory to find the latest dovecot-uidvalidity.<UIDV>.