From kde-pim Mon Feb 20 13:28:16 2012 From: Volker Krause Date: Mon, 20 Feb 2012 13:28:16 +0000 To: kde-pim Subject: Re: [Kde-pim] Collections without remoteId abort imap sync Message-Id: <1546922.oDN781PuFl () vkpc9> X-MARC-Message: https://marc.info/?l=kde-pim&m=132974457922745 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============8291188282148647877==" --===============8291188282148647877== Content-Type: multipart/signed; boundary="nextPart1539991.WmMINcruFp"; micalg="pgp-sha1"; protocol="application/pgp-signature" Content-Transfer-Encoding: 7Bit --nextPart1539991.WmMINcruFp Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" On Sunday 19 February 2012 11:08:17 David Faure wrote: > My IMAP sync has been broken for a long time, due to errors like this one: > > > Error during executing query "INSERT INTO CollectionTable (remoteId, > remoteRevision, name, parentId, resourceId, cachePolicyInherit) VALUES (:0, > > :1, :2, :3, :4, :5)" : "Duplicate entry '960-trainings-old' for key > > 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement" > > Volker told me to look for a collection without a remoteId, in the > CollectionTable, and he was right, that's exactly the issue. > > id 2551, remoteId empty, remoteRevision empty, name trainings-old, parentId > 960 (which is correct), resourceId 22. > > Shouldn't akonadiserver detect that and use "UPDATE" when a collection with > this name already exists? An empty remote id as such is perfectly valid, in the scenario outlined by Kevin. The identification used to decide whether to use INSERT or UPDATE is the Akonadi id (not the name or RID). The uniqueness check on the name is just an extra safety check as most backends can't handle two objects with the same name. The code that breaks here is a few levels up I think, in Akonadi::CollectionSync in kdepimlibs. It creates a new collection instead of updating the RID of an existing one, see below. > Of course I could just clean up my SQL table from such ghost collections, > but I suppose a proper recovery code path would be more useful for other > users in the same situation who don't have the opportunity of spending a > weekend in Osnabrueck to get such answers about their problems :-) > > Any idea how this could happen in the first place, too? What likely happened here is you created a new folder locally (added to Akonadi with empty RID), the IMAP resource created it on the server and failed to update the RID locally to the correct IMAP path (I don't know yet why that would happen though). Another, less likely, scenario is a conflict of two clients creating the same folder simultaneously. The above error is then triggered on the next collection tree sync. The collection on the server and the local one cannot be matched using their RID, as a result of which CollectionSync tries to create the missing one from the server locally (causing the name clash), at which point it aborts. CollectionSync would also remove local collections missing on the server, but there's an extra safety check to not do that for RID-less objects (as they haven't been written to the server yet, by the definition of the RID). So, that will not make it recover here. One solution I can see is making the matching in CollectionSync slightly more clever for the "leftovers" (stuff that couldn't be matched by RID) and just update the RID accordingly when finding matching names among those. regards, Volker --nextPart1539991.WmMINcruFp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iD8DBQBPQkpzf5bM1k0S0kcRAu4RAJ9oMr/pJ3efRL4Tb+HMVeeTKbdWNwCgi/z9 8CbxuU6DLUf0pfHUjJkBUdg= =+s1f -----END PGP SIGNATURE----- --nextPart1539991.WmMINcruFp-- --===============8291188282148647877== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ KDE PIM mailing list kde-pim@kde.org https://mail.kde.org/mailman/listinfo/kde-pim KDE PIM home page at http://pim.kde.org/ --===============8291188282148647877==--