Mercurial > dovecot > core-2.2
changeset 22468:01f841c0febb
lib-storage: Preserve messages' vsize record when rebuilding index
Since vsize is often used by quota, losing this can be very expensive.
If the vsize is wrong, it gets fixed automatically when fetching the
message body.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 08 Sep 2017 12:20:21 +0300 |
parents | d4274c2f8468 |
children | 4b1e95fa17e8 |
files | src/lib-storage/index/index-rebuild.c |
diffstat | 1 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-rebuild.c Fri Aug 25 15:12:06 2017 +0300 +++ b/src/lib-storage/index/index-rebuild.c Fri Sep 08 12:20:21 2017 +0300 @@ -9,6 +9,22 @@ #include "index-rebuild.h" static void +index_index_copy_vsize(struct index_rebuild_context *ctx, + struct mail_index_view *view, + uint32_t old_seq, uint32_t new_seq) +{ + const void *data; + bool expunged; + + mail_index_lookup_ext(view, old_seq, ctx->box->mail_vsize_ext_id, + &data, &expunged); + if (data != NULL && !expunged) { + mail_index_update_ext(ctx->trans, new_seq, + ctx->box->mail_vsize_ext_id, data, NULL); + } +} + +static void index_index_copy_cache(struct index_rebuild_context *ctx, struct mail_index_view *view, uint32_t old_seq, uint32_t new_seq) @@ -70,6 +86,7 @@ modseq = mail_index_modseq_lookup(view, old_seq); mail_index_update_modseq(ctx->trans, new_seq, modseq); + index_index_copy_vsize(ctx, view, old_seq, new_seq); index_index_copy_cache(ctx, view, old_seq, new_seq); }