[Kde-pim] getting more info out of "NO Multiple merge candidates, aborting"

Christian Mollekopf chrigi_1 at fastmail.fm
Sat Oct 11 19:16:17 BST 2014



On Sat, Oct 11, 2014, at 07:47 PM, David Faure wrote:
> On Friday 10 October 2014 18:51:14 Christian Mollekopf wrote:
> > ... this error message during an ItemSync means that you have duplicate
> > RID's in the synced collection.
> 
> Hi Christian,
> Thanks for this informative email as a followup to my question in
> reviewboard.
> 
> > You should be able to find duplicate rid's with the following query:
> > 
> > select id, count(remoteId) from pimitemtable where collectionId = 226911
> > 	group by remoteId having ( count(remoteId) > 1 );
> > 
> > Just make sure to substitute the collectionId with the one where you get
> > this error.
> 
> OK, I found 5 items with a duplicate id and one with two duplicates.
> 

Great, that at least confirms what the error is.

> Now what? :-)
> Should `akonadictl fsck` take care of cleaning up such duplicates?
> 

That would be nice, but I don't think it does currently.

The RID *must* always be unique per collection, everything else is a
broken state, at least as far as the imap resource is concerned.

So this in fact should never happen and IMO we should enforce it in
while creating/modifying items. I'm not sure we can though
because it could be (not sure, daniel probably knows more), that some
resources for some reason don't use the RID that way.

If that would be the case there is also nothing akonadictl fsck can do.

> Hmm, but the items are quite different. See attached screenshot.
> They have the same remoteId in the same collection, but a very different
> size,
> different datetime, different rev, and only one has a gid (what's that?).
> 

Since you're in an invalid state you anyways have bogus data. The GID is
a globally unique identifier that we introduced some
time ago. It is typically extracted by the serializer plugin. For email
messages it's the message-id. The GID is not guaranteed to be unique in
practice, it's purpose is to ideally uniquely identify an "object". But
there is no restriction that you can't have the same object multiple
times in the same collection. Anyways, it doesn't really matter for this
discussion.

> Actually, by sorting the folder in the Browser tab by remoteId, I could
> find 
> the two items with remoteId=30, and they are completely unrelated
> (one old email from 2011 and one amazon confirmation in august 2014).
> What could lead to this?
> Clearly the fix isn't to "remove one of them" but to somehow ensure it
> gets 
> assigned a new remoteId?
> 

The fix is to remove all, and to then sync. This will download the
correct data and your sync should be fine again.

Unfortunately I have no idea how you can get in this broken state at
this point.

> ====
> 
> Hmm. Talking about akonadictl fsck...
> I just ran that command, and it gave me a million lines like
> 
> "Found unreferenced external file: 
> /home/dfaure/.local/share/akonadi/file_db_data/4704896_r0" 
> 
> followed by
> "Moved 431978 unreferenced files to lost+found." 
> ... I wasn't very far off -- half a million !!!
> 
> This is scary. Did something change in the handling of saved local files?
> Or could it be the result of the "inconsistency detected, doing a full
> sync" 
> code path (which I noticed, saves lots of local files again, maybe it
> forgets 
> to delete the old ones?)
> 

No idea. I know this happens if you i.e. wipe your db manually or alike,
but I don't think it should happen during normal operation.

> > I suggest to use the commandline sql client:
> 
> Actually akonadiconsole's DB Console tab is more convenient, and I even
> just 
> made it more so:
> * Ctrl+Return to execute the query
> * Queries are loaded/saved into kconfig.
> So you can keep a bunch of useful queries around, with comments above
> each 
> one. You just need to have all of them commented out except one (the one
> to 
> run).
> 

That is indeed a very nice improvement! Thanks =)
I still prefer the reqular sql client though (autocompletion, command
history, nice result formatting...)

Cheers,
Christian
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list