dovecot-1.2: Update sync_highest_modseq while appending new tran...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 17 04:51:52 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/38cb76c22dc5
changeset: 7841:38cb76c22dc5
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jun 17 04:51:23 2008 +0300
description:
Update sync_highest_modseq while appending new transactions.
Our own transaction commits

diffstat:

1 file changed, 6 insertions(+), 2 deletions(-)
src/lib-index/mail-transaction-log-append.c |    8 ++++++--

diffs (39 lines):

diff -r dbfa021f8985 -r 38cb76c22dc5 src/lib-index/mail-transaction-log-append.c
--- 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 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;
 };
@@ -38,6 +39,9 @@ static void log_append_buffer(struct log
 		hdr.type |= MAIL_TRANSACTION_EXPUNGE_PROT;
 	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 :
@@ -566,8 +570,7 @@ mail_transaction_log_append_locked(struc
 
 	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(struc
 		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) {


More information about the dovecot-cvs mailing list