dovecot-2.2: dsync: Mailbox syncing fix

dovecot at dovecot.org dovecot at dovecot.org
Wed Jan 9 09:11:14 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/b338c4a08f42
changeset: 15618:b338c4a08f42
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jan 09 09:11:09 2013 +0200
description:
dsync: Mailbox syncing fix

diffstat:

 src/doveadm/dsync/dsync-mailbox-import.c |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (43 lines):

diff -r 2c4394d0360b -r b338c4a08f42 src/doveadm/dsync/dsync-mailbox-import.c
--- a/src/doveadm/dsync/dsync-mailbox-import.c	Wed Jan 09 07:53:53 2013 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-import.c	Wed Jan 09 09:11:09 2013 +0200
@@ -1076,6 +1076,7 @@
 {
 	struct importer_new_mail *newmail, *const *newmailp;
 	uint32_t common_uid_next, new_uid;
+	bool linked_uid;
 
 	common_uid_next = I_MAX(importer->local_uid_next,
 				importer->remote_uid_next);
@@ -1094,19 +1095,28 @@
 		if (newmail->uid_is_usable) {
 			/* keep the UID */
 			new_uid = newmail->uid;
+			linked_uid = FALSE;
 		} else if (newmail->link != NULL &&
-			 newmail->link->uid_is_usable)
+			   newmail->link->uid_is_usable) {
 			new_uid = newmail->link->uid;
-		else
+			linked_uid = TRUE;
+		} else {
 			new_uid = common_uid_next++;
+			linked_uid = FALSE;
+		}
 
 		if (newmail->uid_in_local && newmail->uid != new_uid) {
 			/* local UID changed, reassign it by copying */
 			dsync_msg_update_uid(importer, newmail->uid, new_uid);
+		} else if (linked_uid && newmail->link->uid_in_local) {
+			/* the linked message already exists. we'll just need
+			   to forget about this message. */
+			i_assert(!newmail->uid_in_local);
+			newmail->skip = TRUE;
 		}
 		newmail->uid = new_uid;
 
-		if (newmail->link != NULL) {
+		if (newmail->link != NULL && !newmail->skip) {
 			/* skip the linked mail */
 			newmail->link->skip = TRUE;
 		}


More information about the dovecot-cvs mailing list