Bug 439769 - Akonadi fails with Mariadb 10.6.3
Summary: Akonadi fails with Mariadb 10.6.3
Status: RESOLVED UPSTREAM
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 440717 440772 440777 440781 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-07-12 04:50 UTC by kelly
Modified: 2021-08-10 13:16 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kelly 2021-07-12 04:50:20 UTC
SUMMARY

Akonadi fails to run with Mariadb 10.6.3.  To me it looks like the QDateTime string format with the "T" and maybe the "Z" is invalid with Mariadb 10.6+.


STEPS TO REPRODUCE
1. Install Mariadb 10.6.3
2. delete ~/.local/share/akonadi
3. reboot machine
4. start kmail

OBSERVED RESULT

Errors in ~/.local/share/akonadi/Akonadi.error

2021-07-11T22:04:16 [CRITICAL] org.kde.pim.akonadiserver: DATABASE ERROR:
2021-07-11T22:04:16 [CRITICAL] org.kde.pim.akonadiserver:   Error code: "1292"
2021-07-11T22:04:16 [CRITICAL] org.kde.pim.akonadiserver:   DB error:  "Incorrect datetime value: '2021-07-12T04:04:16Z' for column `akonadi`.`pimitemtable`.`datetime` at row 1"
2021-07-11T22:04:16 [CRITICAL] org.kde.pim.akonadiserver:   Error text: "Incorrect datetime value: '2021-07-12T04:04:16Z' for column `akonadi`.`pimitemtable`.`datetime` at row 1 QMYSQL: Unable to execute query"
2021-07-11T22:04:16 [CRITICAL] org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(int, 0))(":1", QVariant(QString, "152288"))(":2", QVariant(QString, ""))(":3", QVariant(QString, ""))(":4", QVariant(qlonglong, 21))(":5", QVariant(qlonglong, 4))(":6", QVariant(QDateTime, QDateTime(2021-07-12 04:04:16.872 UTC Qt::UTC)))(":7", QVariant(QDateTime, QDateTime(2021-07-12 04:04:16.871 UTC Qt::UTC)))(":8", QVariant(bool, false))(":9", QVariant(qlonglong, 13241)))
2021-07-11T22:04:16 [CRITICAL] org.kde.pim.akonadiserver:   Query: "INSERT INTO PimItemTable (rev, remoteId, remoteRevision, gid, collectionId, mimeTypeId, datetime, atime, dirty, size) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9)"
2021-07-11T22:04:16 [WARN ] org.kde.pim.akonadiserver: Error during insertion into table "PimItemTable" "Incorrect datetime value: '2021-07-12T04:04:16Z' for column `akonadi`.`pimitemtable`.`datetime` at row 1 QMYSQL: Unable to execute query"
2021-07-11T22:04:16 [WARN ] org.kde.pim.akonadiserver: Error while handling command CreateItem on connection akonadi_imap_resource_0 (0xdd91b0)



EXPECTED RESULT

Kmail should start and run properly.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Kernel 5.12.16
(available in About System)
KDE Plasma Version: 5.22.3
KDE Frameworks Version: 5.84
Qt Version: 5.15.3 (from kde source tree)

ADDITIONAL INFORMATION
Comment 1 Antonio Rojas 2021-07-12 07:27:37 UTC
Qt issue

https://bugreports.qt.io/browse/QTBUG-95071
Comment 2 Antonio Rojas 2021-08-08 08:48:55 UTC
*** Bug 440717 has been marked as a duplicate of this bug. ***
Comment 3 Ricardo J. Barberis 2021-08-08 19:04:57 UTC
I had already done a mysql_upgrade and akonadi's mysqld wouldn't start, so in case this helps other people with a broken akonadi, here's what I did (YMMV):


- Under "[mysqld]" in ~/.local/share/akonadi/mysql.conf I added:

"innodb_force_recovery = 2"

- Made sure it and akonadi were not running, and started mysqld with:

/usr/libexec/mysqld --defaults-file=/home/myuser/.local/share/akonadi/mysql.conf --datadir=/home/myuser/.local/share/akonadi/db_data/ --socket=/run/user/1000/akonadi/mysql.socket --pid-file=/run/user/1000/akonadi/mysql.pid &

- Then I backed up akonadi's DB and deleted it after:

mysqldump -Q --socket=/run/user/1000/akonadi/mysql.socket --add-drop-table akonadi > akonadi.sql
mysql--socket=/run/user/1000/akonadi/mysql.socket -e "DROP DATABASE akonadi"

- Stoped mysql:

mysqladmin -Q --socket=/run/user/1000/akonadi/mysql.socket shutdown

- Downgraded MariaDB 10.6.4 to 10.5.11 and started akonadi to recreate its database:

