]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: If dsync fails in any way, don't increase mailboxes' next_uid/highestmodseq.
authorTimo Sirainen <tss@iki.fi>
Thu, 1 Jul 2010 16:05:22 +0000 (17:05 +0100)
committerTimo Sirainen <tss@iki.fi>
Thu, 1 Jul 2010 16:05:22 +0000 (17:05 +0100)
--HG--
branch : HEAD

src/dsync/dsync-brain.c

index f453208da8c92da8d1979e9ba92cbb655ed8b043..dee06c4d9d685dab7a44dd070e128013cc86f6ac 100644 (file)
@@ -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)