Mercurial > dovecot > core-2.2
diff src/lib-storage/index/dbox-common/dbox-sync-rebuild.c @ 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 | aed3379df476 |
children | ba770cba5598 |
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);