changeset 21203:63989e9ddf0c

dsync: Do not try replace remote folder GUID when doing oneway sync Oneway sync tried to replace remote folder's GUID when running in one way mode. This causes trouble, e.g. when running with imapc, because you can't do this.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Thu, 24 Nov 2016 19:32:44 +0200
parents c0643c4b1b10
children 77b49389ebf5
files src/doveadm/dsync/dsync-brain-mailbox-tree-sync.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-brain-mailbox-tree-sync.c	Wed Nov 23 18:43:17 2016 +0200
+++ b/src/doveadm/dsync/dsync-brain-mailbox-tree-sync.c	Thu Nov 24 19:32:44 2016 +0200
@@ -57,7 +57,14 @@
 	}
 
 	ret = memcmp(mailbox_guid, metadata.guid, sizeof(metadata.guid));
-	if (ret > 0) {
+
+	/* if THEIR guid is bigger than OUR guid, and we are not doing
+	   backup in either direction, OR GUID did not match and we are
+	   receiving backup, try change the mailbox GUID.
+	*/
+
+	if ((ret > 0 && !brain->backup_recv &&
+	     !brain->backup_send) || (ret != 0 && brain->backup_recv)) {
 		if (brain->debug) {
 			i_debug("brain %c: Changing mailbox %s GUID %s -> %s",
 				brain->master_brain ? 'M' : 'S',