Bug 435314 - DigiKam 7.3.0 doesn't respect the MySQL (MariaDB) database folder stipulated on settings, after migration from SQLITE
Summary: DigiKam 7.3.0 doesn't respect the MySQL (MariaDB) database folder stipulated ...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (show other bugs)
Version: 7.3.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-03 15:20 UTC by gctbrito
Modified: 2021-04-03 18:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 7.3.0
Sentry Crash Report:


Attachments
DigiKam uses MariaDB installation folder to store MySQL Internal database, instead of assigned folder in DigiKam settings (180.37 KB, image/jpeg)
2021-04-03 15:20 UTC, gctbrito
Details
mariaDB installation folder (129.69 KB, image/jpeg)
2021-04-03 17:15 UTC, gctbrito
Details
folder set in digikam settings that should be used as database (167.12 KB, image/jpeg)
2021-04-03 17:16 UTC, gctbrito
Details
DebugView log file after starting digikam (61.55 KB, text/plain)
2021-04-03 17:19 UTC, gctbrito
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gctbrito 2021-04-03 15:20:38 UTC
Created attachment 137312 [details]
DigiKam uses MariaDB installation folder to store MySQL Internal database, instead of assigned folder in DigiKam settings

SUMMARY
DigiKam isn't using the folder which I stipulate on DigiKam settings for storing the MySQL database. Instead, it saves all data (e.g. thumbnails, faces data, metadata) inside the MariaDB installation folder, in "C:\Program Files". The folder that should be used do get populated by some files, but only on database creation/migration, which doesn't get updated or modified posteriorly. 

STEPS TO REPRODUCE
1.  Updated from DigiKam 7.1.0 to 7.3.0, while still using SQLite as DigiKam database in "C:\folder-A\" (folder size ~3Gb)
2.  Performed clean MariaDB installation on "C:\Program Files\MariaDB 10.5\", following DigiKam suggested download link.
3.  Set system environment variable "Path" to include "C:\Program Files\MariaDB 10.5\"
4.  Modify DigiKam database configuration in "Setting > Configure DigiKam > Database > type" from SQLite to Mysql internal
5.  Modify DigiKam database configuration in "Setting > Configure DigiKam > Database > database location" to "C:\folder-B\"
6.  Modify DigiKam database configuration in "Setting > Configure DigiKam > Database > MySQL Binaries" to select "mysql_install_db.exe" and "mysqld.exe" in "C:\Program Files\MariaDB 10.5\bin\"
7.  Restart DigiKam
8.  Migrate SQLite database from "C:\folder-A" to MySQL internal "C:\folder-B" using DigiKam "Settings > Database migration" tool (around 40minutes to complete, no errors reported).
9.  Restart DigiKam
10. Start DigiKam

OBSERVED RESULT
- DigiKam data is clean, collections folder needs to be reselected; thumbnails, faces data, tags, etc are gone.
- DigiKam settings are preserved.
- Data from the previous SQLite "C:\folder-A" (~3GB) isn't migrated to MySQL internal "C:\folder-B" (~87MB).
- Newly generated data (thumbnails, faces data, tags, etc) is generated in "C:\Program Files\MariaDB 10.5\data\digikam\".
- Newly generated data doesn't cause any modification in MySQL Internal "C:\folder-B" thereafter, which remains with ~87MB.
- DigiKam "Setting > Configure DigiKam > Database > type" and "database location" are still set to MySQL Internal and to "C:\folder-B", respectively.

EXPECTED RESULT
- DigiKam data is preserved and migrated to MySQL Internal "C:\folder-B"
- Newly generated data goes to "C:\folder-B"

SOFTWARE/OS VERSIONS
Windows: 
Edition	Windows 10 Pro
Version	21H1
Installed on	‎2020-‎10-‎06
OS build	19043.867
Experience	Windows Feature Experience Pack 120.2212.3030.0
KDE Plasma Version: 
KDE Frameworks Version: KDE Frameworks 5.80.0
Qt Version:   Qt 5.15.2 (built against 5.15.2)

