Bug 372427

Summary: Some pictures do not display
Product: [Applications] digikam Reporter: Mick Sulley <mick>
Component: Database-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: critical CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 5.3.0   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed In: 5.4.0
Sentry Crash Report:
Attachments: Screenshot

Description Mick Sulley 2016-11-13 11:50:46 UTC
Created attachment 102205 [details]
Screenshot

Imported pictures from Canon EOS550 using standard DK import.  Pictures are present  in file manager but some of them do not display in Digikam.  
Also for the problem album the number of pictures indicated is wrong. In the left panel where it now shows the number of pictures in brackets after the directory name, it shows 450 pictures but there are only 106 displayed, the directory has 517 files, of which 378 are JPG, 41 are CR2, 98 are markup.  See attached screenshot.
This is a major problem.  I use Digikam as my management tool and now do not know how many pictures I have 'lost'.
Please let me know if there is any more information I can provide.
Comment 1 Maik Qualmann 2016-11-13 20:48:18 UTC
Do you use a MySQL or SQLite DB?

Maik
Comment 2 Mick Sulley 2016-11-13 22:15:35 UTC
(In reply to Maik Qualmann from comment #1)
> Do you use a MySQL or SQLite DB?
> 
> Maik

SQLite
Comment 3 Mick Sulley 2016-11-15 11:32:05 UTC
I have done a bit more investigation on this, the problem album has id = 1262.  If I open sqlite from command line and run
select * from images where album = 1262;
it lists a load of records but finishes with 
Error: database disk image is malformed
There are also some child albums as well, a select on any of those finishes with that error as well.  So I assume that this is why some of the pictures do not display.
Questions
1) How can I fix it?  Can I recreate the database without losing anything?
2) What could have caused this?
Comment 4 caulier.gilles 2016-11-19 17:03:29 UTC
The database can be re-constructed from scratch safety if you store all DK information in image files metadata.

In all case, make a backup of database.

Gilles Caulier
Comment 5 caulier.gilles 2016-11-25 16:02:22 UTC
Any feedback with current AppImage bundle for Linux ?

https://drive.google.com/drive/folders/0BzeiVr-byqt5Y0tIRWVWelRJenM

Gilles Caulier
Comment 6 Mick Sulley 2016-11-26 20:03:31 UTC
Unfortunately I have largely destroyed the evidence by creating new sub albums and copying the pictures.  However I thought I would try to see if I could find out anything using the new appImage.  It gets a bit complicated, sorry.  This is what I did - 

Created a guest user on my desktop (runs Mint18)
Copied my whole album to the guest account
Downloaded appImage5.4.0
Within the Album I have digikam4.db, my current database and digikam4.db.backup which was the one in use when I had the problem.  I renamed digikam4.db as .old and renamed digikam4.db.backup as digikam4.db to make it current again.
I then started DK5.4.0
The sub-album that had pictures missing is displayed, even though it no longer exists!  It has thumbnails in it, but if I double click any I get the message 'Failed to load image'  File properties shows the folder that was where the picture was, but that folder no longer exists.
I ran Rebuild Thumbnails and also Scan for new items from  Tools > Maintenance, the indicators on the bottom of the screen went up to 100% in a few seconds, however it took more than 2 hours before it actually finished.  When it had finished I see the original structure with boxes displayed for thumbnails and all the property information but no metadata.  There is no thumbnail and double click produces the message 'Failed to load image'.  Presumably this is because the database holds all of this information.
I then ran Sync Metadata and Database, but that doesn't seem to have changed anything.

My conclusion to al this is that my original problem was caused by a database corruption, what caused that I don't know.  I don't really see any point in pursuing this any further so I suggest that you close it.
Thanks
Mick
Comment 7 caulier.gilles 2016-11-26 21:54:15 UTC
Ok, 

Thanks for your feedback and your investigations.

Gilles Caulier