dovecot-2.0: dbox index rebuild: Fixed setting next-uid and high...

dovecot at dovecot.org dovecot at dovecot.org
Sat Mar 6 13:11:15 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/3bfb1e9f556b
changeset: 10844:3bfb1e9f556b
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Mar 06 13:11:07 2010 +0200
description:
dbox index rebuild: Fixed setting next-uid and highest-modseq.

diffstat:

 src/lib-storage/index/dbox-common/dbox-sync-rebuild.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r e3672e7c0f9f -r 3bfb1e9f556b src/lib-storage/index/dbox-common/dbox-sync-rebuild.c
--- a/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c	Sat Mar 06 12:52:59 2010 +0200
+++ b/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c	Sat Mar 06 13:11:07 2010 +0200
@@ -92,7 +92,10 @@
 static void dbox_sync_rebuild_header(struct dbox_sync_rebuild_context *ctx)
 {
 	const struct mail_index_header *hdr, *backup_hdr;
+	struct mail_index *index = mail_index_view_get_index(ctx->view);
+	struct mail_index_modseq_header modseq_hdr;
 	uint32_t uid_validity, next_uid;
+	uint64_t modseq;
 
 	hdr = mail_index_get_header(ctx->view);
 	backup_hdr = ctx->backup_view == NULL ? NULL :
@@ -118,16 +121,18 @@
 		next_uid = dbox_get_uidvalidity_next(ctx->box->list);
 	mail_index_update_header(ctx->trans,
 				 offsetof(struct mail_index_header, next_uid),
-				 &next_uid, sizeof(next_uid), TRUE);
+				 &next_uid, sizeof(next_uid), FALSE);
 
 	/* set highest-modseq */
-	mail_index_update_highest_modseq(ctx->trans,
-		mail_index_modseq_get_highest(ctx->view));
+	memset(&modseq_hdr, 0, sizeof(modseq_hdr));
+	modseq_hdr.highest_modseq = mail_index_modseq_get_highest(ctx->view);
 	if (ctx->backup_view != NULL) {
-		mail_index_update_highest_modseq(ctx->trans,
-			mail_index_modseq_get_highest(ctx->backup_view));
-
+		modseq = mail_index_modseq_get_highest(ctx->backup_view);
+		if (modseq_hdr.highest_modseq < modseq)
+			modseq_hdr.highest_modseq = modseq;
 	}
+	mail_index_update_header_ext(ctx->trans, index->modseq_ext_id,
+				     0, &modseq_hdr, sizeof(modseq_hdr));
 }
 
 struct dbox_sync_rebuild_context *


More information about the dovecot-cvs mailing list