Repository navigation
feat: pg query timeout sec - #254
Merged
Merged
Conversation
aaron-congo
reviewed
Nov 27, 2026
aaron-congo
left a comment
Contributor
There was a problem hiding this comment.
Thanks for working on this! A couple of broader points:
- since this changes behavior fairly broadly, should we add a proxy-based integration test: set
pg_query_timeout_sec, cut traffic through the proxy after connecting (connection stays open, server stops answering), then check that (a) the topology monitor recovers instead of hanging, (b) writer failover finishes withinfailover_timeout_sec, and (c) dialect detection raises instead of caching the wrong dialect. (a) and (b) are essentially the repro from #246. If you'd rather not hold this PR for them, a fast follow-up works too. - Remaining unbounded query:
HostService#query_id_and_name(instance_identity) still runs without a timeout, should we wrap it? Then again, its only entry point isHostService#identify_host, which isn't called anywhere inlib/
sophia-bq
force-pushed
the
feat/pg-query-timeout-sec
branch
from
November 27, 2026 21:19
2a1d161 to
7125ea9
Compare
Contributor
Author
Thank you so much for the review! I'll put up a stacked PR shortly to add the integration tests 😄 |
aaron-congo
approved these changes
Nov 27, 2026
sophia-bq
force-pushed
the
feat/pg-query-timeout-sec
branch
from
December 2, 2026 22:06
7125ea9 to
b4c26b6
Compare
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.
Summary
feat: pg query timeout sec
Addresses #246
Description
Adds a client-side timeout (0–900s, default 0) for the wrapper's own queries: topology, host role, dialect detection, Blue/Green status, failover ROLLBACK, and the KMS key store. It never applies to application queries.
A database that stops answering, even behind a TCP proxy, now fails with a QueryTimeoutError (a PG::ConnectionBad) instead of blocking indefinitely. The wrapper closes connections it opened itself and leaves the application's connection open.
The topology and Blue/Green monitors default to 5s unless the property is set, and they have their own overrides.
A timeout during dialect detection now propagates instead of being read as "not this dialect", so a wrong dialect is no longer cached for 24 hours.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.