| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
This PR adds support for Developer Edition connections via the SqlDataService. It includes a fallback mechanism to standard IP connections if the SqlDataService is not supported by the instance edition. See GoogleCloudPlatform/cloud-sql-go-connector#1108
…meout Code Review Comments: - connector.py: DriverMapping[driver] raised KeyError for lowercase driver names during IAM auth in SQL_DATA mode. Fixed by looking up DriverMapping[driver.upper()].value. - sqldata_client.py: self._timeout was configured on the client but never passed to the gRPC StreamSqlData call. Fixed by passing timeout=self._timeout.
… resource cleanup Code Review Comments: - sqldata_client.py: Replaced asyncio.gather with explicit task cancellation and cleanup via asyncio.wait to prevent orphaned background streaming tasks on failure or disconnect. - sqldata_client.py: Enhanced SqlDataClient.close() to cancel running tunnel tasks, close active gRPC channels, and close active stream writers. - connector.py: Replaced unbounded self._sqldata_clients list with a set and automatic cleanup callback on tunnel exit to prevent memory leaks. - connector.py: Added try/except error cleanup for fallback_sock during synchronous driver connect in SQL_DATA mode to ensure sockets are closed on exception.
…logging Code Review Comments: - connector.py: Added sql_data_endpoint and sql_data_stream_timeout to create_async_connector signature and forwarded to Connector constructor. - connector.py: Updated Connector.__init__ and create_async_connector docstrings to include IPTypes.SQL_DATA, sql_data_endpoint, and sql_data_stream_timeout. - sqldata_client.py: Moved IPTypes import to module level and replaced hardcoded port 3307 with SERVER_PROXY_PORT constant. - client.py: Updated logging in _get_ephemeral to use standard lazy string formatting (%s).
Code Review Comments: - Added unit tests for Connector initialization and create_async_connector with sql_data_endpoint and sql_data_stream_timeout. - Added unit test verifying connect_async in SQL_DATA mode with enable_iam_auth=True properly normalizes user and avoids DriverMapping KeyError. - Added unit tests for SqlDataClient initialization, port binding via connect_tunnel, close resource/task cancellation, and FallbackSocket.
…se CloudSQLConnectionError for missing CA cert Code Review Decisions: - sqldata_client.py: Updated fallback IP preference order to [PRIVATE, PSC, PUBLIC] to prioritize private connectivity over public IP. - exceptions.py: Added CloudSQLConnectionError exception class. - connection_info.py: Raised CloudSQLConnectionError instead of generic ValueError when server_ca_cert is None. - test_instance.py: Added unit test verifying CloudSQLConnectionError on missing server_ca_cert.
…rove state encapsulation Code Review Comments: - sqldata_client.py: Wrapped connection initialization and task execution in a single top-level try...finally block in _handle_tunnel to ensure client_writer, gRPC channel, and close callbacks are always cleaned up even if initialization raises an exception. - sqldata_client.py: Improved is_resource_exhausted_error to support grpc.RpcError and unwrapped exception causes. - sqldata_client.py: Reduced wait_closed timeout on server teardown to eliminate unnecessary 2-second delays and warning logs. - connector.py: Added helper methods (is_cooldown_active, record_exhausted, record_success, record_fallback) to SqlDataConnState. - connector.py: Added resource_exhausted_cooldown_period documentation to Connector.__init__ docstring. - test_connector.py: Added unit tests for SqlDataConnState helper methods and chained exception support in is_resource_exhausted_error.
…move async TCP tunnel - Replace local TCP loopback tunnel server and event loop reader/writer forwarding with direct synchronous SqlDataSocket implementation - Remove async mode, GOOGLE_CLOUD_SQL_DATA_IMPL toggle, and FallbackSocket - Update SqlDataClient to manage synchronous gRPC streams and return SqlDataSocket wrapping _RequestQueue and background response reader - Update unit tests to verify direct socket connection and lifecycle
| Back | FazBrowse Home | New Git URL |
This PR adds support for Developer Edition connections via the SqlDataService. It includes a fallback mechanism to standard IP connections if the SqlDataService is not supported by the instance edition.
See GoogleCloudPlatform/cloud-sql-go-connector#1108