]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Copy vsize record even when destination mailbox doesn't have it
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 22 Oct 2019 16:59:43 +0000 (19:59 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 23 Oct 2019 15:10:08 +0000 (18:10 +0300)
It's almost guaranteed that if the source mailbox has vsize then we want the
destination mailbox to also have it. This condition now happens mainly when
copying mails to a newly created mailbox where the vsize lookups haven't
occurred yet. It's better to do this immediately to avoid unnecessarily slow
lookups later on.

src/lib-storage/index/index-storage.c

index 49ff5557191745dc34017b579ed9d55c4ddc11f9..8ca20cf305c4fdb2b2376dd605caf9dc37bbb8be 100644 (file)
@@ -1015,7 +1015,6 @@ static void
 index_copy_vsize_extension(struct mail_save_context *ctx,
                           struct mail *src_mail, uint32_t dest_seq)
 {
-       unsigned int idx;
        const uint32_t *vsizep;
        bool expunged ATTR_UNUSED;
 
@@ -1024,11 +1023,8 @@ index_copy_vsize_extension(struct mail_save_context *ctx,
                return;
        uint32_t vsize = *vsizep;
 
-       if (mail_index_map_get_ext_idx(ctx->transaction->view->map,
-                                      ctx->transaction->box->mail_vsize_ext_id,
-                                      &idx) &&
-           vsize < (uint32_t)-1) {
-               uint32_t vsize = src_imail->data.virtual_size+1;
+       if (vsize < (uint32_t)-1) {
+               /* copy the vsize record to the destination index */
                mail_index_update_ext(ctx->transaction->itrans, dest_seq,
                                      ctx->transaction->box->mail_vsize_ext_id,
                                      &vsize, NULL);