Mercurial > dovecot > core-2.2
changeset 22382:9fab68be12db
lib-storage: Add mailbox_list_index_include_inbox setting
This controls whether to update INBOX's STATUS information in the mailbox
list index. It can be useful especially if LISTINDEX points to a tmpfs,
but perhaps also in other situations.
I considered adding a more generic setting to exclude other mailboxes, but
the namespace prefixes and hierarchy separators get a bit complicated with
shared mailboxes. It's probably also not very useful to change this for
anything but the INBOX.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 24 Jul 2017 14:17:22 +0300 |
parents | 97c212d6dd64 |
children | 0a22d391254f |
files | doc/example-config/conf.d/10-mail.conf src/lib-storage/list/mailbox-list-index-status.c src/lib-storage/mail-storage-settings.c src/lib-storage/mail-storage-settings.h |
diffstat | 4 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/example-config/conf.d/10-mail.conf Mon Jul 24 14:12:55 2017 +0300 +++ b/doc/example-config/conf.d/10-mail.conf Mon Jul 24 14:17:22 2017 +0300 @@ -227,6 +227,10 @@ # The results will be automatically fixed once the folders are opened. #mailbox_list_index_very_dirty_syncs = yes +# Should INBOX be kept up-to-date in the mailbox list index? By default it's +# not, because most of the mailbox accesses will open INBOX anyway. +#mailbox_list_index_include_inbox = no + # The minimum number of mails in a mailbox before updates are done to cache # file. This allows optimizing Dovecot's behavior to do less disk writes at # the cost of more disk reads.
--- a/src/lib-storage/list/mailbox-list-index-status.c Mon Jul 24 14:12:55 2017 +0300 +++ b/src/lib-storage/list/mailbox-list-index-status.c Mon Jul 24 14:17:22 2017 +0300 @@ -27,11 +27,10 @@ struct index_list_storage_module index_list_storage_module = MODULE_CONTEXT_INIT(&mail_storage_module_register); -/* Never update the STATUS information for INBOX. INBOX is almost always opened - anyway, so this just causes extra writes. (Although this could be useful if - somebody has a lot of other users' shared INBOXes.) */ +/* Should the STATUS information for this mailbox not be written to the + mailbox list index? */ #define MAILBOX_IS_NEVER_IN_INDEX(box) \ - ((box)->inbox_any) + ((box)->inbox_any && !(box)->storage->set->mailbox_list_index_include_inbox) static int index_list_open_view(struct mailbox *box, bool status_check,
--- a/src/lib-storage/mail-storage-settings.c Mon Jul 24 14:12:55 2017 +0300 +++ b/src/lib-storage/mail-storage-settings.c Mon Jul 24 14:17:22 2017 +0300 @@ -52,6 +52,7 @@ DEF(SET_BOOL, mail_nfs_index), DEF(SET_BOOL, mailbox_list_index), DEF(SET_BOOL, mailbox_list_index_very_dirty_syncs), + DEF(SET_BOOL, mailbox_list_index_include_inbox), DEF(SET_BOOL, mail_debug), DEF(SET_BOOL, mail_full_filesystem_access), DEF(SET_BOOL, maildir_stat_dirs), @@ -94,6 +95,7 @@ .mail_nfs_index = FALSE, .mailbox_list_index = FALSE, .mailbox_list_index_very_dirty_syncs = FALSE, + .mailbox_list_index_include_inbox = FALSE, .mail_debug = FALSE, .mail_full_filesystem_access = FALSE, .maildir_stat_dirs = FALSE,
--- a/src/lib-storage/mail-storage-settings.h Mon Jul 24 14:12:55 2017 +0300 +++ b/src/lib-storage/mail-storage-settings.h Mon Jul 24 14:17:22 2017 +0300 @@ -38,6 +38,7 @@ bool mail_nfs_index; bool mailbox_list_index; bool mailbox_list_index_very_dirty_syncs; + bool mailbox_list_index_include_inbox; bool mail_debug; bool mail_full_filesystem_access; bool maildir_stat_dirs;