Hello @whyman, thanks for a quick fix. Unfortunately fix had ripple effect uncovering another issue.
I built and installed gerbera from master, it shows me version 1.4.0alpha. With this version I executed the following test:
previous sqite3 DB file removed
gerbera started - it created new DB and populated it with fixed schema definition
using web UI, music library imported
in web UI FileSystem view, PC Directory top item with music library removed to purge the whole music library
<<snip>>
My idea why virtual folders were not purged:
My music library has more than 1000 items including containers. Note that MAX_REMOVE_SIZE is defined to 1000. When I removed top container from PC Directory, method SQLStorage::_recursiveRemove went down the tree to items. Items were planned for scan (itemIds vector), but before that, SQLStorage::_removeObjects was called for all containers and items. As FKs are active, ON DELETE CASCADE removes all records referencing containers and items by parent_id or ref_id. It means, all lists of virtual folder structure were removed before scan of itemIds vector. Once itemIds vector scan is executed all virtual list items are gone so virtual containers are not marked as changed.
Hello @whyman, thanks for a quick fix. Unfortunately fix had ripple effect uncovering another issue.
I built and installed gerbera from master, it shows me version 1.4.0alpha. With this version I executed the following test:
PC Directory
top item with music library removed to purge the whole music library<<snip>>
My idea why virtual folders were not purged:
My music library has more than 1000 items including containers. Note that
MAX_REMOVE_SIZE
is defined to 1000. When I removed top container fromPC Directory
, methodSQLStorage::_recursiveRemove
went down the tree to items. Items were planned for scan (itemIds
vector), but before that,SQLStorage::_removeObjects
was called for all containers and items. As FKs are active,ON DELETE CASCADE
removes all records referencing containers and items byparent_id
orref_id
. It means, all lists of virtual folder structure were removed before scan ofitemIds
vector. OnceitemIds
vector scan is executed all virtual list items are gone so virtual containers are not marked as changed.Originally posted by @pcerny in https://github.com/gerbera/gerbera/issues/487#issuecomment-517987052