Mercurial > dovecot > core-2.2
changeset 14084:d8d214cc1936
dbox: Index rebuild now preserves caching decisions.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 09 Feb 2012 01:23:00 +0200 |
parents | 21c3ce1b21cd |
children | 69bb267956a2 |
files | src/lib-storage/index/dbox-common/dbox-sync-rebuild.c src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c |
diffstat | 3 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c Thu Feb 09 01:21:41 2012 +0200 +++ b/src/lib-storage/index/dbox-common/dbox-sync-rebuild.c Thu Feb 09 01:23:00 2012 +0200 @@ -2,6 +2,7 @@ #include "lib.h" #include "array.h" +#include "mail-cache.h" #include "mail-index-modseq.h" #include "mailbox-list-private.h" #include "index-storage.h" @@ -159,6 +160,12 @@ index_mailbox_reset_uidvalidity(box); mail_index_ext_lookup(box->index, "cache", &ctx->cache_ext_id); + /* open cache and read the caching decisions. we'll reset the cache in + case it contains any invalid data, but we want to preserve the + decisions. */ + (void)mail_cache_open_and_verify(ctx->box->cache); + mail_cache_reset(box->cache); + /* if backup index file exists, try to use it */ index_dir = mailbox_list_get_path(box->list, box->name, MAILBOX_LIST_PATH_TYPE_INDEX); @@ -183,6 +190,9 @@ struct dbox_sync_rebuild_context *ctx = *_ctx; *_ctx = NULL; + + /* initialize cache file with the old field decisions */ + (void)mail_cache_compress(ctx->box->cache, ctx->trans); dbox_sync_rebuild_header(ctx); if (ctx->backup_index != NULL) { mail_index_view_close(&ctx->backup_view);
--- a/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Thu Feb 09 01:21:41 2012 +0200 +++ b/src/lib-storage/index/dbox-multi/mdbox-storage-rebuild.c Thu Feb 09 01:23:00 2012 +0200 @@ -501,9 +501,6 @@ return -1; } - /* reset cache, just in case it contains invalid data */ - mail_cache_reset(box->cache); - rebuild_ctx = dbox_sync_index_rebuild_init(&mbox->box, view, trans); mdbox_header_update(rebuild_ctx, mbox); rebuild_mailbox_multi(ctx, rebuild_ctx, mbox, view, trans);
--- a/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c Thu Feb 09 01:21:41 2012 +0200 +++ b/src/lib-storage/index/dbox-single/sdbox-sync-rebuild.c Thu Feb 09 01:23:00 2012 +0200 @@ -195,8 +195,6 @@ return -1; } - mail_cache_reset(mbox->box.cache); - view = mail_index_view_open(mbox->box.index); trans = mail_index_transaction_begin(view, MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL);