[Kde-pim] akonadiserver remembers collection context between fetch and delete

David Faure faure at kde.org
Fri Jun 26 12:12:50 BST 2015


Hi Dan, thanks for the answers.

On Thursday 25 June 2015 16:02:17 Daniel Vrátil wrote:
> It appears that CollectionSelectJob has been private header since 2009. My
> understanding is that RID-based selection was intended to be used only by
> Resource internals which have access to the private header...

The resources themselves (in kdepim-runtime) don't have access to it, so I guess
you mean "via some code in kdepimlibs/akonadi", but I couldn't find anything that
uses CollectionSelectJob in there (except some unittests). So it seems completely unused to me.

> > Should ItemDeleteJob pass along the collection of the item, rather than
> > just the remote id? Or is that not supported by the imap RID REMOVE
> > syntax? (I see ProtocolHelper::commandContextToByteArray takes a
> > collection, but for ItemDeleteJob, that seems to mean "delete this entire
> > collection", right?)
>
> I think the proper fix is to do the SELECT at the beginning of ItemSync.
> ItemSync is always per-collection and the collection is known beforehand, so
> ItemSync should ensure the Session context is set up correctly.

Ah, good idea.

> > Unless I'm missing something, I guess my only solution is to find out the
> > actual id() of the items :(
> 
> Without the fix above, the FETCH to resolve IDs is your only option.
 
OK. Two further thoughts then:

- why does this work for modified items? Somehow ItemSync is able to resolve items
using their RID when they are just modified rather than deleted.

- clearly the error handling for the ItemDeleteJob in ItemSync is missing; I would have wasted a 
lot less time debugging this if ItemSync would have warned me that the job failed.
Is the patch below enough, or should it do something else on failed creation/deletion?

diff --git a/akonadi/itemsync.cpp b/akonadi/itemsync.cpp
index 9f833e6..1b15897 100644
--- a/akonadi/itemsync.cpp
+++ b/akonadi/itemsync.cpp
@@ -428,8 +428,11 @@ void ItemSyncPrivate::deleteItems(const Item::List &itemsToDelete)
     }
 }
 
-void ItemSyncPrivate::slotLocalDeleteDone(KJob *)
+void ItemSyncPrivate::slotLocalDeleteDone(KJob *job)
 {
+    if (job->error()) {
+        kWarning() << "Deleting items from the akonadi database failed:" << job->errorString();
+    }
     mPendingJobs--;
     mProgress++;
 
@@ -438,7 +441,9 @@ void ItemSyncPrivate::slotLocalDeleteDone(KJob *)
 
 void ItemSyncPrivate::slotLocalChangeDone(KJob *job)
 {
-    Q_UNUSED(job);
+    if (job->error()) {
+        kWarning() << "Creating/updating items from the akonadi database failed:" << job->errorString();
+    }
     mPendingJobs--;
     mProgress++;
 


-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5

_______________________________________________
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