mbox_dirty_syncs
Default | yes |
---|---|
Value | boolean |
See Also |
Enable optimized mbox syncing?
For larger mbox files, it can take a long time to determine what has changed when the file is altered unexpectedly. Since the change in most cases consists solely of newly appended mail, Dovecot can operate more quickly if it starts off by simply reading the new messages, then falls back to reading the entire mbox file if something elsewhere in it isn't as expected.
Dovecot assumes that external mbox file changes only mean that new messages were appended to it. Without this setting Dovecot re-reads the whole mbox file whenever it changes. There are various safeguards in place to make this setting safe even when other changes than appends were done to the mbox. The downside to this setting is that external message flag modifications may not be visible immediately.
When this setting is enabled, Dovecot tries to avoid re-reading the mbox
every time something changes. Whenever the mbox changes (i.e. timestamp or
size), Dovecot first checks if the mailbox's size changed. If it didn't, it
most likely meant that only message flags were changed so it does a full
mbox read to find it. If the mailbox shrunk, it means that mails were
expunged and again Dovecot does a full sync. Usually however the only thing
besides Dovecot that modifies the mbox is the LDA which appends new mails
to the mbox. So if the mbox size was grown, Dovecot first checks if the
last known message is still where it was last time. If it is, Dovecot reads
only the newly added messages and goes into "dirty mode". As long as
Dovecot is in dirty mode, it can't be certain that mails are where it
expects them to be, so whenever accessing some mail, it first verifies that
it really is the correct mail by finding its X-UID header. If the X-UID
header is different, it fallbacks to a full sync to find the mail's correct
position. The dirty mode goes away after a full sync. If
mbox_lazy_writes
was enabled and the mail didn't yet
have an X-UID header, Dovecot uses the MD5 sum of a couple of headers to
compare the mails.