From: Timo Sirainen Date: Thu, 28 Nov 2019 17:38:10 +0000 (+0200) Subject: lazy-expunge: Add MAIL_FETCH_REFCOUNT to mail's wanted_fields X-Git-Tag: 2.3.10~119 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=782a16de6cfac2f9a242a00b74ea2b8073fda14f;p=thirdparty%2Fdovecot%2Fcore.git lazy-expunge: Add MAIL_FETCH_REFCOUNT to mail's wanted_fields The mail is reused by the search query, so the next mail_prefetch() can try to prefetch the refcount. --- diff --git a/src/plugins/lazy-expunge/lazy-expunge-plugin.c b/src/plugins/lazy-expunge/lazy-expunge-plugin.c index 970129184b..7bdf507ac4 100644 --- a/src/plugins/lazy-expunge/lazy-expunge-plugin.c +++ b/src/plugins/lazy-expunge/lazy-expunge-plugin.c @@ -184,12 +184,17 @@ lazy_expunge_count_in_transaction(struct lazy_expunge_transaction *lt, static int lazy_expunge_mail_is_last_instance(struct mail *_mail) { + struct mail_private *mail = (struct mail_private *)_mail; struct lazy_expunge_transaction *lt = LAZY_EXPUNGE_CONTEXT_REQUIRE(_mail->transaction); const char *value, *errstr; unsigned long refcount; enum mail_error error; + /* mail is reused by the search query, so the next mail_prefetch() on + it will try to prefetch the refcount */ + mail->wanted_fields |= MAIL_FETCH_REFCOUNT; + if (mail_get_special(_mail, MAIL_FETCH_REFCOUNT, &value) < 0) { errstr = mailbox_get_last_internal_error(_mail->box, &error); if (error == MAIL_ERROR_EXPUNGED) {