8000 🐛 Bug Report: problem migrating cache collection · Issue #7887 · appwrite/appwrite · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

🐛 Bug Report: problem migrating cache collection #7887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
Emilien-Lambert opened this issue Mar 30, 2024 · 10 comments · Fixed by #8298
Closed
2 tasks done

🐛 Bug Report: problem migrating cache collection #7887

Emilien-Lambert opened this issue Mar 30, 2024 · 10 comments · Fixed by #8298
Assignees
Labels
bug Something isn't working product / self-hosted Issues only found when self-hosting Appwrite upgrade This issue occurs when upgrading from one version to another

Comments

@Emilien-Lambert
Copy link
Emilien-Lambert commented Mar 30, 2024

👟 Reproduction steps

I wanted to update my Appwrite server to version 1.5.4 and when I run the migrate command to execute the migration script I get an error when processing the cache collection. (from version 1.4.2)

I looked in mariadb and it seems that all my UUIDs in the cache collection are this shape b64e17d8fbcf3f37801eafd369a29e16*509 I don't know if this is normal or not.

What can I do in the meantime? Delete the *509 at the end of the UUID? Or could I drop the whole _1_cache and _1_cache_perms collection? If it's cache, it shouldn't matter, should it?

Thank you for your help

👍 Expected behavior

The migration script runs smoothly and error-free.

👎 Actual Behavior

Error executing migration from version 1.4.2

Migrating Collection cache:
100 / 587

Fatal error: Uncaught Utopia\Database\Exception\Query: Invalid query: Invalid cursor: UID must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can't start with a leading underscore in /usr/src/code/vendor/utopia-php/database/src/Database/Database.php:4694
Stack trace:
#0 /usr/src/code/src/Appwrite/Migration/Migration.php(221): Utopia\Database\Database->find(Object(Utopia\Database\Document), Array)
#1 /usr/src/code/src/Appwrite/Migration/Migration.php(171): Appwrite\Migration\Migration->documentsIterator('cache')
#2 [internal function]: Appwrite\Migration\Migration->Appwrite\Migration\{closure}(Array, Array)
#3 {main}
  thrown in /usr/src/code/vendor/utopia-php/database/src/Database/Database.php on line 4694

🎲 Appwrite version

Version 1.5.x

💻 Operating system

Linux

🧱 Your Environment

Application Appwrite deployed with CapRover
OS Ubuntu 23.10

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@Emilien-Lambert Emilien-Lambert added the bug Something isn't working label Mar 30, 2024
@eldadfux eldadfux changed the title 🐛 Bug Report: 🐛 Bug Report: problem migrating cache collection Mar 31, 2024
@Emilien-Lambert Emilien-Lambert closed this as not planned Won't fix, can't repro, duplicate, stale Mar 31, 2024
@stnguyen90 stnguyen90 reopened this Apr 25, 2024
@stnguyen90 stnguyen90 added the upgrade This issue occurs when upgrading from one version to another label Apr 25, 2024
@stnguyen90
Copy link
Contributor

Ya it looks like the ID violates the constraint we have...The best thing to do right now would be to delete everything in that cache table and then run the migrate command again.

@mkay-42069
Copy link

Ya it looks like the ID violates the constraint we have...The best thing to do right now would be to delete everything in that cache table and then run the migrate command again.

The issue still persists…
I ran:

DELETE FROM _1_cache;
DELETE FROM _1_cache_perms;

which was succesful, then ran docker compose exec appwrite migrate again, but the error still comes up.

Migrating Collection cache:
100 / 128

Fatal error: Uncaught Utopia\Database\Exception\Query: Invalid query: Invalid cursor: UID must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can't start with a leading underscore in /usr/src/code/vendor/utopia-php/database/src/Database/Database.php:4694
Stack trace:
#0 /usr/src/code/src/Appwrite/Migration/Migration.php(222): Utopia\Database\Database->find(Object(Utopia\Database\Document), Array)
#1 /usr/src/code/src/Appwrite/Migration/Migration.php(172): Appwrite\Migration\Migration->documentsIterator('cache')
#2 [internal function]: Appwrite\Migration\Migration->Appwrite\Migration\{closure}(Array, Array)
#3 {main}
  thrown in /usr/src/code/vendor/utopia-php/database/src/Database/Database.php on line 4694

1.5.4->1.5.5

@stnguyen90
Copy link
Contributor

@mkay-42069, do you have any other cache tables?

@mkay-42069
Copy link

@mkay-42069, do you have any other cache tables?

Ah, yes I have. My bad, just removed the second cache, migration was successful!

For future reference and just to be clear I currently have two projects, would I need to delete the cache for each project individually?

@xuelink
Copy link
Contributor
xuelink commented Apr 26, 2024

@mkay-42069, do you have any other cache tables?

Ah, yes I have. My bad, just removed the second cache, migration was successful!

For future reference and just to be clear I currently have two projects, would I need to delete the cache for each project individually?

Do you mean that? @mkay-42069

DELETE FROM _console_cache;
DELETE FROM _console_cache_perms;

@mkay-42069
Copy link

@mkay-42069, do you have any other cache tables?

Ah, yes I have. My bad, just removed the second cache, migration was successful!
For future reference and just to be clear I currently have two projects, would I need to delete the cache for each project individually?

Do you mean that? @mkay-42069

DELETE FROM _console_cache;
DELETE FROM _console_cache_perms;

No just the second cache

DELETE FROM _2_cache;
DELETE FROM _2_cache_perms;

@xuelink
Copy link
Contributor
xuelink commented Apr 26, 2024

@mkay-42069 i dont have only _3 instead of _1 and _2 and when i run following it worked for me, thank you !

DELETE FROM _console_cache;
DELETE FROM _console_cache_perms;
DELETE FROM _3_cache;
DELETE FROM _3_cache_perms;

@stnguyen90 stnguyen90 added the product / self-hosted Issues only found when self-hosting Appwrite label May 3, 2024
@stnguyen90
Copy link
Contributor
stnguyen90 commented May 3, 2024

b64e17d8fbcf3f37801eafd369a29e16*509

Ohhh...the length isn't the problem...it's the * in it...Looks like this should only be a problem for projects with data before 1.4.3 and shouldn't be a problem moving forward.

@stnguyen90 stnguyen90 self-assigned this May 3, 2024
@Emilien-Lambert
Copy link
Author

b64e17d8fbcf3f37801eafd369a29e16*509

Ohhh...the length isn't the problem...it's the * in it...Looks like this should only be a problem for projects with data before 1.4.3 and shouldn't be a problem moving forward.

I was careful to mention the following in the issue 🙄

"I looked in mariadb and it seems that all my UUIDs in the cache collection are this shape b64e17d8fbcf3f37801eafd369a29e16*509 I don't know if this is normal or not."

@DevJCrystal
Copy link

I had to delete everything up to _7_cache and _7_cache_perms. Thanks for the help!

@stnguyen90 stnguyen90 moved this to Todo in 1.5 release May 15, 2024
stnguyen90 added a commit that referenced this issue May 22, 2024
The document ID should not have special characters like "*" or it will
cause problems with things like cursor based pagination which is done
in migrations.

We did have the cache buster inside the md5 call before, but when the
usage code was reverted and whatnot, the change wasn't added back
properly.

Related: #7887
@stnguyen90 stnguyen90 linked a pull request Jun 20, 2024 that will close this issue
2 tasks
@stnguyen90 stnguyen90 moved this from Todo to In Review in 1.5 release Jun 20, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in 1.5 release Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product / self-hosted Issues only found when self-hosting Appwrite upgrade This issue occurs when upgrading from one version to another
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants
0