immich icon indicating copy to clipboard operation
immich copied to clipboard

Storage template migration - unexpected behaviour

Open lmgithu opened this issue 1 year ago • 36 comments

The bug

When I set a new template for the folder structure (switching from yyyy-mm-dd to yyyy-mm only) and run the storage template migration job, I see that 1) the job finished running 2) 80% of the folders now have a mix of yyyy-mm-dd and yyyy-mm folders with data in them).

I wanted to check why immich is not capable of transforming all folders and why there are leftovers? My other contern is whether this is breaking viewing the images and/or the database.

Desired outcome:

  • all folders on a file level should be in the new format ONLY

The OS that Immich Server is running on

Debian

Version of Immich Server

v1.98.2

Version of Immich Mobile App

v1.98.2

Platform with the issue

  • [X] Server
  • [ ] Web
  • [ ] Mobile

Your docker-compose.yml content

standard

Your .env content

standard

Reproduction steps

1. set a new storage template
2. run the template migration job
3. not all folders are getting migrated, it is absolutely random

Additional information

No response

lmgithu avatar Mar 22 '24 10:03 lmgithu

some additional observations:

If i start another migration to migrate thumbnails for assets and faces to the latest folder structure, that job always runs on ALL my assets (100K+)... each time i see the huge number of assets that go down to zero but it seems it is not getting processed in reality as each time when i start the job it shows same high number.

lmgithu avatar Mar 22 '24 14:03 lmgithu

Can you help double-check the files in the older format yyyy-mm-dd to see if the path corresponds to the file's path that is shown in the UI?

image

alextran1502 avatar Mar 22 '24 14:03 alextran1502

I think the issue is now even bigger, I tried to check a file in that folder and one of them is there on the file system but NOT on the UI.. I don't see these images anymore :( In another case I do see as you do, it is on the UI as well and it still refers to the old folder (attached screenshot below)

Screenshot 2024-03-22 at 16 03 00

lmgithu avatar Mar 22 '24 15:03 lmgithu

If you need, I can share the logs and/or the file itself that it did not process. Let me know how I could help.

lmgithu avatar Mar 22 '24 15:03 lmgithu

NOT on the UI.

Can you use the search for file name to find that file to see if it returns in the search result. Please attach the screenshot of the file on the file system as well as the search result if you can

alextran1502 avatar Mar 22 '24 15:03 alextran1502

Also logs, on the server when you run the migration would be helpful, you can increase the log level to debug in the Server settings in the Administration page

alextran1502 avatar Mar 22 '24 16:03 alextran1502

Will do and report back in an hour. How can I download/extract the log file?

lmgithu avatar Mar 22 '24 16:03 lmgithu

From the terminal, run docker logs immich_server or docker logs immich_microservices

alextran1502 avatar Mar 22 '24 16:03 alextran1502

hi Alex,

Here are the results: searching for the image name on UI: no result. I can't take a screenshot as there is no results, it just shows my photo feed (I confirm it works for other image names). Screenshot of file system/location of the image: attached. Screenshot 2024-03-22 at 19 30 00

Log:

