Bug 375244 - Akonadi IMAP Resource should handle "Duplicate entry in CollectionTable" errors
Summary: Akonadi IMAP Resource should handle "Duplicate entry in CollectionTable" errors
Status: REPORTED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: IMAP resource (show other bugs)
Version: 5.4.1
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Christian Mollekopf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-18 15:09 UTC by Till Schäfer
Modified: 2019-04-24 03:05 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Till Schäfer 2017-01-18 15:09:23 UTC
Problem: Akonadi logging shows the below error and 
* silently fails to sync any IMAP folder-tree changes 
* does not sync any mails inside the affected folder anymore

org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver:   Error code: 1062
org.kde.pim.akonadiserver:   DB error:  "Duplicate entry '70-2017-bwinf' for key 'CollectionTable_parentAndNameIndex'"
org.kde.pim.akonadiserver:   Error text: "Duplicate entry '70-2017-bwinf' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement"
org.kde.pim.akonadiserver:   Query: "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, enabled, syncPref, displayPref, indexPref, cachePolicyInherit, cachePolicyCheckInterval, cachePolicyCacheTimeout, cachePolicySyncOnDemand, cachePolicyLocalParts, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14)"

Trigger: In this concrete situation, I had an unsubscribed folder on the server side and created a new folder with the same name on the client. However, there are other triggers two such as in Bug 371570, Bug 323844, or in situations where a local folder is created in offline mode and another folder is created on the server side on the same time. 

Proposed Solution: 
It seems to me, that the above described situation is not avoidable in all cases. Therefore, Akonadi/IMAP Resource must handle such situations. I would like to see some type of merge/rename dialog in this case, that allows to rename the local/remote folder or merge the content of the folders. 

The minimum solution would be to notify the user about an inconsistent state, because the inconsistent state is dangerous and can cause data loss, if the user is unaware that mails/folders are not synced to the server anymore and still uses the instance.
Comment 1 Erick Osorio 2018-01-23 20:52:50 UTC
What happen with this?

I had a lot of this errors when I change the name of account, and then I select the Trash Folder.