Mercurial > dovecot > core-2.2
changeset 11026:cf302ede55bc HEAD
dbox: When rebuilding index, don't try to shrink next_uid.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 04 Apr 2010 23:12:00 +0300 |
parents | 1e118fd825c7 |
children | 60a25bda7e02 |
files | src/lib-storage/index/dbox-common/dbox-sync-rebuild.c |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c Sun Apr 04 23:02:12 2010 +0300 +++ b/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c Sun Apr 04 23:12:00 2010 +0300 @@ -91,15 +91,18 @@ static void dbox_sync_rebuild_header(struct dbox_sync_rebuild_context *ctx) { - const struct mail_index_header *hdr, *backup_hdr; + const struct mail_index_header *hdr, *backup_hdr, *trans_hdr; struct mail_index *index = mail_index_view_get_index(ctx->view); struct mail_index_modseq_header modseq_hdr; + struct mail_index_view *trans_view; uint32_t uid_validity, next_uid; uint64_t modseq; hdr = mail_index_get_header(ctx->view); backup_hdr = ctx->backup_view == NULL ? NULL : mail_index_get_header(ctx->backup_view); + trans_view = mail_index_transaction_open_updated_view(ctx->trans); + trans_hdr = mail_index_get_header(trans_view); /* set uidvalidity */ if (hdr->uid_validity != 0) @@ -119,9 +122,11 @@ next_uid = backup_hdr->next_uid; else 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), FALSE); + if (next_uid > trans_hdr->next_uid) { + mail_index_update_header(ctx->trans, + offsetof(struct mail_index_header, next_uid), + &next_uid, sizeof(next_uid), FALSE); + } /* set highest-modseq */ memset(&modseq_hdr, 0, sizeof(modseq_hdr)); @@ -133,6 +138,7 @@ } mail_index_update_header_ext(ctx->trans, index->modseq_ext_id, 0, &modseq_hdr, sizeof(modseq_hdr)); + mail_index_view_close(&trans_view); } struct dbox_sync_rebuild_context *