Recover from unknown UID after APPEND or COPY

Review Request #101147 - Created April 17, 2011 and submitted

Information
Volker Krause
kdepim-runtime
master
259214, 264266
Reviewers
kdepim
Currently, if unable to determine the UID of a message after an APPEND or COPY command, we abort the task and leave the Akonadi item with an empty RID. During the next sync, the message we added to the server is discovered and downloaded, duplicating it locally. Items with empty RIDs are protected against deletion during a sync, since they are assumed to not be on the server yet. This is a safety feature, but gets in to the way of automatic recovery here.

So, this patch fixes this by assigning an arbitrary random RID in this case. Note that this only happens if all UID detection attempts fail, not if e.g. the actual APPEND or COPY failed. Assuming that those commands report errors correctly, this should be safe.
None, unfortunately, I cannot trigger this code path here since I have no access to a non-UIDPLUS server.
Kevin Ottens
I probably lack some insight there, how a random RID will help ItemSync clean up that particular ghost item? (I understand the empty RID protection reasoning, I'm just not aware of the logic in ItemSync which would help locating that this particular item with a random RID is to be removed).

Also, unit test please?
  1. If the item has an RID and does not exist on the server (which with the UUID-like random RID it will never do) it's removed locally, thus cleaning up the mess. Well, at least when using ItemSync in non-incremental mode, which the IMAP resource does when not using fast sync, it's the same way we deal with remote deletions.
  2. Ah right, now I remember, that's why we relist the UIDs indeed. Thanks for the clarification.
Commit Hook
This review has been submitted with commit 34f1b3e879fff83f6fdc665afea1060d7d411bdd by Volker Krause.
Loading...