Skip to content
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

docs: add troubleshooting section in MIGRATIONS.md #45

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

pirtleshell
Copy link
Member

No description provided.

Copy link
Contributor

@galxy25 galxy25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

speaking for current and future developers 🖖🏽

Copy link

@DracoLi DracoLi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great addition 👍


Bun (the db client) uses a simple locking mechanism while running migrations that locks an entire table by attempting to write a row `(id, table_name)` to a table called `bun_migration_locks`. The table uses `table_name` as a unique key so that only one process can lock a table at a time. After the process finishes modifying the table, it deletes its lock.

However, a problem occurs if the process dies while still holding a lock, as the lock will never be deleted & no other process will be allowed to lock the table.
Copy link

@DracoLi DracoLi Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where did you encounter this issue? was it the testnet db?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, on tesetnet. potentially because of my own rapid fire deploys 😄
noticed the migrations weren't running. turned on db query logging and noticed the service continually getting blocked on lock creation 🥴

@pirtleshell pirtleshell merged commit 5ba3572 into main Oct 18, 2023
4 checks passed
@pirtleshell pirtleshell deleted the rp-db-troubleshooting branch October 18, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants