changeset 7841:38cb76c22dc5 HEAD

Update sync_highest_modseq while appending new transactions. Our own transaction commits
author Timo Sirainen <tss@iki.fi>
date Tue, 17 Jun 2008 04:51:23 +0300
parents dbfa021f8985
children 6480642aba24
files src/lib-index/mail-transaction-log-append.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log-append.c	Tue Jun 17 04:47:17 2008 +0300
+++ b/src/lib-index/mail-transaction-log-append.c	Tue Jun 17 04:51:23 2008 +0300
@@ -14,6 +14,7 @@
 	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 @@
 	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 @@
 
 	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 @@
 		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) {