immich_server_1            | [Nest] 6  - 03/22/2024, 6:25:05 PM   DEBUG [JobService] Handling command: queue=storageTemplateMigration,force=false
immich_redis_1             | 15:C 22 Mar 2024 18:05:08.034 * RDB: 0 MB of memory used by copy-on-write
immich_redis_1             | 1:M 22 Mar 2024 18:05:08.107 * Background saving terminated with success
immich_redis_1             | 1:M 22 Mar 2024 18:10:09.036 * 100 changes in 300 seconds. Saving...
immich_redis_1             | 1:M 22 Mar 2024 18:10:09.037 * Background saving started by pid 16
immich_redis_1             | 16:C 22 Mar 2024 18:10:09.161 * DB saved on disk
immich_redis_1             | 16:C 22 Mar 2024 18:10:09.162 * RDB: 0 MB of memory used by copy-on-write
immich_redis_1             | 1:M 22 Mar 2024 18:10:09.239 * Background saving terminated with success
immich_redis_1             | 1:M 22 Mar 2024 18:15:10.025 * 100 changes in 300 seconds. Saving...
immich_redis_1             | 1:M 22 Mar 2024 18:15:10.025 * Background saving started by pid 17
immich_redis_1             | 17:C 22 Mar 2024 18:15:10.052 * DB saved on disk
immich_redis_1             | 17:C 22 Mar 2024 18:15:10.052 * RDB: 0 MB of memory used by copy-on-write
immich_redis_1             | 1:M 22 Mar 2024 18:15:10.126 * Background saving terminated with success
immich_redis_1             | 1:M 22 Mar 2024 18:20:11.071 * 100 changes in 300 seconds. Saving...
immich_redis_1             | 1:M 22 Mar 2024 18:20:11.072 * Background saving started by pid 18
immich_redis_1             | 18:C 22 Mar 2024 18:20:11.098 * DB saved on disk
immich_redis_1             | 18:C 22 Mar 2024 18:20:11.098 * RDB: 0 MB of memory used by copy-on-write
immich_redis_1             | 1:M 22 Mar 2024 18:20:11.172 * Background saving terminated with success
immich_redis_1             | 1:M 22 Mar 2024 18:25:12.096 * 100 changes in 300 seconds. Saving...
immich_redis_1             | 1:M 22 Mar 2024 18:25:12.096 * Background saving started by pid 19
immich_redis_1             | 19:C 22 Mar 2024 18:25:12.120 * DB saved on disk
immich_redis_1             | 19:C 22 Mar 2024 18:25:12.120 * RDB: 0 MB of memory used by copy-on-write
immich_redis_1             | 1:M 22 Mar 2024 18:25:12.196 * Background saving terminated with success
immich_machine-learning_1  | [03/22/24 18:25:17] DEBUG    Checking for inactivity...                         
immich_machine-learning_1  | [03/22/24 18:25:27] DEBUG    Checking for inactivity...                         
immich_machine-learning_1  | [03/22/24 18:25:37] DEBUG    Checking for inactivity...                         
immich_machine-learning_1  | [03/22/24 18:25:47] DEBUG    Checking for inactivity...                         
immich_machine-learning_1  | [03/22/24 18:25:57] DEBUG    Checking for inactivity...                         
immich_machine-learning_1  | [03/22/24 18:26:07] DEBUG    Checking for inactivity...                         
immich_machine-learning_1  | [03/22/24 18:26:17] DEBUG    Checking for inactivity...                         
immich_machine-learning_1  | [03/22/24 18:26:27] DEBUG    Checking for inactivity...                         
immich_machine-learning_1  | [03/22/24 18:26:37] DEBUG    Checking for inactivity...  

lmgithu avatar Mar 22 '24 18:03 lmgithu

Just to make sure, can you drag-and-drop that file on the web to see if it successfully upload or it will say duplicated

alextran1502 avatar Mar 22 '24 18:03 alextran1502

I tried, it said "skipped 1 duplicated asset"

lmgithu avatar Mar 22 '24 18:03 lmgithu

So it should be on the server, could it be in the archive view somehow?

alextran1502 avatar Mar 22 '24 18:03 alextran1502

No, it is not there in the archive :(

lmgithu avatar Mar 22 '24 18:03 lmgithu

Can you confirm the visual of the image on that date,not just the file name?

alextran1502 avatar Mar 22 '24 19:03 alextran1502

Yes I can, I can't see this image visually on the UI, despite it is on the file system.

lmgithu avatar Mar 22 '24 19:03 lmgithu

hmm strange, can you show me the search query you put in to search for the file name?

alextran1502 avatar Mar 22 '24 19:03 alextran1502

here you are:

Screenshot 2024-03-22 at 20 13 45

lmgithu avatar Mar 22 '24 19:03 lmgithu

this works for any other filename btw and I can see the results

lmgithu avatar Mar 22 '24 19:03 lmgithu

Try 5841? and did you tick on the archive button at the very bottom of the page?

alextran1502 avatar Mar 22 '24 19:03 alextran1502

Do you know why certain folders/files were ignored? this is how my folders look like:

Screenshot 2024-03-22 at 20 16 07

Interestingly, until 2010 every folder looks OK... after that, it is fully random and mixed.

lmgithu avatar Mar 22 '24 19:03 lmgithu

I am not sure, we will have to look at this more in-depth. Thanks for the report

alextran1502 avatar Mar 22 '24 19:03 alextran1502

Could I somehow force process folders again?

lmgithu avatar Mar 22 '24 19:03 lmgithu

or at least "delete" these files somehow so i could reupload them?

lmgithu avatar Mar 22 '24 19:03 lmgithu

Can you check the Trash page to see if it is in it?

alextran1502 avatar Mar 22 '24 19:03 alextran1502

WIN, it was in the Trash! Sorry, this was such a noob issue. Now we "just" have the folder structure issue that it is fully random, I think there are no missing images. Do you have any guess what might be the issue and how to fix it?

lmgithu avatar Mar 22 '24 19:03 lmgithu

Do you have any guess what might be the issue and how to fix it?

The issue is that we don't move files that are already in the trash :P So it is working as expect

alextran1502 avatar Mar 22 '24 19:03 alextran1502

no, it was a SINGLE image... not all of them.

lmgithu avatar Mar 22 '24 19:03 lmgithu

99% of the files that were not moved are NOT in the Trash

lmgithu avatar Mar 22 '24 19:03 lmgithu

Then we will need to circle back and look at this!

alextran1502 avatar Mar 22 '24 19:03 alextran1502

Thank you! Is there any way to "force" the migration again?

lmgithu avatar Mar 22 '24 19:03 lmgithu