dovecot-2.2: dsync: If we notice that incremental sync won't wor...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 2 16:32:17 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/36d07c48049f
changeset: 17311:36d07c48049f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 02 19:31:49 2014 +0300
description:
dsync: If we notice that incremental sync won't work, don't continue doing it.

diffstat:

 src/doveadm/dsync/dsync-brain-mailbox.c |  22 +++++++++++++---------
 src/doveadm/dsync/dsync-brain-mails.c   |   3 +++
 2 files changed, 16 insertions(+), 9 deletions(-)

diffs (75 lines):

diff -r 3ecb2b831402 -r 36d07c48049f src/doveadm/dsync/dsync-brain-mailbox.c
--- a/src/doveadm/dsync/dsync-brain-mailbox.c	Fri May 02 15:43:30 2014 +0300
+++ b/src/doveadm/dsync/dsync-brain-mailbox.c	Fri May 02 19:31:49 2014 +0300
@@ -236,6 +236,14 @@
 			ret = 0;
 		}
 	}
+	if (ret == 0) {
+		i_warning("Failed to do incremental sync for mailbox %s, "
+			  "retry with a full sync",
+			  mailbox_get_vname(brain->box));
+		brain->changes_during_sync = TRUE;
+		brain->require_full_resync = TRUE;
+		return 0;
+	}
 
 	if (!brain->mail_requests)
 		exporter_flags |= DSYNC_MAILBOX_EXPORTER_FLAG_AUTO_EXPORT_MAILS;
@@ -249,14 +257,6 @@
 					  last_common_uid,
 					  exporter_flags);
 	dsync_brain_sync_mailbox_init_remote(brain, remote_dsync_box);
-	if (ret == 0) {
-		i_warning("Failed to do incremental sync for mailbox %s, "
-			  "retry with a full sync",
-			  mailbox_get_vname(brain->box));
-		brain->changes_during_sync = TRUE;
-		brain->require_full_resync = TRUE;
-		return 0;
-	}
 	return 1;
 }
 
@@ -714,7 +714,6 @@
 	i_assert(local_dsync_box.uid_validity != 0);
 	i_assert(memcmp(dsync_box->mailbox_guid, local_dsync_box.mailbox_guid,
 			sizeof(dsync_box->mailbox_guid)) == 0);
-	dsync_ibc_send_mailbox(brain->ibc, &local_dsync_box);
 
 	resync = !dsync_brain_mailbox_update_pre(brain, box, &local_dsync_box,
 						 dsync_box);
@@ -726,6 +725,7 @@
 				brain->master_brain ? 'M' : 'S',
 				guid_128_to_string(dsync_box->mailbox_guid));
 		}
+		dsync_ibc_send_mailbox(brain->ibc, &local_dsync_box);
 		mailbox_free(&box);
 		return TRUE;
 	}
@@ -737,8 +737,12 @@
 	if (ret == 0 || resync) {
 		brain->changes_during_sync = TRUE;
 		brain->require_full_resync = TRUE;
+		dsync_brain_sync_mailbox_deinit(brain);
+		dsync_brain_slave_send_mailbox_lost(brain, dsync_box);
+		return TRUE;
 	}
 
+	dsync_ibc_send_mailbox(brain->ibc, &local_dsync_box);
 	brain->state = DSYNC_STATE_SYNC_MAILS;
 	return TRUE;
 }
diff -r 3ecb2b831402 -r 36d07c48049f src/doveadm/dsync/dsync-brain-mails.c
--- a/src/doveadm/dsync/dsync-brain-mails.c	Fri May 02 15:43:30 2014 +0300
+++ b/src/doveadm/dsync/dsync-brain-mails.c	Fri May 02 19:31:49 2014 +0300
@@ -62,6 +62,9 @@
 	if (ret == 0 || resync) {
 		brain->changes_during_sync = TRUE;
 		brain->require_full_resync = TRUE;
+		brain->failed = TRUE;
+		dsync_brain_sync_mailbox_deinit(brain);
+		return TRUE;
 	}
 	dsync_brain_sync_init_box_states(brain);
 	return TRUE;


More information about the dovecot-cvs mailing list