DelayedDelete and USER events in sync log break <b>Not a candidate for upstream at this point - needs addional debate</b>
sync_client "optimises" its sync list by removing MAILBOX events where there's an associated USER event. This is fine until you have delayed delete, because MAILBOX user.foo MAILBOX DELETED.user.foo.4703FDCF USER foo Becomes: MAILBOX DELETED.user.foo.4703FDCF RESET foo And the messages wind up being copied again entirely because the server doesn't know about the mailbox user.foo when the MAILBOX event is running. This patch stops removing the first MAILBOX event. To make CREATE work correctly now, this patch also makes a "MAILBOX user.foo" event be generated along with a "USER foo" event on user create - otherwise sub mailboxes or appends that happen before the first sync will cause bogus deletes on the replica. --- imap/imapd.c | 3 +-- imap/sync_client.c | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/imap/imapd.c b/imap/imapd.c index e872e3e..8501c34 100644 --- a/imap/imapd.c +++ b/imap/imapd.c @@ -5073,8 +5073,7 @@ void cmd_create(char *tag, char *name, char *partition, int localonly) if ( !localonly ) { if (mboxname_isusermailbox(mailboxname, 1)) sync_log_user(mboxname_inbox_touserid(mailboxname)); - else - sync_log_mailbox(mailboxname); + sync_log_mailbox(mailboxname); } } } diff --git a/imap/sync_client.c b/imap/sync_client.c index 8a70974..da6e271 100644 --- a/imap/sync_client.c +++ b/imap/sync_client.c @@ -3021,7 +3021,9 @@ static int do_sync(const char *filename) action for same user */ (sync_namespace.mboxname_tointernal)(&sync_namespace, "INBOX", action->user, inboxname); - remove_folder(inboxname, mailbox_list, 1); + /* breaks DELETED namespace renames + * remove_folder(inboxname, mailbox_list, 1); + */ remove_folder(inboxname, append_list, 1); remove_folder(inboxname, acl_list, 1); remove_folder(inboxname, quota_list, 1); -- 1.5.6.3