<div dir="ltr">I've sent the PR. Please review.<div><br></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=ac3dhdGlsb2RoYTI3QGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=c434da86-0c69-4151-a9b3-08b28fc37728"><font color="#ffffff" size="1">ᐧ</font></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 5, 2016 at 3:41 AM, Swati Lodha <span dir="ltr"><<a href="mailto:swatilodha27@gmail.com" target="_blank">swatilodha27@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes. <div><br></div><div>I'll commit now. Was waiting for verification.</div><div><br></div><div>Thank you.</div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=ac3dhdGlsb2RoYTI3QGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=efdd161e-7537-4881-8ccd-48ee3e6cb805"><font color="#ffffff" size="1">ᐧ</font></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 5, 2016 at 3:39 AM, Gilles Caulier <span dir="ltr"><<a href="mailto:caulier.gilles@gmail.com" target="_blank">caulier.gilles@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The patch sound good.<div><br></div><div>Did you have a working ssh connexion now to commit yourself in KDE repository ?</div><span><font color="#888888"><div><br></div><div>`Gilles Caulier</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-06-04 20:43 GMT+02:00 Swati Lodha <span dir="ltr"><<a href="mailto:swatilodha27@gmail.com" target="_blank">swatilodha27@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Final patch for coredb.cpp<div><br></div><div>Thank you.</div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=ac3dhdGlsb2RoYTI3QGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=e495b0ef-2d88-443d-b4a8-59f381e79e51"><font color="#ffffff" size="1">ᐧ</font></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 3, 2016 at 11:44 PM, Gilles Caulier <span dir="ltr"><<a href="mailto:caulier.gilles@gmail.com" target="_blank">caulier.gilles@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">This patch sound fine.<div><br></div><div>I would to know the Marcel viewpoint here, just to be sure.</div><div><br></div><div>Take a care, the patch version 1 is also included in this one.</div><span><font color="#888888"><div><br></div><div>Gilles Caulier</div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">2016-06-02 21:29 GMT+02:00 Swati Lodha <span dir="ltr"><<a href="mailto:swatilodha27@gmail.com" target="_blank">swatilodha27@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Check this patch too.<div><br></div><div>Thank you.</div><div><br></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=ac3dhdGlsb2RoYTI3QGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=54144c93-8d62-4c5f-8d3f-22011afccc80"><font color="#ffffff" size="1">ᐧ</font></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 3, 2016 at 12:37 AM, Swati Lodha <span dir="ltr"><<a href="mailto:swatilodha27@gmail.com" target="_blank">swatilodha27@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Please check this patch.<div><br></div><div>Sorry for inconvenience.</div><div><br></div><div><br></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=ac3dhdGlsb2RoYTI3QGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=3d940e4e-c86c-4ac8-bc5c-815728d5c915"><font color="#ffffff" size="1">ᐧ</font></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 2, 2016 at 11:56 PM, Swati Lodha <span dir="ltr"><<a href="mailto:swatilodha27@gmail.com" target="_blank">swatilodha27@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Please find attached patch file for the same.<div><br></div><div>Thank you.</div><div><br></div><div><br></div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=ac3dhdGlsb2RoYTI3QGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=811aabe6-066e-4fe4-85ae-273485f691fa"><font color="#ffffff" size="1">ᐧ</font></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 2, 2016 at 8:57 PM, Swati Lodha <span dir="ltr"><<a href="mailto:swatilodha27@gmail.com" target="_blank">swatilodha27@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello <div><br></div><div>In coredb.cpp:4547 ";" is missing after the UPDATE query. This change should be committed?</div><div><br></div><div>Regards</div></div><div hspace="streak-pt-mark" style="max-height:1px"><img style="width:0px;max-height:0px;overflow:hidden" src="https://mailfoogae.appspot.com/t?sender=ac3dhdGlsb2RoYTI3QGdtYWlsLmNvbQ%3D%3D&type=zerocontent&guid=96d7f516-df8f-456d-97c8-a404db39714a"><font color="#ffffff" size="1">ᐧ</font></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 1, 2016 at 6:14 PM, Richard Mortimer <span dir="ltr"><<a href="mailto:richm+digikam@oldelvet.org.uk" target="_blank">richm+digikam@oldelvet.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 01/06/2016 10:12, Swati Lodha wrote:<br>
> I understand this now. Thank you for clarification.<br>
><br>
> So as it mentioned around coredb.cpp:549<br>
><br>
>     549  // We need to work around the table constraint, no we want to<br>
>     delete older stale albums with<br>
>     550  // the same relativePath, and adjust relativePaths depending on<br>
>     albumRoot.<br>
><br>
><br>
> I think that this needs to be done?<br>
<br>
</span>It is all part of the bigger picture that needs considering to allow<br>
referential integrity to be applied across the (MySQL) database. I don't<br>
have the years of experience with digikam that Marcel does but I think<br>
the following is required:<br>
<br>
1 - apply "ideal" referential integrity to the MySQL digikam schema<br>
(mostly done).<br>
<br>
2 - now identify where things break down due to interaction with the<br>
outside world (file systems, other photo editors/tools). Generally I<br>
think this is easy to spot and is normally the root of an information<br>
hierarchy. (tags tree, albums, album roots spring to mind).<br>
<br>
I think that digikam has been pretty consistent with using a magic "0"<br>
value to represent where something no-longer fits into a hierarchy but<br>
is likely to re-appear in due course.<br>
<br>
3 - Once identified the architectural decision is how to handle it in a<br>
database configured to enforce referential integrity. Bear in mind that<br>
this needs to continue to support SQLite too without having to add too<br>
many special cases. Note that SQLite is capable of supporting<br>
referential integrity so the choice may be to adopt the same solution<br>
for both.<br>
<br>
Really the choices for handling the orphaned items are:<br>
<br>
a - disable referential integrity on those affected fields. That is<br>
almost trivial to implement but does negate some of the benefits.<br>
<br>
b - add "special" internal rows that can be used to collect these<br>
temporarily orphaned nodes. I know that there is one at the root of the<br>
tags tree for MySQL. Note they are a bit tricky to arrange because they<br>
really need to be created with a primary key of zero to match the<br>
existing behaviour of putting zero in there.<br>
<br>
c - change to use null instead of a magic placeholder value. That is<br>
probably a purer solution but does create differences between SQLite and<br>
MySQL.<br>
<br>
I'd probably suggest that option b is the right one to minimise chances<br>
of short/medium term breakage but would be interested to know what<br>
others think.<br>
<br>
Regards<br>
<br>
Richard<br>
<br>
P.S. even if b & c are chosen there are some potential issues that may<br>
occur if multiple orphaned tags, folders, images have the same name.<br>
That will trip up with existing "unique" constraints on the database. I<br>
suspect that this should just be left as "good enough" for now.<br>
<br>
<br>
><br>
> Regards<br>
> ᐧ<br>
><br>
<span>> On Wed, Jun 1, 2016 at 2:28 PM, Marcel Wiesweg <<a href="mailto:marcel.wiesweg@gmx.de" target="_blank">marcel.wiesweg@gmx.de</a><br>
</span><span>> <mailto:<a href="mailto:marcel.wiesweg@gmx.de" target="_blank">marcel.wiesweg@gmx.de</a>>> wrote:<br>
><br>
>     Have a look at the (rather complex) CollectionScanner.<br>
><br>
>     The problem is the nature of our scan, which will always run in all<br>
>     kinds of<br>
>     race conditions with the file system.<br>
><br>
>     When a folder is moved, we may notice that it is removed at the previous<br>
>     location. Later, we see it appear at the new location. It would be<br>
>     unfortunate<br>
>     to have completely deleted all album metadata in the meantime.<br>
>     Therefore, it<br>
>     is made a stale album, which can be resurrected later if a new place<br>
>     can be<br>
>     identified.<br>
><br>
>     This is done in a similar way for images. Here, we can identify them by<br>
>     content, so the storage of "removed" images is even more extensively<br>
>     done.<br>
><br>
><br>
><br>
>     > This query is executed in core/libs/database/coredb.cpp:576 in the function<br>
>     > to create stale Albums, that is why the albumRoot has been set to 0.<br>
>     ><br>
>     > I would like to ask why is there a need to create the stale Albums?<br>
>     ><br>
>     > Regards<br>
>     > ᐧ<br>
>     ><br>
>     > On Wed, Jun 1, 2016 at 1:19 AM, Marcel Wiesweg<br>
</span>>     <<a href="mailto:marcel.wiesweg@gmx.de" target="_blank">marcel.wiesweg@gmx.de</a> <mailto:<a href="mailto:marcel.wiesweg@gmx.de" target="_blank">marcel.wiesweg@gmx.de</a>>><br>
<div><div>>     ><br>
>     > wrote:<br>
>     > > Please check the context where it is called, but I am quite sure<br>
>     that<br>
>     > > there is<br>
>     > > a special meaning in setting album root to 0.<br>
>     > > I'm sure there is a similar case with deleted images where album<br>
>     is set to<br>
>     > > 0,<br>
>     > > but the entry is preserved in case the image reappears at a<br>
>     different<br>
>     > > place<br>
>     > > (moving files where the removal is noticed first)<br>
>     > ><br>
>     > > Marcel<br>
>     > ><br>
>     > > > Hello.<br>
>     > > ><br>
>     > > > I was facing this error from past few days:<br>
>     > > ><br>
>     > > > MariaDB [digikam]> update Albums set albumRoot=0 where id=10;<br>
>     > > ><br>
>     > > > > ERROR 1452 (23000): Cannot add or update a child row: a<br>
>     foreign key<br>
>     > > > > constraint fails (`digikam`.`Albums`, CONSTRAINT<br>
>     `Albums_AlbumRoot<br>
>     > > > > s` FOREIGN KEY (`albumRoot`) REFERENCES `AlbumRoots` (`id`)<br>
>     ON DELETE<br>
>     > > > > CASCADE ON UPDATE CASCADE)<br>
>     > > ><br>
>     > > > I figured out that as 'id' is AlbumRoots table is not 0. So<br>
>     'albumRoot'<br>
>     > ><br>
>     > > in<br>
>     > ><br>
>     > > > Images table can't be set to 0. This is I think the possible<br>
>     reason for<br>
>     > ><br>
>     > > FK<br>
>     > ><br>
>     > > > constraint failing.<br>
>     > > ><br>
>     > > > I used this statement instead & it worked:<br>
>     > > ><br>
>     > > > MariaDB [digikam]> update Albums set albumRoot=1 where id=10;<br>
>     > > ><br>
>     > > > > Query OK, 0 rows affected (0.06 sec)<br>
>     > > > > Rows matched: 1  Changed: 0  Warnings: 0<br>
>     > > ><br>
>     > > > Please look into this.<br>
>     > > ><br>
>     > > > Regards<br>
>     > > > ᐧ<br>
>     > ><br>
>     > > _______________________________________________<br>
>     > > Digikam-devel mailing list<br>
</div></div>>     > > <a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a> <mailto:<a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a>><br>
<span>>     > > <a href="https://mail.kde.org/mailman/listinfo/digikam-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br>
><br>
>     _______________________________________________<br>
>     Digikam-devel mailing list<br>
</span>>     <a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a> <mailto:<a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a>><br>
<div><div>>     <a href="https://mail.kde.org/mailman/listinfo/digikam-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> Digikam-devel mailing list<br>
> <a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a><br>
> <a href="https://mail.kde.org/mailman/listinfo/digikam-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br>
><br>
_______________________________________________<br>
Digikam-devel mailing list<br>
<a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/digikam-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Digikam-devel mailing list<br>
<a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/digikam-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Digikam-devel mailing list<br>
<a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/digikam-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Digikam-devel mailing list<br>
<a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/digikam-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Digikam-devel mailing list<br>
<a href="mailto:Digikam-devel@kde.org" target="_blank">Digikam-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/digikam-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/digikam-devel</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>