dovecot-2.0: dsync: If dsync fails in any way, don't increase ma...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 1 19:05:25 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/b4f029f7793a
changeset: 11677:b4f029f7793a
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jul 01 17:05:22 2010 +0100
description:
dsync: If dsync fails in any way, don't increase mailboxes' next_uid/highestmodseq.

diffstat:

 src/dsync/dsync-brain.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r cf7f6912af02 -r b4f029f7793a src/dsync/dsync-brain.c
--- a/src/dsync/dsync-brain.c	Thu Jul 01 17:02:20 2010 +0100
+++ b/src/dsync/dsync-brain.c	Thu Jul 01 17:05:22 2010 +0100
@@ -693,13 +693,20 @@
 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)


More information about the dovecot-cvs mailing list