summaryrefslogtreecommitdiffstats
path: root/source/l/akonadi/akonadi-mariadb-10.2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'source/l/akonadi/akonadi-mariadb-10.2.patch')
-rw-r--r--source/l/akonadi/akonadi-mariadb-10.2.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/source/l/akonadi/akonadi-mariadb-10.2.patch b/source/l/akonadi/akonadi-mariadb-10.2.patch
new file mode 100644
index 000000000..99b096fb3
--- /dev/null
+++ b/source/l/akonadi/akonadi-mariadb-10.2.patch
@@ -0,0 +1,65 @@
+commit 22c53fa2aa97c7f0b5d7a1947821c5b3aef9de0f
+Author: Heinz Wiesinger <pprkut@liwjatan.at>
+Date: Sun Sep 17 15:55:48 2017 +0200
+
+ Only remove init connections to the database on server shutdown.
+
+ With MariaDB 10.2 libmysqlclient was replaced with libmariadb that
+ changed how establishing database connections behaves. The MySQL
+ QSQL driver calls mysql_server_end() on QSqlDatabase::removeDatabase()
+ if the overall connection count dropped to 0 (which it does when
+ the init connection is removed).
+ A future QSqlDatabase:addDatabase() would call mysql_server_init()
+ again, but this no longer works with libmariadb as that one only
+ allows calling mysql_server_init() once. Future calls are simply
+ ignored.
+
+ In order to prevent this from happening we have to keep the
+ init connection open until the server shuts down, so the connection
+ count only drops to 0 at shutdown and mysql_server_end() isn't
+ called before.
+
+ This is a workaround for QTBUG-63108
+
+diff --git a/server/src/akonadi.cpp b/server/src/akonadi.cpp
+index 5369320c8..6d31f6ff4 100644
+--- a/server/src/akonadi.cpp
++++ b/server/src/akonadi.cpp
+@@ -370,12 +370,13 @@ void AkonadiServer::createDatabase()
+ db.close();
+ }
+ }
+- QSqlDatabase::removeDatabase( initCon );
+ }
+
+ void AkonadiServer::stopDatabaseProcess()
+ {
+ if ( !DbConfig::configuredDatabase()->useInternalServer() ) {
++ // closing initConnection this late to work around QTBUG-63108
++ QSqlDatabase::removeDatabase(QLatin1String("initConnection"));
+ return;
+ }
+
+diff --git a/server/src/storage/dbconfigmysql.cpp b/server/src/storage/dbconfigmysql.cpp
+index 10f99db70..36f1f3a42 100644
+--- a/server/src/storage/dbconfigmysql.cpp
++++ b/server/src/storage/dbconfigmysql.cpp
+@@ -395,8 +395,6 @@ void DbConfigMysql::startInternalServer()
+ db.close();
+ }
+ }
+-
+- QSqlDatabase::removeDatabase( initCon );
+ }
+
+ void DbConfigMysql::stopInternalServer()
+@@ -405,6 +403,9 @@ void DbConfigMysql::stopInternalServer()
+ return;
+ }
+
++ // closing initConnection this late to work around QTBUG-63108
++ QSqlDatabase::removeDatabase(QLatin1String("initConnection"));
++
+ // first, try the nicest approach
+ if ( !mCleanServerShutdownCommand.isEmpty() ) {
+ QProcess::execute( mCleanServerShutdownCommand );