dovecot-2.1: lib-storage: Added MAILBOX_TRANSACTION_FLAG_NO_CACH...

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 16 16:59:32 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/5320315600a4
changeset: 13472:5320315600a4
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Aug 30 04:32:55 2011 +0300
description:
lib-storage: Added MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC and use it when precaching.
The result is that "doveadm index" no longer changes caching decisions.

diffstat:

 src/lib-storage/index/index-sync.c        |  2 +-
 src/lib-storage/index/index-transaction.c |  3 +++
 src/lib-storage/mail-storage.h            |  5 ++++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diffs (40 lines):

diff -r efedf0644da8 -r 5320315600a4 src/lib-storage/index/index-sync.c
--- a/src/lib-storage/index/index-sync.c	Tue Aug 30 04:31:00 2011 +0300
+++ b/src/lib-storage/index/index-sync.c	Tue Aug 30 04:32:55 2011 +0300
@@ -392,7 +392,7 @@
 	}
 
 	/* find the first message we need to index */
-	trans = mailbox_transaction_begin(box, 0);
+	trans = mailbox_transaction_begin(box, MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC);
 	mail = mail_alloc(trans, 0, NULL);
 	for (seq = status->messages; seq > 0; seq--) {
 		mail_set_seq(mail, seq);
diff -r efedf0644da8 -r 5320315600a4 src/lib-storage/index/index-transaction.c
--- a/src/lib-storage/index/index-transaction.c	Tue Aug 30 04:31:00 2011 +0300
+++ b/src/lib-storage/index/index-transaction.c	Tue Aug 30 04:32:55 2011 +0300
@@ -91,6 +91,9 @@
 	t->cache_view = it->cache_view;
 	t->cache_trans = it->cache_trans;
 
+	if ((flags & MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC) != 0)
+		mail_cache_view_update_cache_decisions(t->cache_view, FALSE);
+
 	/* set up after mail_cache_get_transaction(), so that we'll still
 	   have the cache_trans available in _index_commit() */
 	it->super = t->itrans->v;
diff -r efedf0644da8 -r 5320315600a4 src/lib-storage/mail-storage.h
--- a/src/lib-storage/mail-storage.h	Tue Aug 30 04:31:00 2011 +0300
+++ b/src/lib-storage/mail-storage.h	Tue Aug 30 04:32:55 2011 +0300
@@ -140,7 +140,10 @@
 	   is done only if it can be done easily. */
 	MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS	= 0x04,
 	/* Refresh the index so lookups return latest flags/modseqs */
-	MAILBOX_TRANSACTION_FLAG_REFRESH	= 0x08
+	MAILBOX_TRANSACTION_FLAG_REFRESH	= 0x08,
+	/* Don't update caching decisions no matter what we do in this
+	   transaction (useful for e.g. precaching) */
+	MAILBOX_TRANSACTION_FLAG_NO_CACHE_DEC	= 0x10
 };
 
 enum mailbox_sync_flags {


More information about the dovecot-cvs mailing list