changeset 12640:19ffd1889f40

lib-index: Avoid writing tail offset unnecessarily to transaction log file. This could have happened with MAIL_INDEX_TRANSACTION_FLAG_AVOID_FLAG_UPDATES when all flag updates were cancelled and no other changes were done.
author Timo Sirainen <tss@iki.fi>
date Tue, 08 Feb 2011 00:08:38 +0200
parents 96c284f7548f
children ad002fdc6a6c
files src/lib-index/mail-transaction-log-append.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-append.c	Tue Feb 08 00:06:28 2011 +0200
+++ b/src/lib-index/mail-transaction-log-append.c	Tue Feb 08 00:08:38 2011 +0200
@@ -149,6 +149,13 @@
 	unsigned char update_data[sizeof(*u) + sizeof(offset)];
 
 	if (file->max_tail_offset == file->sync_offset) {
+		if (ctx->output->used == 0 &&
+		    file->saved_tail_offset == file->max_tail_offset) {
+			/* nothing to write here after all (e.g. all unchanged
+			   flag updates were dropped by export) */
+			return;
+		}
+
 		/* FIXME: when we remove exclusive log locking, we
 		   can't rely on this. then write non-changed offset + check
 		   real offset + rewrite the new offset if other transactions