Skip to content

Conversation

bonnefoa
Copy link
Contributor

What does this PR do?

Include virtualxid and transactionid locks with the pg_locks metrics.

Motivation

In postgres, a transaction can wait for another transaction to end by trying to acquire a sharelock on the target transactionid's lock. We currently exclude those due to the join on relname/schema/db as they have null values.

This PR convert pg_locks to a dynamic query and handles locks with null relname/schema/db.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

Copy link

⚠️ Major version bump
The changelog type changed or removed was used in this Pull Request, so the next release will bump major version. Please make sure this is a breaking change, or use the fixed or added type instead.

Copy link

codecov bot commented Sep 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.26%. Comparing base (87e8c9e) to head (7d665ff).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bonnefoa bonnefoa force-pushed the bonnefoa/pg-locks-txid branch from f90f1ef to 52d2010 Compare September 18, 2025 09:07
In postgres, a transaction can wait for another transaction to end by trying
to acquire a sharelock on the target transactionid's lock. We currently
exclude those due to the join on relname/schema/db as they have null
values.

This PR convert pg_locks to a dynamic query and handles locks with null
relname/schema/db.
@bonnefoa bonnefoa force-pushed the bonnefoa/pg-locks-txid branch from 52d2010 to 7d665ff Compare September 18, 2025 13:37
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.

1 participant