]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Avoid writing tail offset unnecessarily to transaction log file.
authorTimo Sirainen <tss@iki.fi>
Mon, 7 Feb 2011 22:08:38 +0000 (00:08 +0200)
committerTimo Sirainen <tss@iki.fi>
Mon, 7 Feb 2011 22:08:38 +0000 (00:08 +0200)
This could have happened with MAIL_INDEX_TRANSACTION_FLAG_AVOID_FLAG_UPDATES
when all flag updates were cancelled and no other changes were done.

src/lib-index/mail-transaction-log-append.c

index d850c51b6fb4feabb27a2ea76b6bd487ec1f9dd1..83176b4b38e26aec820504248e572a46bd2311d4 100644 (file)
@@ -149,6 +149,13 @@ log_append_sync_offset_if_needed(struct mail_transaction_log_append_ctx *ctx)
        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