dovecot: If we're modifying just one extension record, don't wri...

dovecot at dovecot.org dovecot at dovecot.org
Sat Jul 14 23:19:38 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/ac382879b116
changeset: 5992:ac382879b116
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jul 14 23:16:20 2007 +0300
description:
If we're modifying just one extension record, don't write the ext intro
twice.

diffstat:

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

diffs (33 lines):

diff -r 5dacddf4a88a -r ac382879b116 src/lib-index/mail-transaction-log-append.c
--- a/src/lib-index/mail-transaction-log-append.c	Sat Jul 14 23:15:54 2007 +0300
+++ b/src/lib-index/mail-transaction-log-append.c	Sat Jul 14 23:16:20 2007 +0300
@@ -13,6 +13,8 @@ struct log_append_context {
 	struct mail_transaction_log_file *file;
 	struct mail_index_transaction *trans;
 	buffer_t *output;
+
+	uint32_t last_ext_id, last_reset_id;
 
 	uint32_t first_append_size;
 	bool sync_includes_this;
@@ -222,7 +224,11 @@ static void log_append_ext_intro(struct 
 	if ((buf->used % 4) != 0)
 		buffer_append_zero(buf, 4 - (buf->used % 4));
 
-	log_append_buffer(ctx, buf, NULL, MAIL_TRANSACTION_EXT_INTRO);
+	if (ctx->last_ext_id != ext_id || intro->reset_id != ctx->last_reset_id)
+		log_append_buffer(ctx, buf, NULL, MAIL_TRANSACTION_EXT_INTRO);
+
+	ctx->last_ext_id = ext_id;
+	ctx->last_reset_id = intro->reset_id;
 }
 
 static void
@@ -486,6 +492,7 @@ mail_transaction_log_append_locked(struc
 	ctx.file = file;
 	ctx.trans = t;
 	ctx.output = buffer_create_dynamic(default_pool, 1024);
+	ctx.last_ext_id = (uint32_t)-1;
 
 	/* send all extension introductions and resizes before appends
 	   to avoid resize overhead as much as possible */


More information about the dovecot-cvs mailing list