feat: storage template file move hardening#5917
Conversation
Deploying with
|
| Latest commit: |
b5d1617
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://24067ebe.immich.pages.dev |
| Branch Preview URL: | https://feat-storage-template-harden.immich.pages.dev |
0c89f0f to
023f08f
Compare
danieldietzler
left a comment
There was a problem hiding this comment.
Looking good so far! :)
server/src/domain/storage-template/storage-template.service.spec.ts
Outdated
Show resolved
Hide resolved
527720b to
f99db77
Compare
|
Ready for review and merge 😄 |
danieldietzler
left a comment
There was a problem hiding this comment.
Have you thought about nesting the files by default in a ab/cd/abcdxx-xxxx-xxxxx structure?
bo0tzz
left a comment
There was a problem hiding this comment.
Good stuff. Did you not end up adding the locking to this?
|
I just tested the PR, it seems like the motion part of LivePhotos aren't moved to the library |
We have explicit tests that check this behaviour so they should be. I haven't actually changed any of that logic, it's just two seperate calls to move each seperate part. |
No, I will only add locking if the PR refactoring the locking mechanism gets merged before this PR does. |
Forgot about that, can change it to that structure, yea |
Ty :) |
459008c to
49389eb
Compare
|
@zackpollard This condition prevents moving the video part of the LivePhotos upload I tested with If I remember correctly, we are not extracting EXIF and add a record in EXIF table for the motion part of LivePhotos |
…can cause race conditions above 1
49389eb to
ab750e1
Compare
|
Changed exif extraction to run for all assets, including assets marked isVisible = false. This should resolve the issues with live photos not moving correctly. |
131e8a2 to
b5d1617
Compare
* fix: pgvecto.rs extension breaks typeorm schema:drop command * fix: parse postgres bigints to javascript number types when selecting data * feat: verify file size is the same as original asset after copying file for storage template job * feat: allow disabling of storage template job, defaults to disabled for new instances * fix: don't allow setting concurrency for storage template migration, can cause race conditions above 1 * feat: add checksum verification when file is copied for storage template job * fix: extract metadata for assets that aren't visible on timeline


Storage template moving can sometimes fail and cause data corruption when the upload folder and library folder are not the same filesystem. This PR aims to address the existing problem and add validation of the file operations to ensure the moved file data matches the original asset data by the way of file size checks and optional hash checks.
TODO:
Change structure of default upload folder to split GUIDs into seperate folders to improve performanceWill be done in seperate PROptional TODO:
Have the filename itself indicate if it is partial or not (.tmp suffix?)This actually substantially increases complexity with the move table, not going ahead with this for nowKeep an audit log of moves/file operations in the databaseCould be done in seperate PRUse database locks to force template migration concurrency to one, avoiding race conditions where two processes move a file with the same name to the same location, not appending a +nDone in feat: storage template locking + fix for database locks #6054