mirror of
https://github.com/Lidarr/Lidarr.git
synced 2026-03-03 00:26:58 -05:00
Rescans Accumulate Files Due To Incorrect DB Modification Timestamp #3255
Labels
No labels
Area: API
Area: Database
Area: Db-migration
Area: Download Clients
Area: Extras
Area: Import Lists
Area: Indexer
Area: Metadata API
Area: Notifications
Area: Organizer
Area: Parser
Area: Scanning
Area: Tooling
Area: UI
Area: Unit Tests
Area: Update API
On Hold: MetadataAPI Blocking
Priority: High
Priority: Low
Priority: Medium
Status: Accepted
Status: Cannot Reproduce
Status: Confirmed
Status: Don't Merge
Status: Help Wanted
Status: In Progress
Status: Info Needed
Status: Investigating
Status: Logs Needed
Status: Maybe One Day
Status: Needs Triage
Status: On Hold
Status: Ready for Review
Status: Unlikely
Status: Waiting for OP
Status: Won't Fix
Type: Bug
Type: Documentation
Type: Duplicate
Type: Enhancement
Type: Enhancement
Type: External Bug
Type: Feature Request
Type: Regression
Type: Support
Type: Support.
conflict
conflict
no-conflict
not-pulled
radarr-pull
readarr-pull
sonarr upstream
sonarr-pull
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Lidarr-Lidarr#3255
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @thegranddesign on GitHub (Dec 5, 2023).
Is there an existing issue for this?
Current Behavior
Summary
After a rescan, it appears as though the
Modifiedcolumn in theTrackFilestable does not get properly updated. In fact it's theDateAddedcolumn and not theModifiedcolumn that more closely reflects the file's modified timestamp.Details
After seeing a lot of
Removing track file from DB as part of manual override of existing filelog lines, I dove into the code and saw that it appears to be removing theTrackFilesrecord and readding it. When a track is re-added to theTrackFilestable, theDateAddedis the inserted time (which is correct), but theModifieddate is retained from the removed record. This would normally be fine, but since the re-adding is also (often) accompanied with a re-tagging, the file's modification timestamp and the DB's modification field get out of sync.This results in subsequent rescans picking up the file again since it doesn't see it as unwanted.
And because the rescan reimports it (which causes another retag and removal/addition to the
TrackFilestable), the track is from then on always marked for rescan.This ultimately results in rescans taking a very, very long time on large libraries.
When I fixed the modification timestamps in the DB to reflect the file's values, my rescans went from taking over 28 hours down to about 34 seconds.
Expected Behavior
After a rescan, the
TrackFilestable's records should have aModifiedcolumn value that reflects the file's modification timestamp.Steps To Reproduce
This is what I did to prove this was the issue:
Additionally, to test that the modification dates fixed the problem, I did the following:
traceloggingrm -f /path/to/your/lidarr/install/logs/*.txt)sqlite3 /path/to/your/lidarr.db 'UPDATE "TrackFiles" SET "Modified" = "DateAdded";'At the end the numbers were significantly better (though not exact since the
DateAddedwouldn't always be within a second of the file's modification timestamp.Environment
What branch are you running?
Master
Trace Logs?
See Reproduction Steps
Trace Logs have been provided as applicable. Reports may be closed if the required logs are not provided.
trace- that are relevant and show this issue.@thegranddesign commented on GitHub (Dec 5, 2023):
Once these issues are fixed I believe it will resolve #3450
@thegranddesign commented on GitHub (Dec 6, 2023):
Also if it will help with debugging, let me know if you want me to attach my config table and XML values.