akonadictl start

- After a few seconds I stopped akonadi and restored the SQL dump:

/usr/libexec/mysqld --defaults-file=/home/myuser/.local/share/akonadi/mysql.conf --datadir=/home/myuser/.local/share/akonadi/db_data/ --socket=/run/user/1000/akonadi/mysql.socket --pid-file=/run/user/1000/akonadi/mysql.pid &

mysql --socket=/run/user/1000/akonadi/mysql.socket -e akonadi < akonadi.sql

- Shut down mysql, started akonadi again:

mysqladmin -Q --socket=/run/user/1000/akonadi/mysql.socket shutdown
akonadictl start

- Started kmail and everything looks good so far!


(Before trying all of this , out of caution, I made a backup of my mail folder and everything related to akonadi and kmail I found under ~/.cache/, ~/.config/ and ~/.local/)
Comment 4 Christophe Marin 2021-08-09 08:51:43 UTC
*** Bug 440772 has been marked as a duplicate of this bug. ***
Comment 5 Stefan 2021-08-09 12:06:45 UTC
Is it sure that this issue is related to MariaDB 1.6?

mysql --socket=/run/user/1000/akonadi/mysql.socket -e "SELECT @@version;"             
+-----------------+
| @@version       |
+-----------------+
| 10.5.10-MariaDB |
+-----------------+

Is this the current version of mariaDB what is used by akonadi?

I am running into the same today and have no idea whats changed since yesterday

I tried Ricados suggestion with 

"innodb_force_recovery = 2"

but after restarting akonadi, the same messages appear again and i can not send nor receives mails.


