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

collector: switch to SKIP LOCKED #270

Merged
merged 1 commit into from
May 26, 2021
Merged

collector: switch to SKIP LOCKED #270

merged 1 commit into from
May 26, 2021

Conversation

rbeuque74
Copy link
Member

  • What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
    Bug fix

  • What is the current behavior? (You can also link to an open issue here)

When µTask is used with a lot of tasks, lock on the postgres can take
a lot of memory as the pg_try_advisory_xact_lock lock function will
try to lock all the rows. As Postgres 9.5+ now handle SKIP LOCKED
keyword, it can be used to try to acquire only one row, without locking
all the existing resolution. The lock will also be scopped at the table
level, instead of the Postgres cluster level previously.

  • Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
    No

  • Other information:

When µTask is used with a lot of tasks, lock on the postgres can take
a lot of memory as the `pg_try_advisory_xact_lock` lock function will
try to lock all the rows. As Postgres 9.5+ now handle `SKIP LOCKED`
keyword, it can be used to try to acquire only one row, without locking
all the existing resolution. The lock will also be scopped at the table
level, instead of the Postgres cluster level previously.

Signed-off-by: Romain Beuque <556072+rbeuque74@users.noreply.github.com>
@rbeuque74 rbeuque74 added the bug Something isn't working label May 25, 2021
@rbeuque74 rbeuque74 requested review from Alkorin, loopfz and wI2L May 25, 2021 17:28
@rbeuque74 rbeuque74 merged commit f46abae into master May 26, 2021
@rbeuque74 rbeuque74 deleted the skip-locked branch May 26, 2021 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants