[Digikam-devel] [digikam] [Bug 350574] MIGRATION: MySQL to SQLite fails [patch]

Richard Mortimer via KDE Bugzilla bugzilla_noreply at kde.org
Wed Jul 27 01:00:08 BST 2016


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

--- Comment #11 from Richard Mortimer <richm+kde at oldelvet.org.uk> ---
(In reply to caulier.gilles from comment #10)
> Richard,
> 
> Swati has proposed a simple patch for this file. Any viewpoint about ?
> 
> Gilles Caulier

I've been discussing the issue with Swati via email today. I don't think that
the patch is a fix for the problem.

The TagsTree is getting migrated wrongly. The attempt to remove the triggers
was just to show that the trigger was definitely causing the problem. I can see
a number of issues:

First off the Tags migration is potentially broken because to work properly
with referential integrity the entries need to be migrated from the root of the
tree outwards. Without that the parent references may not be present when a
child is added. In most cases things will work out fine because the parent will
likely have a lower numbered primary key than the child and hence sorting by id
will make things better. But it is easy to see how things might go wrong if
tags are moved around in the tree. It is easy to detect by looking for entries
where pid > id. But at present things may be broken.

Secondly it seems that either duplicate TagsTree entries are getting added or
maybe somehow not getting added correctly. This needs investigation. It should
be fairly simple to do because it seems that things can be reproduced easily so
it will be possible to use the sqlite3 commandline to investigate the state of
the database when things go wrong.

I'm actually wondering if the add_tag (and other) trigger is getting added to
the database twice. I think I remember that SQLite can have multiple triggers
on one table so maybe there are two triggers trying to add an entry into the
TagsTree table.

Looking at the coreschemaupdater.cpp file there are two places where
createTriggers() is called so that may be relevant. Note I only did a very
quick look at the source so it might be a misleading idea. But I think there is
more investigation that needs doing to find the cause of the problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.



More information about the Digikam-devel mailing list