dovecot-2.2: dsync: Added more debug logging.

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 19 11:08:55 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/2ee278eaa1e3
changeset: 15844:2ee278eaa1e3
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 19 11:08:49 2013 +0200
description:
dsync: Added more debug logging.

diffstat:

 src/doveadm/dsync/dsync-brain-mailbox-tree-sync.c |  26 +++++++++++++++++++---
 1 files changed, 22 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r 31e48b4732a5 -r 2ee278eaa1e3 src/doveadm/dsync/dsync-brain-mailbox-tree-sync.c
--- a/src/doveadm/dsync/dsync-brain-mailbox-tree-sync.c	Tue Feb 19 10:38:51 2013 +0200
+++ b/src/doveadm/dsync/dsync-brain-mailbox-tree-sync.c	Tue Feb 19 11:08:49 2013 +0200
@@ -7,13 +7,14 @@
 #include "dsync-brain-private.h"
 
 static int
-sync_create_box(struct mailbox *box, const guid_128_t mailbox_guid,
-		uint32_t uid_validity)
+sync_create_box(struct dsync_brain *brain, struct mailbox *box,
+		const guid_128_t mailbox_guid, uint32_t uid_validity)
 {
 	struct mailbox_metadata metadata;
 	struct mailbox_update update;
 	enum mail_error error;
 	const char *errstr;
+	int ret;
 
 	memset(&update, 0, sizeof(update));
 	memcpy(update.mailbox_guid, mailbox_guid, sizeof(update.mailbox_guid));
@@ -48,7 +49,15 @@
 		return -1;
 	}
 
-	if (memcmp(mailbox_guid, metadata.guid, sizeof(metadata.guid)) > 0) {
+	ret = memcmp(mailbox_guid, metadata.guid, sizeof(metadata.guid));
+	if (ret > 0) {
+		if (brain->debug) {
+			i_debug("brain %c: Changing mailbox %s GUID %s -> %s",
+				brain->master_brain ? 'M' : 'S',
+				mailbox_get_vname(box),
+				guid_128_to_string(metadata.guid),
+				guid_128_to_string(mailbox_guid));
+		}
 		memset(&update, 0, sizeof(update));
 		memcpy(update.mailbox_guid, mailbox_guid,
 		       sizeof(update.mailbox_guid));
@@ -72,6 +81,15 @@
 				mailbox_get_vname(box));
 			return -1;
 		}
+	} else if (ret < 0) {
+		if (brain->debug) {
+			i_debug("brain %c: Other brain should change mailbox "
+				"%s GUID %s -> %s",
+				brain->master_brain ? 'M' : 'S',
+				mailbox_get_vname(box),
+				guid_128_to_string(mailbox_guid),
+				guid_128_to_string(metadata.guid));
+		}
 	}
 	return 0;
 }
@@ -118,7 +136,7 @@
 	}
 	switch (change->type) {
 	case DSYNC_MAILBOX_TREE_SYNC_TYPE_CREATE_BOX:
-		ret = sync_create_box(box, change->mailbox_guid,
+		ret = sync_create_box(brain, box, change->mailbox_guid,
 				      change->uid_validity);
 		mailbox_free(&box);
 		return ret;


More information about the dovecot-cvs mailing list