Details While trying to setup digiKam with internal mysql database from scratch (no migration), I got the following error: digikam.databaseserver: Database initializer: "mysql_install_db" ("--datadir=/home/simon/Programme/AppDaten/digikam5/.mysql.digikam/db_data") digikam.databaseserver: "WARNING: Could not write to config file /usr/my.cnf: Permission denied\n\nFATAL ERROR: Could not chown directory /home/simon/Programme/AppDaten/digikam5/.mysql.digikam/db_data\n" digikam.databaseserver: "Could not start database initializer.\nExecutable: mysql_install_db\nArguments: --datadir=/home/simon/Programme/AppDaten/digikam5/.mysql.digikam/db_data\nProcess error: Unknown error" digikam.databaseserver: Cannot start internal database server I investigated the error in databaseserver.cpp/h. I found the error in the arguments to mysql_install_db which missed a "--defaults-file" argument. However new error turned up after. The error/debug messages were not conclusive and the consistet more or less of one very long function riddled with return statements. So I refactored databaseserver.cpp. I am no c++ dev, so I did quite a bit of learning while writing the code. Therefore the result is certainly not perfect. But it runs without error, gives more information on errors and is in my opinion generally cleaner and more readable. I will attach patches, but the one for the cpp file is more or less useless, as almost everything is marked as change due to the restructuring. More detailed information can be derived from my github repository, i.e. the commit messages in the tree intdb_init-redone (https://github.com/imsodin/digiKam/commits/intdb_init-redone). Most of the changes happened in "Split startMYSQLDatabaseProcess into smaller functions". The branch is still compatible with master (at the time of writing), I will try to keep an up-to-date version with master in the branch "intdb_init-redone-current". Please test it and I hope you have time to look over the code as well. Any feedback is appreciated. Reproducible: Always Steps to Reproduce: 1. Start digiKam from scratch (no digikamrc, no database, no configs) 2. choose internal mysql database Actual Results: fails to initialise database (see error in Details) Expected Results: Initialise new database (which works with the patch)
Created attachment 100358 [details] Patch of header file after refactor
Created attachment 100359 [details] Patch of cpp file after refactor
Maik, Sound like this chnages your last patches in internal server before the 5.0.0 release... Right ? Gilles
Yes, I test the patch tonight and check under Windows. Maik
Simon, I think the problem was that --defaults-file is unknown under Windows with mysql_install_db.exe from MariaDB. I check it tonight. Maik
Created attachment 100378 [details] databaseserver.patch This patch is for commit. Changes: - fix missing i18n - fix QString compile error - remove struct databaseDirs - fix MySQL init command under Windows - code polishes Maik
Git commit 5cbda9fcc0d7a6c0c83b1538866e064325270302 by Maik Qualmann. Committed on 29/07/2016 at 19:02. Pushed by mqualmann into branch 'master'. apply patch #100378 from Simon to refactor internal database server code and fix database initializing FIXED-IN: 5.1.0 M +2 -1 NEWS M +394 -331 libs/database/server/databaseserver.cpp M +39 -8 libs/database/server/databaseserver.h http://commits.kde.org/digikam/5cbda9fcc0d7a6c0c83b1538866e064325270302
We also use again ".mysql.digikam" as DB directory. A hidden directory is better if it is in the album root. Maik
Created attachment 100382 [details] minor patch on top of maiks commits Thanks Maik for going over it and improve it. I have some minor points to add (additional.patch): - Aren't the i18n calls in the arguments to processErrorLog redundant as this argument is later on passed to i18n again? - One minor improvement over my own patch: In createMysqlFiles only create initCmdArgs if really necessary. The following questions are purely out of curiosity/my education, so feel free to ignore it, but I would appreciate a short answer: - You removed my struct workaround to make the private variables const. Obviously this is because my workaround was ugly and cumbersome. Is there a better way to make them const or is this in any case a useless thing to do? - Why is the msg argument to processErrorLog declared as a reference?
The i18n() call is required, otherwise the message would not be translated. For example: i18n("my Text %1", msg); The translator can only translate the text "my Text %1", the argument is not visible for the translator. Perhaps this link to reference : http://stackoverflow.com/questions/2104328/whats-the-best-way-to-send-qstrings-in-a-function-call
Git commit 28d594c6537d086c06cc737c26a9512e5d394835 by Maik Qualmann. Committed on 30/07/2016 at 05:41. Pushed by mqualmann into branch 'master'. create initCmdArgs if really necessary M +8 -8 libs/database/server/databaseserver.cpp http://commits.kde.org/digikam/28d594c6537d086c06cc737c26a9512e5d394835
Git commit f88ef9d28b55750bed458d0c3308a9d761d62b65 by Maik Qualmann. Committed on 30/07/2016 at 05:47. Pushed by mqualmann into branch 'master'. add debug M +1 -0 libs/database/server/databaseserver.cpp http://commits.kde.org/digikam/f88ef9d28b55750bed458d0c3308a9d761d62b65