From: Timo Sirainen Date: Sat, 6 Mar 2010 11:11:07 +0000 (+0200) Subject: dbox index rebuild: Fixed setting next-uid and highest-modseq. X-Git-Tag: 2.0.beta4~124 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a91f9710495d5558eae4d09be2a0651802df8468;p=thirdparty%2Fdovecot%2Fcore.git dbox index rebuild: Fixed setting next-uid and highest-modseq. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c b/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c index 98d3608f31..65d8a05c5c 100644 --- a/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c +++ b/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c @@ -92,7 +92,10 @@ void dbox_sync_rebuild_index_metadata(struct dbox_sync_rebuild_context *ctx, 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 @@ static void dbox_sync_rebuild_header(struct dbox_sync_rebuild_context *ctx) 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 *