Old path structure in database
Hi. I am having issue with old path in DB for assets. A noticed it after I re run the extract metadata job. Microservice log:
I put count on DB where the originalpath field is string original and it gives me 32000 (out of 34000)... so something went wrong
26 Replies
Are all of your photos (in the file system) stored in the expected storage template folder structure?
Can you run storage migration job?
Not sure if that'll fix this as the storage migration job still does expect that
originalPath
is valid/correct, but in this situation it looks like originalPath
is wrong to begin with.the 'original' product currently has 97 assets. I don't understand where the problem could be. The other photos are according to the folder structure.
I tried to run the migration job again but it still gives me a bunch of errors as it tries to find those files in the old location
hmm
For example, does this file
original/fad37e7d856746d217f5c6dba2fe381b3bed05da0ef0c585944c3503f2d95937/14307ba0-8c50-4acf-bb75-a2e8431aa0b6.heic
exist?Not in the original folder
Do you see all 34k files in your upload folder?
Assets are displayed normally both in the app and on the web...
The original isn't displayed anywhere
I counted them and I see 120000
What folders do you see?

2011-2023 is the "storage template" format and should contain the originals, but it seems like the database values for "originalPath" are incorrect.
correct
maybe I could copy all files from 2011-2023 back to the original and run the migration job again
It's not just the folder name that has changed, but the whole path, including the filename probably.
I don't really understand how the database and the filesystem could have become out of sync in the first place. Are you using an NFS share with async by chance?
no, I don't use that...
Today it is quite late for me. Tomorrow I will take a good look at it from my side and let you know.
Did you manually run the storage migration at some point recently?
I mean, before you noticed all these errors
dont remember
There are like 2k records in the database that don't have a path with original/ though?
yes... probably assets after mid dec
It's weird, because if it wasn't for the new livephoto feature I wouldn't have even noticed it. Because the assets are nicely displayed in app and WEB too
Yeah, I assume it's been broken for awhile and I think downloading something from the web would fail.
After an original has been uploaded we don't really ever do anything with it except for the one case of moving it via the storage migration job. Seems somehow the job moved the files but didn't update the database record.
You're right, they don't download . Now I understand why my wife always complained that she couldn't download anything 😄 and when I tried it I always had to choose the "right" photo of a newer date
I'll take a look tomorrow, if I come across something I'll be sure to let you know. So far it seems to be a bug only for me.
Sounds good. I think this an immich bug, although not exactly sure what caused it. Moving forward you probably have two options:
1. Start over in a new instance an import everything again
2. SQL updates or manually renaming files to get database and filesystem back in sync
I'd probably rather choose option 2. 😅 We'll see. Thank you very much for your help so far
We're pretty sure this was a bug . Probably in a situation where after the storage migration job started, an issue happened with the database, which resulted in the files moving new a new location, but their paths not being updated in the database. We've fixed 🤞 the initial bug and I will probably work on a server command to repair (re-match/correct) the file locations with their corresponding records in the database in the next week or so.
So if you want to wait until that's done, you could test it and that should resolve your situation.
I reuploaded the whole library again 😅 but thanks for the info