Operating System: openSUSE Tumbleweed 20210806
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.13.6-1-default (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-3770K CPU @ 3.50GHz
Memory: 31.2 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics 4000
Comment 6 Antonio Rojas 2021-08-09 12:13:05 UTC
(In reply to Stefan from comment #5)
> Is it sure that this issue is related to MariaDB 1.6?
> 
> mysql --socket=/run/user/1000/akonadi/mysql.socket -e "SELECT @@version;"   
> 
> +-----------------+
> | @@version       |
> +-----------------+
> | 10.5.10-MariaDB |
> +-----------------+
> 
> Is this the current version of mariaDB what is used by akonadi?
> 
> I am running into the same today and have no idea whats changed since
> yesterday

What do you mean by "the same"? The same symptoms doesn't mean it's the same issue. If you don't have the "Incorrect datetime value" in akonadi's output then your problem is a different one.
Comment 7 Stefan 2021-08-09 12:19:50 UTC
Sorry, yes there are the same messages in ~/.local/share/akonadi/Akonadi.error

2021-08-09T13:16:05 [CRITICAL] org.kde.pim.akonadiserver:   Error code: "1292"
2021-08-09T13:16:05 [CRITICAL] org.kde.pim.akonadiserver:   DB error:  "Incorrect datetime value: '2021-08-09T11:16:05Z' for column `akonadi`.`pimitemtable`.`atime` at row 1"
2021-08-09T13:16:05 [CRITICAL] org.kde.pim.akonadiserver:   Error text: "Incorrect datetime value: '2021-08-09T11:16:05Z' for column `akonadi`.`pimitemtable`.`atime` at row 1 QMYSQL: Die Abfrage konnte nicht ausgeführt werden"
2021-08-09T13:16:05 [CRITICAL] org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(QDateTime, QDateTime(2021-08-09 11:16:05.608 UTC Qt::UTC)))(":1", QVariant(qlonglong, 46287)))
2021-08-09T13:16:05 [CRITICAL] org.kde.pim.akonadiserver:   Query: "UPDATE PimItemTable SET atime = :0 WHERE ( ( PimItemTable.id = :1 ) )"
2021-08-09T13:16:05 [WARN ] org.kde.pim.akonadiserver: Unable to update item access time
2021-08-09T13:16:05 [INFO ] org.kde.pim.akonadiserver.search: Executing search "kontact-3240686485-SearchSession"
2021-08-09T13:16:05 [INFO ] org.kde.pim.akonadiserver.search: Search  "kontact-3240686485-SearchSession" done (without remote search)
2021-08-09T13:16:08 [CRITICAL] org.kde.pim.akonadiserver: DATABASE ERROR:
2021-08-09T13:16:08 [CRITICAL] org.kde.pim.akonadiserver:   Error code: "1292"
2021-08-09T13:16:08 [CRITICAL] org.kde.pim.akonadiserver:   DB error:  "Incorrect datetime value: '2021-08-09T11:16:08Z' for column `akonadi`.`pimitemtable`.`atime` at row 1"
2021-08-09T13:16:08 [CRITICAL] org.kde.pim.akonadiserver:   Error text: "Incorrect datetime value: '2021-08-09T11:16:08Z' for column `akonadi`.`pimitemtable`.`atime` at row 1 QMYSQL: Die Abfrage konnte nicht ausgeführt werden"
2021-08-09T13:16:08 [CRITICAL] org.kde.pim.akonadiserver:   Values: QMap((":0", QVariant(int, 1))(":1", QVariant(QString, "12512"))(":10", QVariant(qlonglong, 44443))(":2", QVariant(QString, ""))(":3", QVariant(QString, ""))(":4", QVariant(qlonglong, 284))(":5", QVariant(qlonglong, 3))(":6", QVariant(QDateTime, QDateTime(2021-07-14 08:23:39.000 CEST Qt::LocalTime)))(":7", QVariant(QDateTime, QDateTime(2021-08-09 11:16:08.395 UTC Qt::UTC)))(":8", QVariant(bool, false))(":9", QVariant(qlonglong, 20637)))
2021-08-09T13:16:08 [CRITICAL] org.kde.pim.akonadiserver:   Query: "UPDATE PimItemTable SET rev = :0, remoteId = :1, remoteRevision = :2, gid = :3, collectionId = :4, mimeTypeId = :5, datetime = :6, atime = :7, dirty = :8, size = :9 WHERE ( id = :10 )"
2021-08-09T13:16:08 [WARN ] org.kde.pim.akonadiserver: Error during updating record with id 44443  in table "PimItemTable" "Incorrect datetime value: '2021-08-09T11:16:08Z' for column `akonadi`.`pimitemtable`.`atime` at row 1 QMYSQL: Die Abfrage konnte nicht ausgeführt werden"
2021-08-09T13:16:08 [WARN ] org.kde.pim.akonadiserver: Error while handling command CreateItem on connection akonadi_imap_resource_1 (0x55c06fcdd970)
Comment 8 Antonio Rojas 2021-08-09 12:21:39 UTC
(In reply to Stefan from comment #7)
> Sorry, yes there are the same messages in
> ~/.local/share/akonadi/Akonadi.error

What's your mariadb client (not server) version?
Comment 9 Antonio Rojas 2021-08-09 12:29:14 UTC
*** Bug 440781 has been marked as a duplicate of this bug. ***
Comment 10 Stefan 2021-08-09 12:34:55 UTC
> What's your mariadb client (not server) version?

Installed by zypper 

https://software.opensuse.org/package/mariadb-client

$ zypper se -s mariadb-client
Repository-Daten werden geladen...
Installierte Pakete werden gelesen...

S | Name           | Type  | Version     | Arch   | Repository
--+----------------+-------+-------------+--------+-----------------------
i | mariadb-client | Paket | 10.5.10-1.1 | x86_64 | Haupt-Repository (OSS)
i | mariadb-client | Paket | 10.5.10-1.1 | x86_64 | openSUSE-20210604-0
Comment 11 Meinhard Ritscher 2021-08-09 12:40:35 UTC
I was hit by this bug too.
Comment 12 Antonio Rojas 2021-08-09 13:07:37 UTC
(In reply to Stefan from comment #10)
> > What's your mariadb client (not server) version?
> 
> Installed by zypper 

Looks like opensuse packages mariadb-connector-c separately, instead of using the bundled one in mariadb. So you'll be affected if you update mariadb-connector-c to 3.2.3, regardless of the mariadb package version.
Comment 13 Stefan 2021-08-09 16:26:19 UTC
> Looks like opensuse packages mariadb-connector-c separately, instead of using the bundled one in mariadb. So you'll be affected if you update mariadb-connector-c to 3.2.3, regardless of the mariadb package version.

Thank you very much for your analysis, your right.

This was a real monday-challenge for a common simple user like me. At first i was confused because no package "mariadb-connector-c" found on my machine. The package is (also?) called libmariadb3 (https://software.opensuse.org/package/libmariadb3)

cat /var/log/zypp/history | grep libmariadb3

2021-07-04 08:43:18|install|libmariadb3|3.1.13-2.1
2021-08-07 21:48:18|install|libmariadb3|3.2.3-1.1

sudo zypper install --oldpackage http://download.opensuse.org/tumbleweed/repo/oss/x86_64/libmariadb3-3.1.13-2.1.x86_64.rpm

After a reboot, the first sync takes a amount of time, but everything works as before the 2021-08-07.
Comment 14 Thiago Macieira 2021-08-09 20:38:35 UTC
Fix in Qt: https://codereview.qt-project.org/c/qt/qtbase/+/363880
Comment 15 Christophe Marin 2021-08-10 13:16:13 UTC
*** Bug 440777 has been marked as a duplicate of this bug. ***