From 9d5f2ac9eea09966b31ae2ef94de4cf0b9ac9ff5 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 1 Jul 2010 17:05:22 +0100 Subject: [PATCH] dsync: If dsync fails in any way, don't increase mailboxes' next_uid/highestmodseq. --HG-- branch : HEAD --- src/dsync/dsync-brain.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dsync/dsync-brain.c b/src/dsync/dsync-brain.c index f453208da8..dee06c4d9d 100644 --- a/src/dsync/dsync-brain.c +++ b/src/dsync/dsync-brain.c @@ -693,13 +693,20 @@ static void dsync_brain_sync_update_mailboxes(struct dsync_brain *brain) { const struct dsync_brain_mailbox *mailbox; + bool failed_changes = dsync_brain_has_unexpected_changes(brain); array_foreach(&brain->mailbox_sync->mailboxes, mailbox) { - if (!brain->backup) { + /* don't update mailboxes if any changes had failed. + for example if some messages couldn't be saved, we don't + want to increase the next_uid to jump over them */ + if (!brain->backup && !failed_changes) { dsync_worker_update_mailbox(brain->src_worker, &mailbox->box); } - dsync_worker_update_mailbox(brain->dest_worker, &mailbox->box); + if (!failed_changes) { + dsync_worker_update_mailbox(brain->dest_worker, + &mailbox->box); + } if (mailbox->src != NULL && mailbox->dest != NULL && strcmp(mailbox->src->name, mailbox->dest->name) != 0) -- 2.47.3