dovecot-2.2: dsync: Include mailboxes' full path in debug messages.

dovecot at dovecot.org dovecot at dovecot.org
Thu Aug 27 15:39:04 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/7ecf4d436a46
changeset: 19027:7ecf4d436a46
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Aug 27 17:38:12 2015 +0200
description:
dsync: Include mailboxes' full path in debug messages.

diffstat:

 src/doveadm/dsync/dsync-mailbox-tree-sync.c |  20 +++++++++++---------
 src/doveadm/dsync/dsync-mailbox-tree.c      |   8 +++++++-
 src/doveadm/dsync/dsync-mailbox-tree.h      |   3 +++
 3 files changed, 21 insertions(+), 10 deletions(-)

diffs (103 lines):

diff -r a55208061542 -r 7ecf4d436a46 src/doveadm/dsync/dsync-mailbox-tree-sync.c
--- a/src/doveadm/dsync/dsync-mailbox-tree-sync.c	Thu Aug 27 17:35:17 2015 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-tree-sync.c	Thu Aug 27 17:38:12 2015 +0200
@@ -485,7 +485,7 @@
 
 	/* set the new name */
 	*reason_r = t_strdup_printf("%s + Renamed '%s' to '%s'",
-				    *reason_r, node->name, other_node->name);
+				    *reason_r, name, other_node->name);
 	node->name = p_strdup(tree->pool, other_node->name);
 	node->sync_temporary_name = other_node->sync_temporary_name;
 	node->last_renamed_or_created = other_node->last_renamed_or_created;
@@ -877,8 +877,9 @@
 		i_assert(strcmp(local_node->name, remote_node->name) == 0);
 		if (debug != NULL) {
 			str_truncate(debug, 0);
-			str_printfa(debug, "Mailbox %s: local=%s/%ld/%d, remote=%s/%ld/%d",
-				    local_node->name,
+			str_append(debug, "Mailbox ");
+			dsync_mailbox_node_append_full_name(debug, ctx->local_tree, local_node);
+			str_printfa(debug, ": local=%s/%ld/%d, remote=%s/%ld/%d",
 				    guid_128_to_string(local_node->mailbox_guid),
 				    (long)local_node->last_renamed_or_created,
 				    local_node->existence,
@@ -979,7 +980,7 @@
 }
 
 static void
-sync_rename_temp_mailbox_node(pool_t pool,
+sync_rename_temp_mailbox_node(struct dsync_mailbox_tree *tree,
 			      struct dsync_mailbox_node *node,
 			      const char **reason_r)
 {
@@ -1005,8 +1006,9 @@
 	while (node_has_child(node->parent, str_c(str)))
 		suffix_inc(str);
 
-	*reason_r = t_strdup_printf("Renamed '%s' to '%s'", node->name, str_c(str));
-	node->name = p_strdup(pool, str_c(str));
+	*reason_r = t_strdup_printf("Renamed '%s' to '%s'",
+		dsync_mailbox_node_get_full_name(tree, node), str_c(str));
+	node->name = p_strdup(tree->pool, str_c(str));
 
 	dsync_mailbox_tree_node_move_sorted(node, node->parent);
 	node->sync_temporary_name = FALSE;
@@ -1052,17 +1054,17 @@
 				i_debug("brain %c: %s mailbox %s: Delete directory-only tree",
 					(ctx->sync_flags & DSYNC_MAILBOX_TREES_SYNC_FLAG_MASTER_BRAIN) != 0 ? 'M' : 'S',
 					tree == ctx->local_tree ? "local" : "remote",
-					node->name);
+					dsync_mailbox_node_get_full_name(tree, node));
 			}
 			sync_rename_delete_node_dirs(ctx, tree, node);
 		} else {
 			T_BEGIN {
-				sync_rename_temp_mailbox_node(tree->pool, node, &reason);
+				sync_rename_temp_mailbox_node(tree, node, &reason);
 				if ((ctx->sync_flags & DSYNC_MAILBOX_TREES_SYNC_FLAG_DEBUG) != 0) {
 					i_debug("brain %c: %s mailbox %s: %s",
 						(ctx->sync_flags & DSYNC_MAILBOX_TREES_SYNC_FLAG_MASTER_BRAIN) != 0 ? 'M' : 'S',
 						tree == ctx->local_tree ? "local" : "remote",
-						node->name, reason);
+						dsync_mailbox_node_get_full_name(tree, node), reason);
 				}
 			} T_END;
 			return TRUE;
diff -r a55208061542 -r 7ecf4d436a46 src/doveadm/dsync/dsync-mailbox-tree.c
--- a/src/doveadm/dsync/dsync-mailbox-tree.c	Thu Aug 27 17:35:17 2015 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-tree.c	Thu Aug 27 17:38:12 2015 +0200
@@ -138,13 +138,19 @@
 					     const struct dsync_mailbox_node *node)
 {
 	string_t *str = t_str_new(128);
+	dsync_mailbox_node_append_full_name(str, tree, node);
+	return str_c(str);
+}
 
+void dsync_mailbox_node_append_full_name(string_t *str,
+					 const struct dsync_mailbox_tree *tree,
+					 const struct dsync_mailbox_node *node)
+{
 	i_assert(node->parent != NULL);
 
 	node_get_full_name_recurse(tree, node, str);
 	/* remove the trailing separator */
 	str_truncate(str, str_len(str)-1);
-	return str_c(str);
 }
 
 void dsync_mailbox_node_copy_data(struct dsync_mailbox_node *dest,
diff -r a55208061542 -r 7ecf4d436a46 src/doveadm/dsync/dsync-mailbox-tree.h
--- a/src/doveadm/dsync/dsync-mailbox-tree.h	Thu Aug 27 17:35:17 2015 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-tree.h	Thu Aug 27 17:38:12 2015 +0200
@@ -135,6 +135,9 @@
 /* Returns full name for the given mailbox node. */
 const char *dsync_mailbox_node_get_full_name(const struct dsync_mailbox_tree *tree,
 					     const struct dsync_mailbox_node *node);
+void dsync_mailbox_node_append_full_name(string_t *str,
+					 const struct dsync_mailbox_tree *tree,
+					 const struct dsync_mailbox_node *node);
 
 /* Copy everything from src to dest, except name and hierarchy pointers */
 void dsync_mailbox_node_copy_data(struct dsync_mailbox_node *dest,


More information about the dovecot-cvs mailing list