dovecot-2.2: lib-index: Don't mark field decisions dirty when re...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 15 13:44:11 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/ac0170b8db14
changeset: 16358:ac0170b8db14
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 15 13:36:43 2013 +0300
description:
lib-index: Don't mark field decisions dirty when registering initial cache fields.

diffstat:

 src/lib-index/mail-cache-fields.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r f8b99f6d993c -r ac0170b8db14 src/lib-index/mail-cache-fields.c
--- a/src/lib-index/mail-cache-fields.c	Wed May 15 13:34:59 2013 +0300
+++ b/src/lib-index/mail-cache-fields.c	Wed May 15 13:36:43 2013 +0300
@@ -70,18 +70,26 @@
 			const struct mail_cache_field *newfield)
 {
 	struct mail_cache_field_private *orig;
+	bool initial_registering;
 
 	i_assert(newfield->type < MAIL_CACHE_FIELD_COUNT);
 
+	/* are we still doing the initial cache field registering for
+	   internal fields and for mail_*cache_fields settings? */
+	initial_registering = cache->file_fields_count == 0;
+
 	orig = &cache->fields[newfield->idx];
 	if ((newfield->decision & MAIL_CACHE_DECISION_FORCED) != 0 ||
-	    newfield->decision > orig->field.decision) {
+	    ((orig->field.decision & MAIL_CACHE_DECISION_FORCED) == 0 &&
+	     newfield->decision > orig->field.decision)) {
 		orig->field.decision = newfield->decision;
-		orig->decision_dirty = TRUE;
+		if (!initial_registering)
+			orig->decision_dirty = TRUE;
 	}
 	if (orig->field.last_used < newfield->last_used) {
 		orig->field.last_used = newfield->last_used;
-		orig->decision_dirty = TRUE;
+		if (!initial_registering)
+			orig->decision_dirty = TRUE;
 	}
 	if (orig->decision_dirty)
 		cache->field_header_write_pending = TRUE;


More information about the dovecot-cvs mailing list