[digikam] [Bug 366219] New: Setting up internal mysql database fails

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] New: Setting up internal mysql database fails

bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

            Bug ID: 366219
           Summary: Setting up internal mysql database fails
           Product: digikam
           Version: 5.0.0
          Platform: Other
                OS: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Database-Setup
          Assignee: [hidden email]
          Reporter: [hidden email]

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)

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails

bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #1 from Simon <[hidden email]> ---
Created attachment 100358
  --> https://bugs.kde.org/attachment.cgi?id=100358&action=edit
Patch of header file after refactor

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #2 from Simon <[hidden email]> ---
Created attachment 100359
  --> https://bugs.kde.org/attachment.cgi?id=100359&action=edit
Patch of cpp file after refactor

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

[hidden email] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[hidden email],
                   |                            |[hidden email]
             Status|UNCONFIRMED                 |CONFIRMED
     Ever confirmed|0                           |1
            Summary|Setting up internal mysql   |Setting up internal mysql
                   |database fails              |database fails [patch]

--- Comment #3 from [hidden email] ---
Maik,

Sound like this chnages your last patches in internal server before the 5.0.0
release... Right ?

Gilles

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #4 from Maik Qualmann <[hidden email]> ---
Yes, I test the patch tonight and check under Windows.

Maik

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #5 from Maik Qualmann <[hidden email]> ---
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

Maik Qualmann <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #100358|0                           |1
        is obsolete|                            |

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

Maik Qualmann <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #100359|0                           |1
        is obsolete|                            |

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #6 from Maik Qualmann <[hidden email]> ---
Created attachment 100378
  --> https://bugs.kde.org/attachment.cgi?id=100378&action=edit
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

Maik Qualmann <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|                            |http://commits.kde.org/digi
                   |                            |kam/5cbda9fcc0d7a6c0c83b153
                   |                            |8866e064325270302
         Resolution|---                         |FIXED
   Version Fixed In|                            |5.1.0
             Status|CONFIRMED                   |RESOLVED

--- Comment #7 from Maik Qualmann <[hidden email]> ---
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #8 from Maik Qualmann <[hidden email]> ---
We also use again ".mysql.digikam" as DB directory. A hidden directory is
better if it is in the album root.

Maik

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #9 from Simon <[hidden email]> ---
Created attachment 100382
  --> https://bugs.kde.org/attachment.cgi?id=100382&action=edit
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?

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #10 from Maik Qualmann <[hidden email]> ---
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #11 from Maik Qualmann <[hidden email]> ---
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

[digikam] [Bug 366219] Setting up internal mysql database fails [patch]

bugzilla_noreply
In reply to this post by bugzilla_noreply
https://bugs.kde.org/show_bug.cgi?id=366219

--- Comment #12 from Maik Qualmann <[hidden email]> ---
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

--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel