From: Timo Sirainen Date: Tue, 17 Jun 2008 01:51:23 +0000 (+0300) Subject: Update sync_highest_modseq while appending new transactions. X-Git-Tag: 1.2.alpha1~320 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d67c6dc68cdb90b53434a25ead1590650e4d84e7;p=thirdparty%2Fdovecot%2Fcore.git Update sync_highest_modseq while appending new transactions. Our own transaction commits --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-transaction-log-append.c b/src/lib-index/mail-transaction-log-append.c index f45f08f926..ed4b965ba9 100644 --- a/src/lib-index/mail-transaction-log-append.c +++ b/src/lib-index/mail-transaction-log-append.c @@ -14,6 +14,7 @@ struct log_append_context { struct mail_index_transaction *trans; buffer_t *output; + unsigned int modseq_change_count; uint32_t first_append_size; bool sync_includes_this; }; @@ -39,6 +40,9 @@ static void log_append_buffer(struct log_append_context *ctx, if ((ctx->trans->flags & MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL) != 0) hdr.type |= MAIL_TRANSACTION_EXTERNAL; + if (mail_transaction_header_has_modseq(&hdr)) + ctx->modseq_change_count++; + hdr_size = mail_index_uint32_to_offset(sizeof(hdr) + buf->used + (hdr_buf == NULL ? 0 : hdr_buf->used)); @@ -566,8 +570,7 @@ mail_transaction_log_append_locked(struct mail_index_transaction *t, file = log->head; - if (file->sync_offset < file->buffer_offset) - file->sync_offset = file->buffer_offset; + i_assert(file->sync_offset >= file->buffer_offset); memset(&ctx, 0, sizeof(ctx)); ctx.file = file; @@ -646,6 +649,7 @@ mail_transaction_log_append_locked(struct mail_index_transaction *t, buffer_free(&ctx.output); return -1; } + file->sync_highest_modseq += ctx.modseq_change_count; buffer_free(&ctx.output); if ((t->flags & MAIL_INDEX_TRANSACTION_FLAG_HIDE) != 0) {