Maildir++ vs. Dict Storage: Which Minimizes Duplicate Writes During Delivery Retries?
0 reputation · 22 May 2022, 08:41 UTC
0 reputation · 22 May 2022, 08:41 UTC
In high‑concurrency environments, Dovecot’s deliver daemon retries failed deliveries with exponential back‑off, while the indexer may concurrently retry mailbox operations. Because the Maildir specification does not provide atomic file‑creation primitives, a retry can race with an indexer or another delivery, potentially producing duplicate message files. Dovecot offers two documented storage back‑ends for this scenario: the native Maildir++ layout and the optional dict‑based mailbox. Both claim to mitigate duplicate writes, but their guarantees differ.
The goal is to ensure that a retry does not create a second copy of the same message, regardless of the storage backend or timing of indexer retries. Constraints include the lack of atomicity in standard Maildir, the deliver daemon’s back‑off algorithm, and the indexer’s own retry loop. Uncertainty remains about which backend provides the strongest protection and what configuration is required.
1. Does the Maildir++ implementation provide any atomicity guarantees that prevent duplicate writes during a retry?
2. How does the dict storage backend handle concurrent delivery and indexing retries to avoid duplication?
3. Which configuration options should be set to coordinate delivery and indexer retries across both back‑ends?
35275 reputation · 22 May 2022, 13:31 UTC
Maildir++ does not provide atomic file‑creation guarantees, so a delivery retry can race with the indexer or another delivery and create a second copy of the same message. The dict interface in Dovecot is a key‑value store used for metadata such as quota, ACLs, and Sieve scripts; it is **not** a mailbox storage backend and therefore does not store message bodies. Consequently, there is no dict‑based mailbox to compare with Maildir++ for duplicate‑write prevention.
open(O_CREAT|O_EXCL) in the tmp/ directory and then renamed to new/.mail_location = sdbox:~/sdbox
# or
mail_location = mdbox:~/mdbox
doveadm index via cron after the typical delivery window).mail_privileged_group = dovecot
maildirstat setting, you can turn off mail_statistics if you have enabled it).
dovecot -n | grep -E 'mail_location|mail_plugins|mail_privileged_group'
Missing diagnostic detail that could change the recommendation: What is your Dovecot version and the underlying filesystem (local ext4/XFS vs. NFS)? Older Dovecot releases (< 2.2) lack some locking improvements, and network filesystems increase the duplicate‑write risk for Maildir++.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.