Bug 241977 - Akonadi prints a fatal error but starts anyways
Summary: Akonadi prints a fatal error but starts anyways
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: server (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Volker Krause
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-17 11:51 UTC by Andre Heinecke
Modified: 2010-10-23 23:59 UTC (History)
5 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 Andre Heinecke 2010-06-17 11:51:53 UTC
Version:           unspecified (using Devel) 
OS:                Linux

On GNU/Linux, MacOS you get:
[akonadiserver] /usr/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket
 '/home/andre/.local/share/akonadi/db_misc/mysql.socket' (2) when trying to connect
[akonadiserver] FATAL ERROR: Upgrade failed

Akonadi then appears to be started correctly anyways. 
Then the Message FATAL ERROR is incorrect and confuses the user.


Reproducible: Always

Steps to Reproduce:
Using internal mysql server configuration on a clean installation "akdonadictl start" prints this ERROR as one of the first messages.


Expected Results:  
Akonadi waits for the Database to initialize, then tries to connect and does not show a Fatal error

akonadictl start
Starting Akonadi Server...
   done.
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
(komo_dev)andre@komodowaran:~/shared/develop/kde_trunk$ [akonadiserver] search paths:  ("/home/andre/sha
red/develop/kde_trunk/bin", "/home/andre/shared/develop/kde_trunk/../kde_shared/qt/bin", "/usr/local/bin
", "/usr/local/sbin", "/usr/local/bin", "/usr/sbin", "/usr/bin", "/sbin", "/bin", "/usr/games", "/usr/sb
in", "/usr/local/sbin", "/usr/local/libexec", "/usr/libexec", "/opt/mysql/libexec", "/opt/local/lib/mysq
l5/bin", "/opt/mysql/sbin")
[akonadiserver] Found mysql_install_db:  "/usr/bin/mysql_install_db"
[akonadiserver] Found mysql_upgrade:  "/usr/bin/mysql_upgrade"
"akonadiserver" [out] "Looking for 'mysql' as: /usr/bin/mysql
"
"akonadiserver" [out] "Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
"
"akonadiserver" [out] "Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/
mysqld/mysqld.sock' '--socket=/home/andre/.local/share/akonadi/db_misc/mysql.socket'
"
[akonadiserver] /usr/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket
 '/home/andre/.local/share/akonadi/db_misc/mysql.socket' (2) when trying to connect
[akonadiserver] FATAL ERROR: Upgrade failed
[akonadiserver] Database "akonadi" opened using driver "QMYSQL"
[akonadiserver] DbInitializer::run()
[akonadiserver] checking table  "SchemaVersionTable"
[akonadiserver] checking table  "ResourceTable"
[akonadiserver] checking table  "CollectionTable"
[akonadiserver] checking table  "MimeTypeTable"
[akonadiserver] checking table  "PimItemTable"
[akonadiserver] checking table  "FlagTable"
[akonadiserver] checking table  "PartTable"
[akonadiserver] checking table  "CollectionAttributeTable"
[akonadiserver] checking relation  "PimItemFlagRelation"
[akonadiserver] checking relation  "CollectionMimeTypeRelation"
[akonadiserver] checking relation  "CollectionPimItemRelation"
[akonadiserver] DbInitializer::run() done
[akonadiserver] skipping update 2
[akonadiserver] skipping update 3
[akonadiserver] skipping update 4
[akonadiserver] skipping update 8
[akonadiserver] skipping update 10
[akonadiserver] skipping update 12
[akonadiserver] skipping update 13
[akonadiserver] skipping update 14
[akonadiserver] skipping update 15
[akonadiserver] skipping update 16
[akonadiserver] Database "akonadi" opened using driver "QMYSQL"
Comment 1 Tobias Koenig 2010-08-02 21:25:03 UTC
Hej Andre,

can you still reproduce it with a current version?

Ciao,
Tobias
Comment 2 Andre Heinecke 2010-08-03 10:51:04 UTC
Tested again with akonadi from trunk, Revision: 1158618
Still the same problem, according to Volker Krause this error message happens because mysql_upgrade is called every startup just in case a distribution changed the mysql Version. 

If you do not see it, do you have mysql_upgrade installed?


Output section:

[akonadiserver] Found mysql_install_db:  "/usr/bin/mysql_install_db"
[akonadiserver] Found mysql_upgrade:  "/usr/bin/mysql_upgrade"
"akonadiserver" [out] "Looking for 'mysql' as: /usr/bin/mysql
"
"akonadiserver" [out] "Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
"
"akonadiserver" [out] "Running 'mysqlcheck' with connection arguments: '--port=3306' '--socket=/var/run/mysqld/mysqld.sock' '--socket=/home/komodev/.kde4_trunk/xdg_data/akonadi/db_misc/mysql.socket'
"
[akonadiserver] /usr/bin/mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/home/komodev/.kde4_trunk/xdg_data/akonadi/db_misc/mysql.socket' (2) when trying to connect
[akonadiserver] FATAL ERROR: Upgrade failed
[akonadiserver] Database "akonadi" opened using driver "QMYSQL"
[akonadiserver] DbInitializer::run()
Comment 3 Tobias Koenig 2010-08-03 17:22:41 UTC
SVN commit 1158741 by tokoe:

Move the mysql_upgrade call to a place where we
have made sure that mysqld is up and running and accepts
connections. This will avoid mysql_upgrade to fail with the
FATAL ERROR message.

BUG: 241977


 M  +5 -5      dbconfigmysql.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1158741
Comment 4 Will Stephenson 2010-08-15 18:36:00 UTC
SVN commit 1164039 by wstephens:

Backports from 1.4 branch, agreed with tokoe:
  r1158741
  Move the mysql_upgrade call to a place where we
  have made sure that mysqld is up and running and accepts
  connections. This will avoid mysql_upgrade to fail with the
  FATAL ERROR message.

  BUG: 241977
  r1159382 | tokoe | 2010-08-05 11:02:10 +0200 (Thu, 05 Aug 2010) | 5
  lines

  Do not use 'mysql_upgrade', it will call 'mysql_fix_privilege_tables'
  internally
  which prevents us from further logins. Only call 'mysqlcheck' instead,
  which
  does the checks we want to have.



 M  +12 -7     akonadi.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1164039
Comment 5 Tobias Koenig 2010-10-23 23:59:43 UTC
commit 9515cc990364060a08021184c22a4a9bd84ffb03
branch refs/tags/v1.4.1
Author: Tobias Koenig <tokoe@kde.org>
Date:   Tue Aug 3 15:24:27 2010 +0000

    Move the mysql_upgrade call to a place where we
    have made sure that mysqld is up and running and accepts
    connections. This will avoid mysql_upgrade to fail with the
    FATAL ERROR message.
    
    BUG: 241977
    
    svn path=/branches/akonadi/1.4/; revision=1158741

diff --git a/server/src/storage/dbconfigmysql.cpp b/server/src/storage/dbconfigmysql.cpp
index 19818a2..833ba5f 100644
--- a/server/src/storage/dbconfigmysql.cpp
+++ b/server/src/storage/dbconfigmysql.cpp
@@ -267,11 +267,6 @@ void DbConfigMysql::startInternalServer()
     akFatal() << "process error:" << mDatabaseProcess->errorString();
   }
 
-  if ( !mMysqlUpgradeDBPath.isEmpty() ) {
-    const QStringList arguments = QStringList() << QString::fromLatin1( "--socket=%1/mysql.socket" ).arg( miscDir );
-    QProcess::execute( mMysqlUpgradeDBPath, arguments );
-  }
-
   const QLatin1String initCon( "initConnection" );
   {
     QSqlDatabase db = QSqlDatabase::addDatabase( QLatin1String( "QMYSQL" ), initCon );
@@ -298,6 +293,11 @@ void DbConfigMysql::startInternalServer()
     }
 
     if ( opened ) {
+      if ( !mMysqlUpgradeDBPath.isEmpty() ) {
+        const QStringList arguments = QStringList() << QLatin1String( "--verbose" ) << QString::fromLatin1( "--socket=%1/mysql.socket" ).arg( miscDir );
+        QProcess::execute( mMysqlUpgradeDBPath, arguments );
+      }
+
       {
         QSqlQuery query( db );
         if ( !query.exec( QString::fromLatin1( "USE %1" ).arg( mDatabaseName ) ) ) {