SUMMARY *** On assigning any tag to image, digikam freezes after ~1 second for 3-4 seconds. When image tags are changed, `TagsJob::run` is called, which recalculates counts for the tags in the database.(`CoreDB::getNumberOfImagesInTags` and `CoreDB::getNumberOfImagesInTagProperties`). With removed `getNumberOfImages*` from `TagsJob::run` no freezes are observed. *** STEPS TO REPRODUCE 1. Have a relatively large number (10 000) of tags in the database 2. Assign any tag to an image OBSERVED RESULT Digicam becomes unresponsive for 3-4 seconds EXPECTED RESULT No freezes
Which kind of database type do you use ? sqlite, mysql internal, or a mysql remote server ? Which Qt version did you use ? If you use Mysql, which version exactly ? Can you run digiKam from a console, and enable the debug trace from Setup/Miscs panel, and reproduce the dysfunction ? Post the debug traces in this room for future investigations. Thanks in advance Gilles Caulier
Created attachment 153072 [details] Debug log
Database type: SQLite Qt version: 5.15.6 After clicking "Apply" in Captions->Tags sidebar there is no debug messages until freeze occurs after ~1 second. After the freeze this message appears in logs: ``` digikam.general: Using 4 CPU core to run threads digikam.general: Using 4 CPU core to run threads digikam.general: Action Thread run 1 new jobs digikam.general: Action Thread run 1 new jobs digikam.general: One job is done digikam.general: One job is done digikam.general: Cancel Main Thread digikam.general: Cancel Main Thread ```
I don't have a database with 10,000 tags, which are also assigned to items, on the fly. Can you send your digikam4.db as a ZIP file to my private email? Maik
Hello Maik Sent a dummy database to your email Turns out i had the "Show a count of items in Tree Views" enabled After disabling "Show a count of items in Tree Views" in "Settings->Views->Tree-Views" freeze no longer as noticeable, but is still present (~1.5 seconds)
Thank you for creating the test environment. The problem can be reproduced here and a first hot fix is available. There will be further optimizations. The function for updating the tags counter can also be accelerated by a good 80ms, which is also almost a second with the 10 tag models. One second remains at the moment that the view freezes. Maik
Git commit 0e0a3bc734e6841ee7c0b40084cd45b7e82ad2c7 by Maik Qualmann. Committed on 22/10/2022 at 06:36. Pushed by mqualmann into branch 'master'. default tag models not sort on face tag counter update Related: bug 446616, bug 438429, bug 422208 M +9 -6 core/libs/tags/widgets/tagfolderview.cpp https://invent.kde.org/graphics/digikam/commit/0e0a3bc734e6841ee7c0b40084cd45b7e82ad2c7
Git commit f48d78ecc04ba234f2010792cc679c9ce0c69992 by Maik Qualmann. Committed on 22/10/2022 at 13:13. Pushed by mqualmann into branch 'master'. use a QHash for album and tag counters Related: bug 446616, bug 438429, bug 422208 M +2 -1 core/libs/album/manager/albummanager.cpp M +12 -12 core/libs/album/manager/albummanager.h M +6 -6 core/libs/album/manager/albummanager_album.cpp M +11 -11 core/libs/album/manager/albummanager_falbum.cpp M +4 -4 core/libs/album/manager/albummanager_p.h M +1 -1 core/libs/album/manager/albummanager_palbum.cpp M +7 -7 core/libs/album/manager/albummanager_talbum.cpp M +14 -14 core/libs/database/coredb/coredb.cpp M +6 -6 core/libs/database/coredb/coredb.h M +7 -7 core/libs/database/dbjobs/dbjob.cpp M +3 -3 core/libs/database/dbjobs/dbjob.h M +6 -6 core/libs/database/dbjobs/dbjobsthread.cpp M +4 -4 core/libs/database/dbjobs/dbjobsthread.h M +2 -2 core/libs/models/abstractalbummodel.h M +10 -10 core/libs/models/abstractalbummodel_counting.cpp M +14 -3 core/libs/models/albumfiltermodel.cpp M +3 -3 core/libs/models/albummodel.cpp M +1 -1 core/libs/models/albummodel.h M +5 -5 core/libs/models/albummodel_date.cpp M +9 -9 core/libs/models/albummodel_tag.cpp M +11 -11 core/tests/albummodel/albummodel_utest.cpp M +3 -3 core/tests/albummodel/albummodel_utest.h M +9 -9 core/tests/database/databasetags_utest.cpp M +2 -2 core/tests/database/databasetags_utest.h M +2 -2 core/utilities/maintenance/facesdetector.cpp https://invent.kde.org/graphics/digikam/commit/f48d78ecc04ba234f2010792cc679c9ce0c69992
Git commit 447c28157c556387dd9044169b3e882fe6b82c4a by Maik Qualmann. Committed on 22/10/2022 at 13:36. Pushed by mqualmann into branch 'master'. optimize tag counter update in the model Related: bug 446616, bug 438429, bug 422208 FIXED-IN: 8.0.0 M +2 -2 NEWS M +1 -1 core/libs/models/abstractalbummodel.h M +9 -11 core/libs/models/abstractalbummodel_counting.cpp https://invent.kde.org/graphics/digikam/commit/447c28157c556387dd9044169b3e882fe6b82c4a
Git commit 94c6c851bb1608ae7fd16ea2a60c72b21fc91faa by Maik Qualmann. Committed on 22/10/2022 at 13:49. Pushed by mqualmann into branch 'qt5-maintenance'. backport from master the main tag counter fix Related: bug 446616, bug 438429, bug 422208 M +9 -11 core/libs/models/abstractalbummodel.cpp M +1 -1 core/libs/models/abstractalbummodel.h M +9 -6 core/libs/tags/widgets/tagfolderview.cpp https://invent.kde.org/graphics/digikam/commit/94c6c851bb1608ae7fd16ea2a60c72b21fc91faa