From: Timo Sirainen Date: Thu, 1 Jul 2010 16:05:22 +0000 (+0100) Subject: dsync: If dsync fails in any way, don't increase mailboxes' next_uid/highestmodseq. X-Git-Tag: 2.0.rc1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d5f2ac9eea09966b31ae2ef94de4cf0b9ac9ff5;p=thirdparty%2Fdovecot%2Fcore.git dsync: If dsync fails in any way, don't increase mailboxes' next_uid/highestmodseq. --HG-- branch : HEAD --- 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)