changeset 18933:1ed8418031b6

dsync: Fixed syncing a recursive delete of mailbox with children. For example if 1/2/3 exists in both sides and then 1/2/3, 1/2 and 1 are deleted from one side, the next dsync would delete 1/2/3, but leave 1/2 and 1 undeleted.
author Timo Sirainen <tss@iki.fi>
date Sat, 15 Aug 2015 12:14:35 +0200
parents 40e220761a41
children 295fd771e02d
files src/doveadm/dsync/dsync-mailbox-tree-sync.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-mailbox-tree-sync.c	Sat Aug 15 12:05:34 2015 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-tree-sync.c	Sat Aug 15 12:14:35 2015 +0200
@@ -1289,19 +1289,19 @@
 			sync_subscription(ctx, local_node, remote_node);
 
 		if (local_node->existence == DSYNC_MAILBOX_NODE_DELETED &&
-		    local_node->first_child == NULL &&
+		    !node_has_existent_children(local_node, TRUE) &&
 		    remote_node->existence == DSYNC_MAILBOX_NODE_EXISTS &&
 		    ctx->sync_type != DSYNC_MAILBOX_TREES_SYNC_TYPE_PRESERVE_REMOTE) {
 			/* delete from remote */
-			i_assert(remote_node->first_child == NULL);
+			i_assert(!node_has_existent_children(remote_node, TRUE));
 			remote_node->existence = DSYNC_MAILBOX_NODE_NONEXISTENT;
 		}
 		if (remote_node->existence == DSYNC_MAILBOX_NODE_DELETED &&
-		    remote_node->first_child == NULL &&
+		    !node_has_existent_children(remote_node, TRUE) &&
 		    local_node->existence == DSYNC_MAILBOX_NODE_EXISTS &&
 		    ctx->sync_type != DSYNC_MAILBOX_TREES_SYNC_TYPE_PRESERVE_LOCAL) {
 			/* delete from local */
-			i_assert(local_node->first_child == NULL);
+			i_assert(!node_has_existent_children(local_node, TRUE));
 			local_node->existence = DSYNC_MAILBOX_NODE_NONEXISTENT;
 			sync_add_dir_change(ctx, local_node,
 				DSYNC_MAILBOX_TREE_SYNC_TYPE_DELETE_DIR);