dovecot-2.2: dsync: Added a quick way to debug unexpected changes.

dovecot at dovecot.org dovecot at dovecot.org
Mon Jan 21 19:44:55 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/583ea6b63c5d
changeset: 15668:583ea6b63c5d
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jan 21 19:43:39 2013 +0200
description:
dsync: Added a quick way to debug unexpected changes.

diffstat:

 src/doveadm/dsync/dsync-mailbox-import.c |  9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diffs (47 lines):

diff -r 1b18ff11effc -r 583ea6b63c5d src/doveadm/dsync/dsync-mailbox-import.c
--- a/src/doveadm/dsync/dsync-mailbox-import.c	Mon Jan 21 19:41:24 2013 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-import.c	Mon Jan 21 19:43:39 2013 +0200
@@ -33,6 +33,10 @@
 	unsigned int copy_failed:1;
 };
 
+/* for quickly testing that two-way sync doesn't actually do any unexpected
+   modifications. */
+#define IMPORTER_DEBUG_CHANGE(importer) /*i_assert(!importer->master_brain)*/
+
 HASH_TABLE_DEFINE_TYPE(guid_new_mail, const char *, struct importer_new_mail *);
 HASH_TABLE_DEFINE_TYPE(uid_new_mail, void *, struct importer_new_mail *);
 
@@ -279,6 +283,7 @@
 	struct dsync_mail_request *request;
 
 	if (importer->want_mail_requests && !newmail->uid_in_local) {
+		IMPORTER_DEBUG_CHANGE(importer);
 		request = array_append_space(&importer->mail_requests);
 		request->guid = newmail->guid;
 		request->uid = newmail->uid;
@@ -1108,6 +1113,8 @@
 {
 	struct mail_save_context *save_ctx;
 
+	IMPORTER_DEBUG_CHANGE(importer);
+
 	if (!mail_set_uid(importer->mail, old_uid))
 		return;
 
@@ -1132,6 +1139,7 @@
 		if (newmail->skip) {
 			/* already assigned */
 			if (newmail->uid_in_local) {
+				IMPORTER_DEBUG_CHANGE(importer);
 				if (mail_set_uid(importer->mail, newmail->uid))
 					mail_expunge(importer->mail);
 			}
@@ -1483,6 +1491,7 @@
 			if (highest_wanted_uid < saved_uid)
 				highest_wanted_uid = saved_uid;
 		} else {
+			IMPORTER_DEBUG_CHANGE(importer);
 			if (lowest_unwanted_uid > saved_uid)
 				lowest_unwanted_uid = saved_uid;
 		}


More information about the dovecot-cvs mailing list