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

Take ACCESS EXCLUSIVE LOCK carefully #298

Merged
merged 2 commits into from
Mar 31, 2023

Conversation

za-arthur
Copy link
Collaborator

Try to get the lock in loop with timeouts using lock_exclusive(). This allows to not stuck lock queue for readers if pg_repack cannot take the lock fast enough.

We had incidents when cleanup functions, which run repack.repack_drop(), couldn't get ACCESS EXCLUSIVE lock in a reasonable time. It was because there was long running write connections, running around 5-10 minutes. repack.repack_drop() also stucks lock queue block any new readers until all old writes finish.

@andreasscherbaum
Copy link
Collaborator

@za-arthur Please rebase and run GitHub Actions checks.

Try to get the lock in loop with timeouts using `lock_exclusive()`.
This allows to not stuck lock queue for readers if pg_repack
cannot take the lock fast enough.
@za-arthur
Copy link
Collaborator Author

@andreasscherbaum I rebased the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants