From: Timo Sirainen Date: Mon, 7 Feb 2011 22:08:38 +0000 (+0200) Subject: lib-index: Avoid writing tail offset unnecessarily to transaction log file. X-Git-Tag: 2.1.alpha1~365 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f430e257605b2fd2b54cdf4c2a20ef8b53cf0ba;p=thirdparty%2Fdovecot%2Fcore.git 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. --- diff --git a/src/lib-index/mail-transaction-log-append.c b/src/lib-index/mail-transaction-log-append.c index d850c51b6f..83176b4b38 100644 --- a/src/lib-index/mail-transaction-log-append.c +++ b/src/lib-index/mail-transaction-log-append.c @@ -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