Bug 318224 - Tries to insert existing entries into database
Summary: Tries to insert existing entries into database
Status: RESOLVED UNMAINTAINED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: 4.10
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-12 07:23 UTC by Martin Steigerwald
Modified: 2015-03-12 12:52 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
xsession-errors.txt with duplicate entry messages (70.62 KB, text/plain)
2013-04-12 07:32 UTC, Martin Steigerwald
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Steigerwald 2013-04-12 07:23:43 UTC
Yesterday I switched from KDEPIM 1 as of KDE SC 4.4.11 to KDEPIM  2 as of KDE SC 4.10.2. I remade everything. The Akonadi and the Nepomuk databases and their configurations are completely fresh.

Still after just one day of having it run I get messages that Akonadi tries to insert duplicate entries in MySQL database in ~/.xsession-errors

Reproducible: Always

Steps to Reproduce:
Dunno about the exact steps to reproduce. It happens everytime time startup. I am hesistant to put the complete ~/.xsession-errors here, since I saw Akonadi pasting complete mails into it - likely the Akonadi Nepomuk Feeder I think.

1. Start Akonadi
2. tail -f ~/.xsession-errors | grep "Duplicate"

Actual Results:  
Nepomuk server already running.
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191674' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191533' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191495' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191465' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191425' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191385' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191343' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191285' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191270' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191237' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191223' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191192' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191187' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191143' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-191141' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-190929' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-190780' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-188125' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-188124' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '249-188109' for key 'PRIMARY' QMYSQL3: Unable to execute statement"


Expected Results:  
Absolutely none of those messages.

I use the following setup:

1) I had all mails in ~/Mail

2) I moved all recent mails from ~/Mail to a newly created BTRFS subvolume ~/.Mail so that I can snapshot it. I moved all the archived mails to ~/.Mail-Archiv, as these are mbox folders.

3) Then I let the migrator run so that it puts my account information into kmail2rc.

4) For each POP3 account I use I created an extra maildir agent pointing it at the maildir and then selecting "Synchronize All" in Akonadiconsole. Thus for my main account Lichtvoll I gave it ~/.Mail/Lichtvoll as maildir directory for example:

drwx------ 1 martin martin        18 Apr 11 08:33 Lichtvoll
drwx------ 1 martin martin      4106 Apr 11 17:28 .Lichtvoll.directory
-rw------- 1 martin martin   4312743 Apr 11 08:33 .Lichtvoll.index
-rw------- 1 martin martin     33909 Apr 11 08:33 .Lichtvoll.index.ids

For local mails I created:

drwx------ 1 martin martin        18 Jan  2 11:36 Lokal
drwxr-xr-x 1 martin martin       528 Apr 11 09:50 .Lokal.directory

and copied all the local mail folders into that.

5) I imported my filter rules back to this new setup, set inboxes for mail download to the right top level maildir directories and so on.


Size of setup:

martin@merkaba:~> find ~/.Mail | wc -l
431234
martin@merkaba:~> du -sh ~/.Mail
6,5G    /home/martin/.Mail


The KDEPIM-2 packages are from Debian developers, but they are not publically available in official Debian repositories. I test them for for them.

martin@merkaba:~> apt-show-versions | egrep "(kdepim|korganizer|kmail|knode|kaddressbook|zanshin|akonadi|nepomuk|strigi|virtuoso|soprano|libqt)"   akonadi-backend-mysql/experimental uptodate 1.9.1-2
akonadi-backend-postgresql/experimental uptodate 1.9.1-2
akonadi-backend-sqlite/experimental uptodate 1.9.1-2
akonadi-server/experimental uptodate 1.9.1-2
akonadiconsole 4:4.10.2-0r4 newer than version in archive
kaddressbook 4:4.10.2-0r4 newer than version in archive
kaddressbook-mobile 4:4.10.2-0r4 installed: No available version in archive
kdegraphics-strigi-analyzer/sid uptodate 4:4.8.4-1
kdepim 4:4.10.2-0r4 newer than version in archive
kdepim-dbg 4:4.10.2-0r4 newer than version in archive
kdepim-kresources 4:4.10.2-0r4 newer than version in archive
kdepim-mobileui-data 4:4.10.2-0r4 installed: No available version in archive
kdepim-runtime/experimental uptodate 4:4.10.2-1
kdepim-strigi-plugins 4:4.10.2-0r4 newer than version in archive
kdepimlibs-dbg/experimental uptodate 4:4.10.2-1
kdepimlibs-kio-plugins/experimental uptodate 4:4.10.2-1
kdesdk-strigi-plugins/sid uptodate 4:4.8.4+dfsg-1
kmail 4:4.10.2-0r4 newer than version in archive
kmail-mobile 4:4.10.2-0r4 installed: No available version in archive
knode 4:4.10.2-0r4 newer than version in archive
korganizer 4:4.10.2-0r4 newer than version in archive
korganizer-mobile 4:4.10.2-0r4 installed: No available version in archive
libakonadi-calendar4/experimental uptodate 4:4.10.2-1
libakonadi-contact4/experimental uptodate 4:4.10.2-1
libakonadi-kabc4/experimental uptodate 4:4.10.2-1
libakonadi-kcal4/experimental uptodate 4:4.10.2-1
libakonadi-kde4/experimental uptodate 4:4.10.2-1
libakonadi-kmime4/experimental uptodate 4:4.10.2-1
libakonadi-notes4/experimental uptodate 4:4.10.2-1
libakonadi-socialutils4/experimental uptodate 4:4.10.2-1
libakonadiprotocolinternals1/experimental uptodate 1.9.1-2
libkdepim4 4:4.10.2-0r4 newer than version in archive
libkdepimdbusinterfaces4 4:4.10.2-0r4 installed: No available version in archive
libkdepimmobileui4 4:4.10.2-0r4 installed: No available version in archive
libnepomuk4/experimental uptodate 4:4.10.2-2
libnepomukcore4/experimental uptodate 4:4.10.2-1
libnepomukquery4a/experimental uptodate 4:4.10.2-2
libnepomukutils4/experimental uptodate 4:4.10.2-2
libnepomukwidgets4/experimental uptodate 4:4.10.2-1
libqt4-dbg/sid uptodate 4:4.8.2+dfsg-11
libqt4-dbus/sid uptodate 4:4.8.2+dfsg-11
libqt4-declarative/sid uptodate 4:4.8.2+dfsg-11
libqt4-designer/sid uptodate 4:4.8.2+dfsg-11
libqt4-dev/sid uptodate 4:4.8.2+dfsg-11
libqt4-dev-bin/sid uptodate 4:4.8.2+dfsg-11
libqt4-help/sid uptodate 4:4.8.2+dfsg-11
libqt4-network/sid uptodate 4:4.8.2+dfsg-11
libqt4-opengl/sid uptodate 4:4.8.2+dfsg-11
libqt4-qt3support/sid uptodate 4:4.8.2+dfsg-11
libqt4-script/sid uptodate 4:4.8.2+dfsg-11
libqt4-scripttools/sid uptodate 4:4.8.2+dfsg-11
libqt4-sql/sid uptodate 4:4.8.2+dfsg-11
libqt4-sql-mysql/sid uptodate 4:4.8.2+dfsg-11
libqt4-sql-psql/sid uptodate 4:4.8.2+dfsg-11
libqt4-sql-sqlite/sid uptodate 4:4.8.2+dfsg-11
libqt4-svg/sid uptodate 4:4.8.2+dfsg-11
libqt4-test/sid uptodate 4:4.8.2+dfsg-11
libqt4-xml/sid uptodate 4:4.8.2+dfsg-11
libqt4-xmlpatterns/sid uptodate 4:4.8.2+dfsg-11
libqtassistantclient4/sid uptodate 4.6.3-4
libqtcore4/sid uptodate 4:4.8.2+dfsg-11
libqtdbus4/sid uptodate 4:4.8.2+dfsg-11
libqtglib-2.0-0/sid uptodate 0.10.2-2
libqtgstreamer-0.10-0/sid uptodate 0.10.2-2
libqtgstreamerui-0.10-0/sid uptodate 0.10.2-2
libqtgui4/sid uptodate 4:4.8.2+dfsg-11
libqtlocation1/sid uptodate 1.2.0-3
libqtruby4shared2/sid uptodate 4:4.8.4-1
libqtscript4-core/sid uptodate 0.2.0-1
libqtscript4-gui/sid uptodate 0.2.0-1
libqtscript4-network/sid uptodate 0.2.0-1
libqtscript4-sql/sid uptodate 0.2.0-1
libqtscript4-uitools/sid uptodate 0.2.0-1
libqtscript4-xml/sid uptodate 0.2.0-1
libqtwebkit-dev/sid uptodate 2.2.1-5
libqtwebkit4/sid uptodate 2.2.1-5
libqtwebkit4-dbg/sid uptodate 2.2.1-5
libqtxdg0/sid uptodate 0.4.1-2
libsmokeakonadi3/sid uptodate 4:4.8.4-1
libsmokenepomuk3/sid uptodate 4:4.8.4-1
libsmokesoprano3/sid uptodate 4:4.8.4-1
libsoprano-dev/experimental uptodate 2.9.0+dfsg1-1
libsoprano4/experimental uptodate 2.9.0+dfsg1-1
nepomuk-core-data/experimental uptodate 4:4.10.2-1
nepomuk-core-runtime/experimental uptodate 4:4.10.2-1
ruby-akonadi/sid uptodate 4:4.8.4-1
ruby-soprano/sid uptodate 4:4.8.4-1
soprano-daemon/experimental uptodate 2.9.0+dfsg1-1
virtuoso-minimal/experimental-snapshots uptodate 6.1.6+dfsg1-0r1
virtuoso-opensource-6.1-bin/experimental-snapshots uptodate 6.1.6+dfsg1-0r1
virtuoso-opensource-6.1-common/experimental-snapshots uptodate 6.1.6+dfsg1-0r1
zanshin/sid uptodate 0.2.1-1+b1
Comment 1 Martin Steigerwald 2013-04-12 07:32:51 UTC
Created attachment 78834 [details]
xsession-errors.txt with duplicate entry messages

