Repository navigation
Conversation
Code review comments addressed: - Respect the IP settings in connection configuration (self._ip_type) rather than probing all available IPs - Use SERVER_PROXY_PORT constant (3307) - Use DEFAULT_CONNECT_TIMEOUT constant (30) / configured timeout
…n LazyRefreshCache
- Implement PostgresConnection wrapping socket/SSLSocket with chunked streaming StartupMessage inspection.
- Support sequential GSSENCRequest and SSLRequest negotiation packets via while loop.
- Decouple connection lifecycle by injecting dial_func into RefreshAheadCache and LazyRefreshCache.
- Guard against probing non-PostgreSQL engines and empty IAM principals.
- Wait for server EOF/close after Terminate ('X') before socket close to prevent TCP RST.
- Add comprehensive unit tests covering single packets, chunked writes, non-Postgres pass-through, clean teardown, and dial_func injection.
TAG=agy
CONV=fd38e7c1-d8b6-47e6-94f2-174ccc8913e1
…ostgres_startup_packet TAG=agy CONV=c65487bd-f8a2-456e-a222-fdaf30d732ea
Collaborator
Author
Update: Stream Parser Flow Narration
PR maintained in DRAFT mode. |
- Use max(1, timeout) in _send_startup_probe to prevent ValueError or immediate timeout on non-positive timeout values. TAG=agy CONV=fd38e7c1-d8b6-47e6-94f2-174ccc8913e1
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.
Description
In Cloud SQL Managed Connection Pooling (MCP / PgBouncer), background token refresh probes using empty TLS handshakes fail to update PgBouncer's shared credential pool (
db->user_tree), causing persistent connections that remain open while PgBouncer server connections idle out to fail after 1 hour withSQLSTATE 08P01(GoogleCloudPlatform/cloud-sql-proxy#2553).This PR implements the proactive PostgreSQL v3
StartupMessageIAM refresh probe:(user, database)on active PostgreSQL IAM connections.StartupMessagewith the fresh token, updates PgBouncer's pool credentials, readsAuthenticationOk('R'), sendsTerminate('X'), and drains server EOF before closing.whileloop in packet parser to support sequentialGSSEncRequest(80877104) andSSLRequest(80877103) double negotiation.PostgresConnectionwrapper for synchronous drivers, delegating socket operations with 0 overhead on steady-state queries.mainpreserving Developer Edition (sqldata_client.py) and passing 100% of unit tests and linters.TAG=agy
CONV=c65487bd-f8a2-456e-a222-fdaf30d732ea