From 8bc0825d97e94ad744c161dacc2fa15f7f3c14c5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 21 Feb 2022 23:07:11 +0100 Subject: [PATCH] dsync: If modseqs aren't permanent, assume HIGHESTMODSEQ=0 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 | 4 ++++ src/doveadm/dsync/dsync-mailbox-import.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/doveadm/dsync/dsync-brain-mailbox.c b/src/doveadm/dsync/dsync-brain-mailbox.c index 69363e5c27..ff15c3c738 100644 --- a/src/doveadm/dsync/dsync-brain-mailbox.c +++ b/src/doveadm/dsync/dsync-brain-mailbox.c @@ -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); diff --git a/src/doveadm/dsync/dsync-mailbox-import.c b/src/doveadm/dsync/dsync-mailbox-import.c index 77552ebb76..8a8fbe427d 100644 --- a/src/doveadm/dsync/dsync-mailbox-import.c +++ b/src/doveadm/dsync/dsync-mailbox-import.c @@ -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; -- 2.47.3