[*] set lock_timeout via connection RuntimeParams instead of per-query transaction#1067
Merged
pashagolub merged 3 commits intocybertec-postgresql:masterfrom Dec 8, 2025
Conversation
03456f7 to
2fe21ee
Compare
Collaborator
|
Thanks! Can you ask Claude to fix tests or should I? :-) |
Contributor
Author
@pashagolub attempted in 56d368f |
Pull Request Test Coverage Report for Build 20029932099Details
💛 - Coveralls |
…y transaction Reduces metric queries from 4 roundtrips (BEGIN/SET/query/COMMIT) to 1 by setting lock_timeout at connection level via pgx RuntimeParams. - Add --conn-lock-timeout option (default: 100ms, env: PW_CONN_LOCK_TIMEOUT) - Set lock_timeout in RuntimeParams for PostgreSQL sources on connect - Simplify QueryMeasurements by removing transaction wrapper - Set to "0" to disable lock_timeout Ref: https://brandur.org/fragments/postgres-parameters
Tests no longer expect transaction wrapping (BEGIN/SET/COMMIT) since lock_timeout is now set via RuntimeParams at connection time.
User may control connection options through connection string, e.g. `--source=postgresql://foo:baz@bar/db?lock_timeout=100`
fdc08e8 to
b97d7f3
Compare
pashagolub
approved these changes
Dec 8, 2025
pashagolub
added a commit
that referenced
this pull request
Dec 8, 2025
0xgouda
added a commit
that referenced
this pull request
Dec 9, 2025
* Move `sources` package helper functions to `testutil`.
* Move all helpers in `webserver` package to `testutil`.
* Add tests for `Mock{Sources,Metrics}ReaderWriter` to increase test coverage.
* Use `testutil` instead of manual container setup.
* Use testutil `helpers` instead of manually creating mocks/containers.
* Remove `TestSetupRPCServers()`
The setup function should be invoked once across all tests
because it setups a global port listener,
otherwise running tests parallely
may fail with `address already in use` error.
* Add tests to increase test coverage.
* remove `testutil.ExpectQuery`, overruled by #1067
* move `createTestSourceConn()` back to reaper
* Set etcd container version in `EtcdVersion` const.
It maybe useful for logging.
* Revert moving `mockFs` to `testutils`.
* Revert signature change in `createTestSourceConn()`
* Fix line spacing.
---------
Co-authored-by: Pavlo Golub <pavlo.golub@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reduces metric queries from 4 roundtrips (BEGIN/SET/query/COMMIT) to 1 by setting lock_timeout at connection level via pgx RuntimeParams.
Ref: https://brandur.org/fragments/postgres-parameters