stash icon indicating copy to clipboard operation
stash copied to clipboard

[Bug Report] Moved files check uses MD5 in addition to OSHASH when detecting moved files

Open feederbox826 opened this issue 1 year ago • 1 comments

Describe the bug When checking if a file has been renamed, if MD5 hashing is enabled, it will be used alongside OSHASH in searching for the file, even after the OSHASH has been confirmed

To Reproduce Steps to reproduce the behavior:

  1. Enabled Calculate MD5 for videos
  2. Scan in a large file (40GB)
  3. Notice that it has MD5 and OSHASH
  4. Rename file
  5. Upon rescanning, activate trace and see that it's using MD5 as well

Expected behavior On file move, only OSHASH is used instead of both OSHASH and MD5

Screenshots full debug log available upon request, truncated for brevity

2024-07-03 23:40:11
Info    
/media/stash/largefile.mp4 moved to /media/stash/largefile_new.mp4. Updating path...
2024-07-03 23:40:11
Trace   
SQL [112.41µs]: SELECT `files`.`id` 
  [ TRUNCATED ]
  args: [md5 00000000000000000000000000000000]
2024-07-03 23:40:11
Trace   
SQL [5.044433ms]: SELECT `files`.`id` 
 [ TRUNCATED ]
 args: [oshash 0000000000000000]
2024-07-03 23:39:29
Info    
Calculating fingerprints for /media/stash/largefile_new.mp4 ...
2024-07-03 23:39:29
Trace   
SQL [123.771µs]: SELECT `files`.`id` 
 [ TRUNCATED ]
 WHERE ((`folders`.`path` = ?) AND (`files`.`basename` = ?)), args: [/media/stash/largefile_new.mp4]
2024-07-03 23:39:29
Info    
Finished adding files to queue. 2729 files queued

Stash Version: (from Settings -> About): v0.26.2-35-g4cca3b29

Additional context

I've only noticed this after churning through renaming large files. I can see the usefulness but it might be better reserved as part of image generation

feederbox826 avatar Jul 04 '24 03:07 feederbox826

https://github.com/stashapp/stash/blob/51999135be14687527750ba12a05abc46fef487a/pkg/models/fingerprint.go#L95-L105

Any reason why this shouldn't short circuit early if one of the conditions is already true https://github.com/stashapp/stash/pull/2945

feederbox826 avatar Nov 18 '25 02:11 feederbox826