ADDITIONAL INFORMATION
Digikam version 7.3.0
Build date: 2021-04-01 19:09 (target: RelWithDebInfo)
Rev.: 70451ec1185a29ca7033879ed75795f8ea1c5cde
CPU cores: 4
Eigen: 3.3.7
Exiv2: 0.27.4
Exiv2 supports Base Media: Yes
Exiv2 supports XMP metadata: Yes
HEIF encoding support: Yes
ImageMagick codecs: 7.0.8
KF5: 5.80.0
LensFun: 0.3.95-0
LibCImg: 130
LibJPEG: 90
LibJasper: 2.0.23
LibLCMS: 2100
LibLqr support: No
LibPGF: 7.19.03
LibPNG: 1.6.37
LibRaw: 0.21.0
LibTIFF: 4.2.0
Marble: 0.27.20
Parallelized demosaicing: No
Qt: 5.15.2
Qt Webkit support: Yes
Rajce support: Yes
VKontakte support: No
AkonadiContact support: No
Baloo support: No
Calendar support: Yes
DBus support: No
Database backend: QMYSQL
Database internal server: Yes
HTML Gallery support: Yes
LibAVCodec: 58.54.100
LibAVFormat: 58.29.100
LibAVUtil: 56.31.100
LibGphoto2 support: No
LibOpenCV: 4.5.1
LibQtAV: 1.13.0
Media player support: Yes
Panorama support: Yes

Database backend: QMYSQL
Database internal server: Yes
Database internal server Path: D:/resources/03_data-apps/data-digikam-mysql-db
Database locale: System
Comment 1 Maik Qualmann 2021-04-03 15:35:10 UTC
Your approach reads right, but you will have done something wrong. Use the migration tool again to copy the database. I do this often to test the functions and databases of digiKam and have no problems.

Maik
Comment 2 Maik Qualmann 2021-04-03 15:42:18 UTC
Where does this difference in the paths come from:

5.  Modify DigiKam database configuration in "Setting > Configure DigiKam > Database > database location" to "C:\folder-B\"

And this:

Database internal server Path: D:/resources/03_data-apps/data-digikam-mysql-db

Maik
Comment 3 Maik Qualmann 2021-04-03 15:48:48 UTC
digiKam does not voluntarily use the MariaDB installation folder, nor does it normally have the necessary rights. I've never done this after installing MariaDB on Windows:

3.  Set system environment variable "Path" to include "C:\Program Files\MariaDB 10.5\"

Maik
Comment 4 gctbrito 2021-04-03 15:49:53 UTC
(In reply to Maik Qualmann from comment #2)
> Where does this difference in the paths come from:
> 
> 5.  Modify DigiKam database configuration in "Setting > Configure DigiKam >
> Database > database location" to "C:\folder-B\"
> 
> And this:
> 
> Database internal server Path:
> D:/resources/03_data-apps/data-digikam-mysql-db
> 
> Maik

Sorry, I used "C:\folder-B" only to simplify the explanation. The "folder-B" I'm using is actually this "D:/resources/03_data-apps/data-digikam-mysql-db";
"folder-A" would be "D:/resources/03_data-apps/data-digikam-SQLite-db";
Everything else is as stated
Comment 5 Maik Qualmann 2021-04-03 15:55:59 UTC
Is there a ".mysql.digikam" folder in the internal server path?

Maik
Comment 6 gctbrito 2021-04-03 16:02:19 UTC
(In reply to Maik Qualmann from comment #5)
> Is there a ".mysql.digikam" folder in the internal server path?
> 
> Maik

Yes, the ".mysql.digikam" gets created when I set the internal server path but remains unmodified after that.
Comment 7 Maik Qualmann 2021-04-03 16:22:50 UTC
So that we can see which settings are actually currently set, install DebugView from Microsoft and give us the log from the start, as described here for Windows:

https://www.digikam.org/contribute/

Don't forget to set the environment variable.

Maik
Comment 8 gctbrito 2021-04-03 17:15:47 UTC
Created attachment 137315 [details]
mariaDB installation folder
Comment 9 gctbrito 2021-04-03 17:16:31 UTC
Created attachment 137316 [details]
folder set in digikam settings that should be used as database
Comment 10 gctbrito 2021-04-03 17:19:11 UTC
Created attachment 137317 [details]
DebugView log file after starting digikam
Comment 11 gctbrito 2021-04-03 17:42:45 UTC
I'm sorry guys, the problem do seem to be step 3 (Set system environment variable "Path" to include "C:\Program Files\MariaDB 10.5\").
I set this env variable so I could use MariaDB on Windows Terminal later, which is not possible otherwise. 
Removing MariaDB folder as a system environment variable reverted the problem. DigiKam starts using the correct folder set in database settings and stops saving new data in MariaDB installation folder (and just leaves all data in there, as if never happened). 
I don't know if you could consider this a bug, but DigiKam did ignore the database folder set in settings. 
Thanks for your help! I'll try to find a way to use MariaDB on Windows Terminal without env var set.
Comment 12 Maik Qualmann 2021-04-03 18:31:37 UTC
Ok, thanks for the feedback, I'll close the bug.

Maik