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

Advisory Locks #1078

Open
matthewmcgarvey opened this issue Jan 7, 2025 · 2 comments
Open

Advisory Locks #1078

matthewmcgarvey opened this issue Jan 7, 2025 · 2 comments

Comments

@matthewmcgarvey
Copy link
Member

matthewmcgarvey commented Jan 7, 2025

I've been using the gem with_advisory_lock quite a bit recently in a ruby codebase. The locks are not connected to any table or row and work ok for certain needs in an application.. Maybe we can do something with this in Avram?

Note: I believe rails has some advisory lock functionality built in, but the gem implements polling logic to avoid hanging up the thread for too long. I'm not sure what else it does or if we'd need to consider that. It also has built in config to disable the query cache because updates could happen to the database while waiting for the lock.

https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS

@jwoertink
Copy link
Member

That would be cool. Any idea what that sort of thing could look like?

@robacarp
Copy link
Contributor

robacarp commented Jan 7, 2025

It would be really nice to wrap running migrations in an advisory lock. Rails does this and it prevents a cluster crash when spinning up multiple instances after a deploy that contains migrations.

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

No branches or pull requests

3 participants