[Dovecot] The usage of dovecot-uidvalidity* files?

Timo Sirainen tss at iki.fi
Wed Sep 9 23:28:07 EEST 2009


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:

1. Read <UIDV> from dovecot-uidvalidity
2. rename dovecot-uidvalidity.<UIDV> to dovecot-uidvalidity.<UIDV+1>
3. Write dovecot-uidvalidity.<UIDV+1> 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>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20090909/afeabaa6/attachment.bin 


More information about the dovecot mailing list