]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: If modseqs aren't permanent, assume HIGHESTMODSEQ=0
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 21 Feb 2022 22:07:11 +0000 (23:07 +0100)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 28 Feb 2022 13:47:54 +0000 (15:47 +0200)
Otherwise the HIGHESTMODSEQ is just whatever happens to be in the in-memory
view of the index, which most likely isn't the true HIGHESTMODSEQ. Using 0
makes it clear that the HIGHESTMODSEQ isn't valid and can't be used.

src/doveadm/dsync/dsync-brain-mailbox.c
src/doveadm/dsync/dsync-mailbox-import.c

index 69363e5c27ca180c8b60383b5c9771b3b017369b..ff15c3c738b2a3be66458bfba45a087ca1ee9255 100644 (file)
@@ -276,6 +276,8 @@ int dsync_brain_sync_mailbox_open(struct dsync_brain *brain,
        mailbox_get_open_status(brain->box, STATUS_UIDNEXT |
                                STATUS_HIGHESTMODSEQ |
                                STATUS_HIGHESTPVTMODSEQ, &status);
+       if (status.nonpermanent_modseqs)
+               status.highest_modseq = 0;
        if (ret == 0) {
                if (pvt_too_old) {
                        desync_reason = t_strdup_printf(
@@ -426,6 +428,8 @@ static int dsync_box_get(struct mailbox *box, struct dsync_mailbox *dsync_box_r,
                *error_r = error;
                return -1;
        }
+       if (status.nonpermanent_modseqs)
+               status.highest_modseq = 0;
 
        i_assert(status.uidvalidity != 0 || status.messages == 0);
 
index 77552ebb76ea9062d3da6a5012b1ad6035d12b3a..8a8fbe427dc6ed1773e91741a47d9dc4266e1e69 100644 (file)
@@ -304,6 +304,8 @@ dsync_mailbox_import_init(struct mailbox *box,
        mailbox_get_open_status(importer->box, STATUS_UIDNEXT |
                                STATUS_HIGHESTMODSEQ | STATUS_HIGHESTPVTMODSEQ,
                                &status);
+       if (status.nonpermanent_modseqs)
+               status.highest_modseq = 0;
        importer->local_uid_next = status.uidnext;
        importer->local_initial_highestmodseq = status.highest_modseq;
        importer->local_initial_highestpvtmodseq = status.highest_pvt_modseq;