changeset 21572:bd590ae82f96

lib-storage: Don't stop vsize calculation on expunged mails. I don't know why I added such logic there in the first place. If we just skip the expunged mails, the end result should still be correct and usable when cached.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Tue, 07 Feb 2017 13:53:52 +0200
parents 3538545077cb
children b2d7af4cdfd8
files src/lib-storage/index/index-mailbox-size.c
diffstat 1 files changed, 4 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-mailbox-size.c	Wed Feb 15 22:13:12 2017 +0200
+++ b/src/lib-storage/index/index-mailbox-size.c	Tue Feb 07 13:53:52 2017 +0200
@@ -235,8 +235,7 @@
 }
 
 static int
-index_mailbox_vsize_hdr_add_missing(struct mailbox_vsize_update *update,
-				    bool need_result)
+index_mailbox_vsize_hdr_add_missing(struct mailbox_vsize_update *update)
 {
 	struct mailbox_index_vsize *vsize_hdr = &update->vsize_hdr;
 	struct mailbox_transaction_context *trans;
@@ -275,14 +274,8 @@
 					 MAIL_FETCH_VIRTUAL_SIZE, NULL);
 	while (mailbox_search_next(search_ctx, &mail)) {
 		if (mail_get_virtual_size(mail, &vsize) < 0) {
-			if (mail->expunged) {
-				if (!need_result) {
-					ret = -1;
-					break;
-				}
-				index_mailbox_vsize_update_write(update);
+			if (mail->expunged)
 				continue;
-			}
 			ret = -1;
 			break;
 		}
@@ -325,7 +318,7 @@
 	   anyway internally even though we won't be saving the result. */
 	(void)index_mailbox_vsize_update_wait_lock(update);
 
-	ret = index_mailbox_vsize_hdr_add_missing(update, TRUE);
+	ret = index_mailbox_vsize_hdr_add_missing(update);
 	metadata_r->virtual_size = update->vsize_hdr.vsize;
 	index_mailbox_vsize_update_deinit(&update);
 	return ret;
@@ -402,6 +395,6 @@
 	if (update->vsize_hdr.highest_uid + 1 != status.uidnext &&
 	    index_mailbox_vsize_want_updates(update) &&
 	    index_mailbox_vsize_update_try_lock(update))
-		(void)index_mailbox_vsize_hdr_add_missing(update, FALSE);
+		(void)index_mailbox_vsize_hdr_add_missing(update);
 	index_mailbox_vsize_update_deinit(&update);
 }