Bug 406942 - Thumbnails does not get saved for videofiles over 2^32b, mysql
Summary: Thumbnails does not get saved for videofiles over 2^32b, mysql
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Thumbs (show other bugs)
Version: 6.1.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-27 00:17 UTC by bugskdeorg.20.dimon3000
Modified: 2019-04-28 17:47 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 6.2.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugskdeorg.20.dimon3000 2019-04-27 00:17:43 UTC
SUMMARY

Modern cameras can produce video files of extremely large size. Metadata / thumbnails of which does not fit in MySQL columns.

STEPS TO REPRODUCE

Use MySQL. Sqlite is not tested, but theoretically is not affected.

1. Create a video file with a size larger than 2^32-1 bytes (take a bit more, to be sure :)
2. Add it to Digicam collection
3. Let digikam scan the file and create a thumbnail of it.

OBSERVED RESULT

Thumbnail is created but it is recreated whenever you see the video file.
SQL Replace operation fails
Translation is kept open.

EXPECTED RESULT

Thumbnail is created only once, successfully stored into the database.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 19.04 x86_64 appimage
KDE Plasma Version: ?
KDE Frameworks Version: ?
Qt Version: ?

ADDITIONAL INFORMATION

MySQL 8.0.16

Debug log
> Digikam::DMetadata::loadUsingFFmpeg: Parse metadada with FFMpeg: "/media/dimon3000/Documents/Dmitry/Pictures/Фото/2018/2018-03-09 Доха-Тайланд/GoPro/GP010224.MP4"
> Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg video stream metadata entries :
> Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2018-03-20T16:38:14.000000")("encoder", "GoPro AVC encoder")("handler_name", "\rGoPro AVC")("language", "eng"))
> Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
> Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg audio stream metadata entries :
> Digikam::DMetadata::loadUsingFFmpeg: QMap(("creation_time", "2018-03-20T16:38:14.000000")("handler_name", "\rGoPro AAC")("language", "eng"))
> Digikam::DMetadata::loadUsingFFmpeg: -----------------------------------------
> Digikam::DMetadata::loadUsingFFmpeg: -- FFMpeg root container metadata entries :
> Digikam::DMetadata::loadUsingFFmpeg: QMap(("compatible_brands", "avc1isom")("creation_time", "2018-03-20T16:38:14.000000")("firmware", "HD3.03.03.00")("major_brand", "avc1")("minor_version", "0"))
> Digikam::DMetadata::loadUsingFFmpeg: ------------------------------------------
> Digikam::ThumbnailCreator::createThumbnail: Trying to load video preview with FFmpeg
> Digikam::BdEngineBackendPrivate::debugOutputFailedQuery: Failure executing query:
> "REPLACE INTO UniqueHashes (uniqueHash, fileSize, thumbId) VALUES (?,?,?);" 
> Error messages: "QMYSQL3: Unable to execute statement" "Out of range value for column 'fileSize' at row 1" 1264 2 
> Bound values:  (QVariant(QString, "73930f5548eb6fbe08f123905a2e88c9"), QVariant(qlonglong, 3854467646), QVariant(int, 183429))
> Digikam::DbEngineThreadData::~DbEngineThreadData: WARNING !!! Transaction count is 18 when destroying database!!!


> > describe UniqueHashes;
> +------------+--------------+------+-----+---------+-------+
> | Field      | Type         | Null | Key | Default | Extra |
> +------------+--------------+------+-----+---------+-------+
> | uniqueHash | varchar(128) | YES  | MUL | NULL    |       |
> | fileSize   | int(11)      | YES  |     | NULL    |       |
> | thumbId    | int(11)      | YES  | MUL | NULL    |       |
> +------------+--------------+------+-----+---------+-------+
> 3 rows in set (0,00 sec)


Use "bigint unsigned" for storing file sizes in MySQL.
Comment 1 bugskdeorg.20.dimon3000 2019-04-27 00:39:03 UTC
Might be a cause of
> Digikam::BdEngineBackendPrivate::debugOutputFailedQuery: Failure executing query:
> "REPLACE INTO UniqueHashes (uniqueHash, fileSize, thumbId) VALUES (?,?,?);" 
> Error messages: "QMYSQL3: Unable to execute statement" "Lock wait timeout exceeded; try restarting transaction" 1205 2 
>Bound values:  (QVariant(QString, "2fbd622f4c85df48005344b74f8a50ab"), QVariant(qlonglong, 16648304), QVariant(int, 183543))
Comment 2 Maik Qualmann 2019-04-27 05:25:28 UTC
This problem has been fixed for a long time in the database schema. We already use BIGINT. But we do not do a database update for the thumbnail DB. Delete the thumbnail DB and start with a new one, it will be recreated automatically when digiKam starts. It is also useful to migrate the Core DB with the migration tool to a new DB.

Maik