Skip to content

Commit

Permalink
lib-storage: Don't enforce creation of vsize header.
Browse files Browse the repository at this point in the history
It's useful for caching quota=count and for STATUS (X-SIZE). If neither is
used the header shouldn't be created and kept up-to-date. If the header is
enabled, it also triggers creation of per-email vsize records.
  • Loading branch information
sirainen committed Jun 4, 2018
1 parent f1242f8 commit cf747d6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib-storage/index/index-mailbox-size.c
Expand Up @@ -46,6 +46,7 @@ struct mailbox_vsize_update {

struct file_lock *lock;
bool lock_failed;
bool skip_write;
bool rebuild;
bool written;
bool finish_in_background;
Expand Down Expand Up @@ -223,7 +224,7 @@ void index_mailbox_vsize_update_deinit(struct mailbox_vsize_update **_update)

*_update = NULL;

if (update->lock != NULL || update->rebuild)
if ((update->lock != NULL || update->rebuild) && !update->skip_write)
index_mailbox_vsize_update_write(update);
file_lock_free(&update->lock);
if (update->finish_in_background)
Expand Down Expand Up @@ -445,6 +446,10 @@ void index_mailbox_vsize_update_appends(struct mailbox *box)
struct mailbox_status status;

update = index_mailbox_vsize_update_init(box);
if (update->rebuild) {
/* The vsize header doesn't exist. Don't create it. */
update->skip_write = TRUE;
}

/* update here only if we don't need to rebuild the whole vsize. */
index_mailbox_vsize_check_rebuild(update);
Expand Down

0 comments on commit cf747d6

Please sign in to comment.