Jellyfin Forum
DB Entries Not Purged After Folder Change - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+---- Forum: Media Scanning & Identification (https://forum.jellyfin.org/f-media-scanning-identification)
+---- Thread: DB Entries Not Purged After Folder Change (/t-db-entries-not-purged-after-folder-change)



DB Entries Not Purged After Folder Change - Unstaffed8755 - 2024-07-07

I have been having some difficulty with MergeVersions which I linked back to a problem with library.db.  Due to some mounting problems, my default folder path for my Movie and TV directories had changed, so I updated the respective folders for each library to the new mount location (we'll call the move /media1/ -> /media2/ for reference), making sure to remove the old folder in the process.  However once MergeVersions ran, it created duplicate entries for every single file (so a file with 2 versions now had 4 versions, 2 pointing to an invalid location).  So I split the versions again and uninstalled MergeVersions, and the duplicates went away.

After that I did a full rescan on each library (using replace all metadata), cleared the cache, and optimized the db.  Reinstalled MergeVersions again, and the same thing happens.  I ended up opening library.db in DB Browser which MergeVersions was calling from, and found all of the original entries pointing to /media1/ in addition to /media2/.  So while the nonexistent old files do not appear in Jellyfin, they clearly still exist within library.db in addition to the new ones, and MergeVersions is using library.db to determine which files have multiple versions.

It's worth mentioning I've run all scheduled tasks and done the full scan on every library, and it still doesn't clean up those nonexistent entries in library.db.  For reference I am running Jellyfin 10.9.7 debian build.  How can I clean up these entries so that MergeVersions and other plugins will not create duplicates referencing the old nonexistent path?  I'd rather not have to edit these entries manually in DB Browser out of fear of screwing something up.


RE: DB Entries Not Purged After Folder Change - TheDreadPirate - 2024-07-07

Try running the Optimize Database scheduled task manually. The code doesn't explicitly say what it does, but perhaps it will clear out those entries.


RE: DB Entries Not Purged After Folder Change - Unstaffed8755 - 2024-07-07

Thanks so much for getting back to me. Unfortunately I've tried the Optimize Database task about 6 or 7 times so far, but unfortunately it didn't help. Is there possibly some way to purge the database and then rebuild it?


RE: DB Entries Not Purged After Folder Change - TheDreadPirate - 2024-07-08

I wonder if a "replace all metadata" scan will accomplish a purge. Otherwise you can try backing up your entire database and metadata directory (while jellyfin isn't running), rename the metadata directory, start jellyfin and see what happens.


RE: DB Entries Not Purged After Folder Change - bijon - 2024-07-25

Do you have an update to this? I have a similar issue. I changed Library paths and now the library.db has duplicate entries for all items: one with the old path and one with the new. I'm assuming blowing away the metadata directory takes any manual edits with it? If so, I'd like to avoid that. I've taken similar steps to the OP but nothing seems to purge those records.

Edit: wrong word