Okay, for whatever reason ~/.xsession-errors is truncated anyway. There is nothing too private in it. So here goes. I excluded lots of basket global shortcut without name error messages from it.

Just for reference, kernel being used is:

martin@merkaba:~> cat /proc/version 
Linux version 3.9.0-rc6-tp520+ (martin@merkaba) (gcc version 4.7.2 (Debian 4.7.2-5) ) #5 SMP PREEMPT Tue Apr 9 10:55:51 CEST 2013

(I doubt that it matters)
Comment 2 Daniel Vrátil 2013-12-06 17:34:27 UTC
Is this problem still valid?

Can you in Akonadi Console -> DB Console run following query:

SELECT collectionTable.name, resourceTable.name FROM collectionTable INNER JOIN resourceTable ON collectionTable.resourceId = resourceTable.id  WHERE collectionTable.id = 249;
Comment 3 Ezio Vergine 2013-12-11 10:02:56 UTC
Is pheraps related to databased used by akonady? I've arch as distribution, and mariaDB is used instead of mysql. I should try to use different database? SQLite, for example?

Thx for your work guys
Comment 4 Daniel Vrátil 2013-12-11 15:02:15 UTC
Ezio, this does not depend on which backend you use (also, SQLite is not really recommended for performance reasons) - this is a bug somewhere in Akonadi/client libraries trying to do something, that we have forbidden to happen.
Comment 5 Chris Samuel 2013-12-29 13:00:55 UTC
I am getting:

ARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-323043' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-323207' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-323405' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-323483' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-323484' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-323485' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-323486' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-324801' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-324939' for key 'PRIMARY' QMYSQL3: Unable to execute statement"
Error during executing query "INSERT INTO CollectionPimItemRelation (Collection_id, PimItem_id) VALUES (:0, :1)" :  "Duplicate entry '1116-325025' for key 'PRIMARY' QMYSQL3: Unable to execute statement"

If in Akonadi Console DB Console I execute:

SELECT collectionTable.name, resourceTable.name FROM collectionTable INNER JOIN resourceTable ON collectionTable.resourceId = resourceTable.id  WHERE collectionTable.id = 1116;

I see:

1 Last Search akonadi_search_resource

This is with KDE 4.12 from the Kubuntu KDE backports PPA.

Akonadi Console
Version 0.99
Using KDE Development Platform 4.12.0
Comment 6 Daniel Vrátil 2014-01-02 13:06:24 UTC
Thanks for the info. It's clear now that we are trying to insert items into a virtual collection that are already there.

This does not cause any problems, as you can't have one item linked multiple times into one virtual collection, so if the constraint fails, it means the item is already there and everything's fine.

The warning is probably generated from Nepomuk Search code, which does not verify whether the item is already linked.
Comment 7 piedro 2014-03-26 12:38:46 UTC
I am not convinced it does nothing. Kmail is working very unreliable and the akonadiserver log shows the above insertion entries. So trying to resolve any issue is a complte nuisance when there are false warnings like this... even if it, as you say, doesn't matter it shows up in an error log and akonadi tells us "found errors in current akonadi start"! How can a user be expected to isolate errors with false positives around? 

btw: every minor version of kde shows how many kmail bugs have been resolved, but there's a lot of "yeah that doesn't matter" or "works kind of" stuff that get's dusted under the carpet. Creating error messages that need a google search or buglist hunt to find out that they don't matter is a serious bug in my book. And these messages clutter up the error log so it's difficult to find important messages in beetween ... not to mention that it produces these red warning signs when testing the akonadi server via Gui ... 

plz fix this. 
thx a lot for your efforts, 
piedro
Comment 8 piedro 2014-03-26 12:41:10 UTC
Forgot to mention: 
I believe that this slows down the start of Kontact by a huge deal ... it takes minutes on modern hardware to start and be usable...
Comment 9 Daniel Vrátil 2014-03-26 13:02:18 UTC
In KDE 4.13 / Akonadi 1.12 we don't use Nepomuk search in Akonadi server anymore, so this problem won't come again. I recommend you update as soon as your distribution ships it.

In the meanwhile, you can remove your "Search" folders.
Comment 10 piedro 2014-03-26 14:29:27 UTC
thx! the removing of search folders solved the performance issue (I hope)... 

Just for information: Does this mean there is no searching available anymore? 

thx for your bughunting! :-) 
(must be hard work with the complexity Kde has developed...) 

cheers to progress, 
piedro
Comment 11 Daniel Vrátil 2014-03-26 15:53:00 UTC
(In reply to comment #10)
> Just for information: Does this mean there is no searching available
> anymore? 

No, searching will still be available and it will be more powerful than ever (http://news.kde.org/2014/02/24/kdes-next-generation-semantic-search).
Comment 12 piedro 2014-03-26 16:26:53 UTC
That is really good news! So let's hope ... 
(though so often I've been hoping in vain... :-() 

thx!
Comment 13 Martin Steigerwald 2015-03-12 12:52:31 UTC
I don´t see this with Akonadi 1.13 current master with MySQL performance improvements by Dan and Millian, kdepimlibs and kdepim-runtime from 24th of February and KMail 4.14.2

martin@merkaba:~> grep -i "INSERT INTO" .xsession-errors
martin@merkaba:~#1>

As Nepomuk is not used anymore I am closing this. If someone still has this issue, feel free to reopen or ask me to reopen it in case you can´t do it.