Bug 272301 - Mysql database corruption upon tag hierarchy removal
Summary: Mysql database corruption upon tag hierarchy removal
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (show other bugs)
Version: 2.0.0
Platform: Unlisted Binaries Linux
: NOR major
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-03 04:46 UTC by Ilia K.
Modified: 2017-07-19 13:53 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilia K. 2011-05-03 04:46:47 UTC
Version:           2.0.0 (using KDE 4.6.2) 
OS:                Linux

I'm running digikam 2.0-beta4 from philip5 PPA for Kubuntu 10.10.
I use mysql 5.1 database from Ubuntu 10.04 as DB storage. My collection has right now 30-50 tags and several thousands photos (thank goodness I have all metadata in files!).

When non-leaf tag is deleted, other tags may be deleted from the database or become unreachable from the root (which hides them in GUI). I guess it may be a bug in SQL queries (e.g. deletion triggers and maybe interaction between them, or missed locking).

Reproducible: Always

Steps to Reproduce:
1. Create nested tags /tag1/tag2/tag3
2. Delete tag1 (this deletes tag2 & tag3 as well)
3. Restart digikam

Actual Results:  
Some or all tags are missing due to inconsistent Tags table (and maybe others). 

I haven't noticed other tags being affected if instead of step 2 above I delete tag3, then tag2, then tag1 (i.e. each time delete a leaf tag).

Expected Results:  
All non-related tags are unaffected
Comment 1 Marcel Wiesweg 2011-05-03 22:07:45 UTC
Can you provide the affected database file (private mail is fine) along with a list of the relevant tags?
Comment 2 Francesco Riosa 2011-05-10 23:20:20 UTC
Git commit 559160b3d730439d845329c4a1b367f8a0b3ee03 by Francesco Riosa.
Committed on 10/05/2011 at 23:08.
Pushed by riosa into branch 'master'.

on delete trigger did a bit too much cleanup

according to:
http://dev.mysql.com/tech-resources/articles/hierarchical-data.html
only elemnts between `lft` and `rgt` need to be deleted, not the whole
hiearchy, also populate it again is not needed.

Maybe during migration or in some other particular case better handling
is required. These cases still need to be found and addressed ATM.

This possibly close
CCBUG: 272301

M  +7    -12   data/database/dbconfig.xml.cmake     

http://commits.kde.org/digikam/559160b3d730439d845329c4a1b367f8a0b3ee03
Comment 3 Francesco Riosa 2011-05-16 01:17:30 UTC
(In reply to comment #2)
this bug is fixed, please reopen if feel otherwise