]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lazy-expunge: Track duplicate messages using REFCOUNT_ID rather than GUID
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 28 Nov 2019 18:30:08 +0000 (20:30 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 10 Jan 2020 07:15:27 +0000 (07:15 +0000)
Although these are usually the same, that's not really guaranteed.
Also REFCOUNT_ID can be more efficient to lookup than GUID.

src/plugins/lazy-expunge/lazy-expunge-plugin.c

index c2b65b339bba881958d6db44d7c30e3546a069af..970129184b0819ab08a86083e0c90b150878a6bb 100644 (file)
@@ -214,22 +214,22 @@ static int lazy_expunge_mail_is_last_instance(struct mail *_mail)
                   multiple times and we're deleting more than one instance
                   within this transaction. in those cases each expunge will
                   see the same refcount, so we need to adjust the refcount
-                  by tracking the expunged message GUIDs. */
-               if (mail_get_special(_mail, MAIL_FETCH_GUID, &value) < 0) {
+                  by tracking the expunged message's refcount IDs. */
+               if (mail_get_special(_mail, MAIL_FETCH_REFCOUNT_ID, &value) < 0) {
                        errstr = mailbox_get_last_internal_error(_mail->box, &error);
                        if (error == MAIL_ERROR_EXPUNGED) {
                                /* already expunged - just ignore it */
                                return 0;
                        }
                        mail_set_critical(_mail,
-                               "lazy_expunge: Couldn't lookup message's GUID: %s", errstr);
+                               "lazy_expunge: Couldn't lookup message's refcount ID: %s", errstr);
                        return -1;
                }
                if (*value == '\0') {
-                       /* GUIDs not supported by backend, but refcounts are?
-                          not with our current backends. */
+                       /* refcount IDs not supported by backend, but refcounts
+                          are? not with our current backends. */
                        mail_set_critical(_mail,
-                               "lazy_expunge: Message unexpectedly has no GUID");
+                               "lazy_expunge: Message unexpectedly has no refcount ID");
                        return -1;
                }
                refcount -= lazy_expunge_count_in_transaction(lt, value);